From fb0d43daf3b4c787f7334553bd3798157addbac0 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Mon, 27 Apr 2026 07:54:56 +0100 Subject: [PATCH 001/151] feat: distributed locking for platform-database writes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds two DI factories and wires them where coordination is needed: - distributedLock — skip on contention, void return. For idempotent fan-out where N pods doing the same write is wasteful but losing the race is correct. - distributedLockOrFail — blocking acquire (3s default) then throws GENERAL_RESOURCE_LOCKED (HTTP 409) on contention. For read-modify-write on shared mutable state where a silent skip would drop a user's change. Both factories: _APP_LOCKING_ENABLED kill switch (set 'disabled' for fail-open), fail-open on Redis-unreachable, and a lock.attempts telemetry counter sliced by outcome and target collection. Wired sites: - shared/api.php × 3 (distributedLock): keys.accessedAt + sdks, projects.accessedAt, users.accessedAt. Reduces redundant writes and cache-purge fan-out under request bursts on the same project. - Project/Services/Update.php × 1 (distributedLockOrFail): the services map toggle. Re-reads inside the lock so the baseline reflects concurrent updates. Two simultaneous toggles to different services no longer lose one of them. Lock key namespace: lock:platform:{collection}:{id}. Dep: premtsd-code/lock pinned to a specific commit as a development preview. Migration to utopia-php/lock is a follow-up once that package is published. --- app/config/errors.php | 5 + app/config/variables.php | 9 ++ app/controllers/shared/api.php | 40 ++++-- app/init/resources.php | 132 ++++++++++++++++++ composer.json | 9 +- composer.lock | 75 +++++++++- src/Appwrite/Extend/Exception.php | 1 + .../Project/Http/Project/Services/Update.php | 25 +++- 8 files changed, 272 insertions(+), 24 deletions(-) diff --git a/app/config/errors.php b/app/config/errors.php index 07b0cd59ed..f5603f9223 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -54,6 +54,11 @@ return [ 'description' => 'Rate limit for the current endpoint has been exceeded. Please try again after some time.', 'code' => 429, ], + Exception::GENERAL_RESOURCE_LOCKED => [ + 'name' => Exception::GENERAL_RESOURCE_LOCKED, + 'description' => 'The requested resource is currently being modified by another request. Please retry after a brief delay.', + 'code' => 409, + ], Exception::GENERAL_SMTP_DISABLED => [ 'name' => Exception::GENERAL_SMTP_DISABLED, 'description' => 'SMTP is disabled on your Appwrite instance. You can learn more about setting up SMTP in our docs.', diff --git a/app/config/variables.php b/app/config/variables.php index c834656ff4..5dd7196266 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -34,6 +34,15 @@ return [ 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_LOCKING_ENABLED', + 'description' => 'Enable distributed locking for platform writes. Locks coordinate concurrent updates across API pods so that read-modify-write operations on shared documents do not lose updates. By default, set to \'enabled\'. Set to \'disabled\' as an emergency kill switch — locks become no-ops (fail-open) and concurrent writes will race.', + 'introduction' => '1.10.0', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + 'filter' => '' + ], [ 'name' => '_APP_OPTIONS_FORCE_HTTPS', 'description' => 'Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the \'Strict-Transport-Security\' header to all HTTP responses. By default, set to \'enabled\'. To disable, set to \'disabled\'. This feature will work only when your ports are set to default 80 and 443, and you have set up wildcard certificates with DNS challenge.', diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 7c2f527ccf..b07eec1a99 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -100,7 +100,8 @@ Http::init() ->inject('team') ->inject('apiKey') ->inject('authorization') - ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization) { + ->inject('distributedLock') + ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, callable $distributedLock) { $route = $utopia->getRoute(); if ($route === null) { throw new AppwriteException(AppwriteException::GENERAL_ROUTE_NOT_FOUND); @@ -249,15 +250,20 @@ Http::init() } if (! $updates->isEmpty()) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); + // Serialize concurrent per-request writes to this key across API nodes. + // Skip on contention is safe: the winner applies the same idempotent update; + // if this node observed a new SDK the other didn't, the next request catches up. + $distributedLock('lock:platform:keys:' . $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $apiKey, $project, $user, $team) { + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); - if (! empty($apiKey->getProjectId())) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); - } elseif (! empty($apiKey->getUserId())) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('users', $user->getId())); - } elseif (! empty($apiKey->getTeamId())) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('teams', $team->getId())); - } + if (! empty($apiKey->getProjectId())) { + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); + } elseif (! empty($apiKey->getUserId())) { + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('users', $user->getId())); + } elseif (! empty($apiKey->getTeamId())) { + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('teams', $team->getId())); + } + }); } $userClone = clone $user; @@ -388,9 +394,11 @@ Http::init() if ($project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'accessedAt' => DateTime::now() - ]))); + $distributedLock('lock:platform:projects:' . $project->getId(), function () use ($authorization, $dbForPlatform, $project) { + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'accessedAt' => DateTime::now() + ]))); + }); } } @@ -407,9 +415,11 @@ Http::init() 'accessedAt' => $user->getAttribute('accessedAt') ])); } else { - $authorization->skip(fn () => $dbForPlatform->updateDocument('users', $user->getId(), new Document([ - 'accessedAt' => $user->getAttribute('accessedAt') - ]))); + $distributedLock('lock:platform:users:' . $user->getId(), function () use ($authorization, $dbForPlatform, $user) { + $authorization->skip(fn () => $dbForPlatform->updateDocument('users', $user->getId(), new Document([ + 'accessedAt' => $user->getAttribute('accessedAt') + ]))); + }); } } } diff --git a/app/init/resources.php b/app/init/resources.php index 29506bfc9c..4c3a684d4e 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -8,6 +8,7 @@ use Appwrite\Event\Publisher\Migration as MigrationPublisher; use Appwrite\Event\Publisher\Screenshot as ScreenshotPublisher; use Appwrite\Event\Publisher\StatsResources as StatsResourcesPublisher; use Appwrite\Event\Publisher\Usage as UsagePublisher; +use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Utopia\Database\Documents\User; use Executor\Executor; use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis; @@ -22,6 +23,9 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\DI\Container; use Utopia\DSN\DSN; +use Utopia\Lock\Adapter\Redis as LockRedisAdapter; +use Utopia\Lock\Exception\LockAcquireException; +use Utopia\Lock\Lock; use Utopia\Pools\Group; use Utopia\Queue\Broker\Pool as BrokerPool; use Utopia\Queue\Publisher; @@ -213,6 +217,134 @@ $container->set('timelimit', function (\Redis $redis) { }; }, ['redis']); +// Extract the collection segment ("keys" / "projects" / "users") from keys +// of the form "lock:platform:{target}:{id}" so metrics can slice by target. +// Used by both distributedLock and distributedLockOrFail factories below. +$lockTargetOf = function (string $key): string { + $parts = explode(':', $key, 4); + return $parts[2] ?? 'unknown'; +}; + +/** + * Distributed-lock factory: skip-on-contention variant. + * + * For idempotent writes where losing the race is correct (e.g., per-request + * `accessedAt` updates from N pods all writing the same value). On contention, + * the callback is silently skipped — another pod is doing the same work. + * + * Behavior: + * - Non-blocking acquire (one attempt). On conflict, skip and return. + * - Fail-open: if Redis is unreachable, run the callback unlocked + warn. + * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. + * + * Returns void — the caller can't distinguish "acquired and ran" from "skipped". + * + * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, skipped, + * backend_error, release_error}. + */ +$container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf) { + $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; + $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); + + if (! $enabled) { + return function (string $key, \Closure $fn, float $ttl = 5.0): void { + $fn(); + }; + } + + return function (string $key, \Closure $fn, float $ttl = 5.0) use ($redis, $attempts, $lockTargetOf): void { + $target = $lockTargetOf($key); + $lock = new Lock(new LockRedisAdapter($redis), $key, $ttl); + + try { + $acquired = $lock->acquire(); + } catch (LockAcquireException $e) { + $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); + Console::warning("Lock backend unavailable for {$key}, proceeding unlocked: {$e->getMessage()}"); + $fn(); + return; + } + + if (! $acquired) { + $attempts->add(1, ['outcome' => 'skipped', 'target' => $target]); + return; + } + + $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); + try { + $fn(); + } finally { + try { + $lock->release(); + } catch (\Throwable $e) { + $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); + Console::warning("Lock release failed for {$key}: {$e->getMessage()}"); + } + } + }; +}, ['redis', 'telemetry']); + +/** + * Distributed-lock factory: 409-on-contention variant. + * + * For explicit user-write endpoints where read-modify-write on shared mutable + * state must NOT silently drop a request. On contention, throws + * `Exception::GENERAL_RESOURCE_LOCKED` (HTTP 409) so the client retries. + * + * Behavior: + * - Blocking acquire with short timeout (default 3s). + * - On timeout, throws `GENERAL_RESOURCE_LOCKED`. + * - Fail-open: backend unreachable runs the callback unlocked + warning. + * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. + * - Returns the callback's return value so callers can use the result. + * + * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, contended, + * backend_error, release_error}. + */ +$container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf) { + $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; + $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); + + if (! $enabled) { + return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0): mixed { + return $fn(); + }; + } + + return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0) use ($redis, $attempts, $lockTargetOf): mixed { + $target = $lockTargetOf($key); + $lock = new Lock(new LockRedisAdapter($redis), $key, $ttl); + + try { + $acquired = $lock->acquire(blocking: true, waitTimeout: $waitTimeout, retryDelay: 0.1); + } catch (LockAcquireException $e) { + $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); + Console::warning("Lock backend unavailable for {$key}, proceeding unlocked: {$e->getMessage()}"); + return $fn(); + } + + if (! $acquired) { + $attempts->add(1, ['outcome' => 'contended', 'target' => $target]); + throw new AppwriteException( + AppwriteException::GENERAL_RESOURCE_LOCKED, + "Resource '{$key}' is currently being modified by another request. Please retry." + ); + } + + $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); + try { + return $fn(); + } finally { + try { + $lock->release(); + } catch (\Throwable $e) { + $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); + Console::warning("Lock release failed for {$key}: {$e->getMessage()}"); + } + } + }; +}, ['redis', 'telemetry']); + $container->set('deviceForLocal', function (Telemetry $telemetry) { return new Device\Telemetry($telemetry, new Local()); }, ['telemetry']); diff --git a/composer.json b/composer.json index 6312243e32..50ecd43cb3 100644 --- a/composer.json +++ b/composer.json @@ -94,8 +94,15 @@ "spomky-labs/otphp": "11.*", "webonyx/graphql-php": "15.31.*", "league/csv": "9.14.*", - "enshrined/svg-sanitize": "0.22.*" + "enshrined/svg-sanitize": "0.22.*", + "premtsd-code/lock": "dev-main#7ec10dae33b950bc0f473c51e5b165b20754760c" }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/premtsd-code/lock" + } + ], "require-dev": { "ext-fileinfo": "*", "appwrite/sdk-generator": "*", diff --git a/composer.lock b/composer.lock index 02590020e0..99d1a4df9f 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": "c5ae97637fd0ec0a950044d1c33677ea", + "content-hash": "5108bf79532c9d666fb96daa9ec4b3d5", "packages": [ { "name": "adhocore/jwt", @@ -2104,6 +2104,75 @@ ], "time": "2026-04-10T01:33:53+00:00" }, + { + "name": "premtsd-code/lock", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/premtsd-code/lock.git", + "reference": "7ec10dae33b950bc0f473c51e5b165b20754760c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/premtsd-code/lock/zipball/7ec10dae33b950bc0f473c51e5b165b20754760c", + "reference": "7ec10dae33b950bc0f473c51e5b165b20754760c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "laravel/pint": "1.2.*", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^9.5" + }, + "suggest": { + "ext-redis": "Required for Utopia\\Lock\\Adapter\\Redis" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Lock\\": "src/Lock" + } + }, + "autoload-dev": { + "psr-4": { + "Utopia\\Tests\\": "tests/Lock" + } + }, + "scripts": { + "check": [ + "./vendor/bin/phpstan analyse --level 8 src tests" + ], + "lint": [ + "./vendor/bin/pint --test" + ], + "format": [ + "./vendor/bin/pint" + ], + "test": [ + "./vendor/bin/phpunit --configuration phpunit.xml tests" + ] + }, + "license": [ + "MIT" + ], + "description": "A distributed lock library for PHP, part of the Utopia framework", + "keywords": [ + "distributed", + "lock", + "mutex", + "php", + "redis", + "utopia" + ], + "support": { + "source": "https://github.com/premtsd-code/lock/tree/main", + "issues": "https://github.com/premtsd-code/lock/issues" + }, + "time": "2026-04-26T15:50:08+00:00" + }, { "name": "psr/clock", "version": "1.0.0", @@ -8443,7 +8512,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": {}, + "stability-flags": { + "premtsd-code/lock": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 6fc3e88635..c47647cfe1 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -45,6 +45,7 @@ class Exception extends \Exception public const string GENERAL_SERVICE_DISABLED = 'general_service_disabled'; public const string GENERAL_UNAUTHORIZED_SCOPE = 'general_unauthorized_scope'; public const string GENERAL_RATE_LIMIT_EXCEEDED = 'general_rate_limit_exceeded'; + public const string GENERAL_RESOURCE_LOCKED = 'general_resource_locked'; public const string GENERAL_SMTP_DISABLED = 'general_smtp_disabled'; public const string GENERAL_PHONE_DISABLED = 'general_phone_disabled'; public const string GENERAL_ARGUMENT_INVALID = 'general_argument_invalid'; diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index 7aab6f5ad0..e7b048b734 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -60,6 +60,7 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -70,14 +71,26 @@ class Update extends Action Database $dbForPlatform, Document $project, Authorization $authorization, - Event $queueForEvents + Event $queueForEvents, + callable $distributedLockOrFail, ): void { - $services = $project->getAttribute('services', []); - $services[$serviceId] = $enabled; + // The services map is a JSON object on the project document. Two + // concurrent service toggles read the same baseline, each set their + // own key, and the second updateDocument() overwrites the first — + // silent lost-update on a sparse write. Lock the project doc for + // the read-modify-write window; re-read inside the lock so the + // baseline reflects any update that landed between request init + // and lock acquisition. + $project = $distributedLockOrFail("platform:project:{$project->getId()}", function () use ($project, $serviceId, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'services' => $services, - ]))); + $services = $project->getAttribute('services', []); + $services[$serviceId] = $enabled; + + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'services' => $services, + ]))); + }); $queueForEvents->setParam('serviceId', $serviceId); From 784babcf457bc5fee22ea1d59361a5f9d9318d02 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Mon, 27 Apr 2026 09:13:35 +0100 Subject: [PATCH 002/151] fix: address Greptile review on PR #12062 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three P1 issues flagged on the initial commit: 1. Lock key in updateProjectService used "platform:project:{id}" — missing the "lock:" namespace prefix and using singular "project" instead of the conventional plural collection name. The factory's `lockTargetOf` extracts segment [2] as the telemetry target, so the broken key was emitting the project ID itself as the target attribute (cardinality blowup, broken dashboards). Fixed to "lock:platform:projects:{id}" matching the convention used in shared/api.php. 2. The 409 contention exception embedded the raw Redis lock key in its user-facing message, leaking internal collection names and the locking namespace to API clients. Removed the custom message so the catalog default ("The requested resource is currently being modified...") is used. Telemetry already carries the target collection for operator-side observability. 3. _APP_LOCKING_ENABLED variable doc had `introduction: '1.10.0'` on a 1.9.x-targeted PR. Corrected to '1.9.3' (next 1.9.x patch). --- app/config/variables.php | 2 +- app/init/resources.php | 10 ++++++---- .../Modules/Project/Http/Project/Services/Update.php | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 5dd7196266..46a6c7d1e2 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -37,7 +37,7 @@ return [ [ 'name' => '_APP_LOCKING_ENABLED', 'description' => 'Enable distributed locking for platform writes. Locks coordinate concurrent updates across API pods so that read-modify-write operations on shared documents do not lose updates. By default, set to \'enabled\'. Set to \'disabled\' as an emergency kill switch — locks become no-ops (fail-open) and concurrent writes will race.', - 'introduction' => '1.10.0', + 'introduction' => '1.9.3', 'default' => 'enabled', 'required' => false, 'question' => '', diff --git a/app/init/resources.php b/app/init/resources.php index 4c3a684d4e..d3443ee337 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -325,10 +325,12 @@ $container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $tel if (! $acquired) { $attempts->add(1, ['outcome' => 'contended', 'target' => $target]); - throw new AppwriteException( - AppwriteException::GENERAL_RESOURCE_LOCKED, - "Resource '{$key}' is currently being modified by another request. Please retry." - ); + // Don't pass a custom message — the catalog message in + // app/config/errors.php is reused so we don't leak the internal + // lock key (which embeds collection name and document id) into a + // user-facing 409 response. The telemetry attribute already + // carries the target collection for operator-side observability. + throw new AppwriteException(AppwriteException::GENERAL_RESOURCE_LOCKED); } $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index e7b048b734..1126da8897 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -81,7 +81,7 @@ class Update extends Action // the read-modify-write window; re-read inside the lock so the // baseline reflects any update that landed between request init // and lock acquisition. - $project = $distributedLockOrFail("platform:project:{$project->getId()}", function () use ($project, $serviceId, $enabled, $dbForPlatform, $authorization) { + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $serviceId, $enabled, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); $services = $project->getAttribute('services', []); From 77982f4b9037a4dc0fd39bf5655134c7af00c632 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Mon, 27 Apr 2026 17:25:15 +0100 Subject: [PATCH 003/151] test: concurrency proof for distributedLockOrFail pilot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two complementary tests for the lost-update bug the lock fixes, plus the test-Client patches needed to make Swoole-coroutine HTTP work. - tests/e2e/Services/Project/ServicesBase.php :: testConcurrentTogglesAllPersist Fires N parallel PATCHes via Swoole\Coroutine\run + SWOOLE_HOOK_CURL, then refetches the project and asserts (successCount == enabledCount). With the lock disabled (_APP_LOCKING_ENABLED=disabled) sparse updateDocument() calls overwrite each other and the assertion fails — proving the test detects the bug. - dev/test-distributed-lock.sh Same proof via curl + bash background jobs. Runnable outside the PHPUnit suite for manual verification or load-style sweeps. Reads APPWRITE_ENDPOINT / APPWRITE_PROJECT_ID / APPWRITE_API_KEY. - tests/e2e/Client.php (test util): * Skip CURLOPT_PATH_AS_IS (option 234) when SWOOLE_HOOK_CURL is active. Swoole's emulated cURL doesn't support it; setting it fatal-errors as soon as any test enables the cURL hook. * Don't redundantly set CURLOPT_NOBODY=false on non-HEAD requests (false is cURL's default). Under Swoole's hooked cURL this strips the body of PATCH/PUT requests, hitting the framework's 404 fallback instead of the intended route. Both changes preserve native (non-hooked) cURL behavior unchanged. They unblock any future test that wants real parallel HTTP via Swoole\Coroutine\run + the cURL hook. Both follow the same proof-of-bug pattern: run with locking enabled (must pass) AND with it disabled (must fail). Verified locally against the running stack: _APP_LOCKING_ENABLED=enabled -> PASS (15 assertions) _APP_LOCKING_ENABLED=disabled -> FAIL (successCount=5 enabledCount=4) --- dev/test-distributed-lock.sh | 157 ++++++++++++++++++++ tests/e2e/Client.php | 15 +- tests/e2e/Services/Project/ServicesBase.php | 88 +++++++++++ 3 files changed, 257 insertions(+), 3 deletions(-) create mode 100755 dev/test-distributed-lock.sh diff --git a/dev/test-distributed-lock.sh b/dev/test-distributed-lock.sh new file mode 100755 index 0000000000..6a740a4169 --- /dev/null +++ b/dev/test-distributed-lock.sh @@ -0,0 +1,157 @@ +#!/usr/bin/env bash +# +# Manual smoke test for the distributed-lock pilot on `updateProjectService`. +# +# Fires N concurrent PATCH /project/services/:serviceId requests against the +# same project, each toggling a different service to "enabled=true". Then +# refetches the project and counts how many of the targeted services actually +# persisted. +# +# Usage: +# APPWRITE_ENDPOINT=http://localhost \ +# APPWRITE_PROJECT_ID= \ +# APPWRITE_API_KEY= \ +# ./dev/test-distributed-lock.sh +# +# Required scopes on the API key: +# - project.write (to toggle services) +# - projects.read (to refetch project state via GET /v1/projects/:id) +# +# To prove the lock fixes the bug, run twice: +# 1. With `_APP_LOCKING_ENABLED=enabled` (default): expect successes == enabled +# 2. With `_APP_LOCKING_ENABLED=disabled` : expect successes > enabled (lost updates) +# +# Set `_APP_LOCKING_ENABLED` in `.env` and `docker compose up -d --force-recreate` +# between runs. Use `--parallelism N` to tune the concurrency level. + +set -eu + +# --- Configuration --------------------------------------------------------- + +ENDPOINT="${APPWRITE_ENDPOINT:?set APPWRITE_ENDPOINT, e.g. http://localhost}" +PROJECT_ID="${APPWRITE_PROJECT_ID:?set APPWRITE_PROJECT_ID}" +API_KEY="${APPWRITE_API_KEY:?set APPWRITE_API_KEY}" +PARALLELISM="${PARALLELISM:-5}" + +# Services to toggle concurrently — must be in the optional-services list of +# the project. These are the same set used by the e2e ServicesBase trait. +SERVICES=(teams storage functions sites messaging) + +# Trim or extend SERVICES to match PARALLELISM. +SERVICES=("${SERVICES[@]:0:$PARALLELISM}") + +if [ "${#SERVICES[@]}" -lt 2 ]; then + echo "ERROR: PARALLELISM must be >= 2 to detect contention" >&2 + exit 1 +fi + +# --- Helpers --------------------------------------------------------------- + +curl_appwrite() { + local method="$1" + local path="$2" + shift 2 + curl -sS -o /tmp/lock-smoke-body.$$ -w '%{http_code}' \ + -X "$method" \ + -H "Content-Type: application/json" \ + -H "X-Appwrite-Project: $PROJECT_ID" \ + -H "X-Appwrite-Key: $API_KEY" \ + "$ENDPOINT/v1$path" \ + "$@" +} + +toggle_service() { + local service="$1" + local enabled="$2" + local code + code=$(curl_appwrite PATCH "/project/services/$service" \ + -d "{\"enabled\": $enabled}") + echo "$code" +} + +get_project_state() { + curl -sS \ + -H "Content-Type: application/json" \ + -H "X-Appwrite-Project: console" \ + -H "X-Appwrite-Key: $API_KEY" \ + "$ENDPOINT/v1/projects/$PROJECT_ID" +} + +# --- Run ------------------------------------------------------------------- + +echo "==> Distributed-lock smoke test" +echo " endpoint: $ENDPOINT" +echo " project: $PROJECT_ID" +echo " parallelism: $PARALLELISM" +echo " services: ${SERVICES[*]}" +echo + +# 1. Baseline — disable all targeted services sequentially. +echo "==> Baseline: disabling ${SERVICES[*]}" +for svc in "${SERVICES[@]}"; do + code=$(toggle_service "$svc" false) + if [ "$code" != "200" ]; then + echo " WARN: baseline disable of $svc returned $code (expected 200)" + fi +done + +# 2. Fire concurrent toggles to enabled=true. Capture each child's HTTP status. +echo +echo "==> Firing ${#SERVICES[@]} concurrent toggle requests..." +RESULTS_FILE=$(mktemp -t lock-smoke-results.XXXXXX) +for svc in "${SERVICES[@]}"; do + ( + code=$(toggle_service "$svc" true) + printf '%s %s\n' "$svc" "$code" >> "$RESULTS_FILE" + ) & +done +wait + +# 3. Tally responses. +SUCCESS_COUNT=$(awk '$2 == 200' "$RESULTS_FILE" | wc -l | tr -d ' ') +CONFLICT_COUNT=$(awk '$2 == 409' "$RESULTS_FILE" | wc -l | tr -d ' ') +OTHER_COUNT=$(awk '$2 != 200 && $2 != 409' "$RESULTS_FILE" | wc -l | tr -d ' ') + +echo +echo "==> Child responses:" +sort "$RESULTS_FILE" +echo +echo " successes (200): $SUCCESS_COUNT" +echo " conflicts (409): $CONFLICT_COUNT" +echo " other: $OTHER_COUNT" +rm -f "$RESULTS_FILE" + +# 4. Refetch project; count how many targeted services are enabled. +PROJECT_JSON=$(get_project_state) +ENABLED_COUNT=0 +for svc in "${SERVICES[@]}"; do + # Capitalize first letter to form serviceStatusFor key. + Cap="$(echo "$svc" | awk '{print toupper(substr($1,1,1)) substr($1,2)}')" + val=$(echo "$PROJECT_JSON" | sed -nE "s/.*\"serviceStatusFor${Cap}\":[[:space:]]*(true|false).*/\1/p" | head -n1) + if [ "$val" = "true" ]; then + ENABLED_COUNT=$((ENABLED_COUNT + 1)) + fi +done + +echo " enabled in project state: $ENABLED_COUNT" +echo + +# 5. Verdict. +if [ "$SUCCESS_COUNT" -eq "$ENABLED_COUNT" ]; then + echo "PASS: every successful toggle persisted (no lost updates)." + EXIT=0 +else + echo "FAIL: lost updates detected. successes=$SUCCESS_COUNT enabled=$ENABLED_COUNT" + echo " Locking is either disabled or not effective on this endpoint." + EXIT=1 +fi + +# 6. Cleanup — re-enable all targeted services. +echo +echo "==> Cleanup: re-enabling ${SERVICES[*]}" +for svc in "${SERVICES[@]}"; do + toggle_service "$svc" true >/dev/null || true +done + +rm -f /tmp/lock-smoke-body.$$ +exit "$EXIT" diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 4358058fe3..84c937d2d1 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -211,7 +211,13 @@ class Client } } - curl_setopt($ch, CURLOPT_PATH_AS_IS, 1); + // CURLOPT_PATH_AS_IS isn't supported by Swoole's emulated cURL when the + // SWOOLE_HOOK_CURL coroutine hook is active. Skip it in that case so + // tests that need real parallel HTTP (Swoole\Coroutine\run + cURL hook) + // don't fatal-error here. Native (non-hooked) cURL keeps the option. + if (! \extension_loaded('swoole') || ! (\Swoole\Runtime::getHookFlags() & SWOOLE_HOOK_CURL)) { + curl_setopt($ch, CURLOPT_PATH_AS_IS, 1); + } curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $followRedirects); @@ -237,9 +243,12 @@ class Client if ($method === self::METHOD_HEAD) { curl_setopt($ch, CURLOPT_NOBODY, true); // This is crucial for HEAD requests curl_setopt($ch, CURLOPT_HEADER, false); - } else { - curl_setopt($ch, CURLOPT_NOBODY, false); } + // Note: explicit CURLOPT_NOBODY=false on non-HEAD requests is redundant + // (false is cURL's default) and actively breaks Swoole's emulated cURL + // on PATCH-with-body — Swoole strips the body and the request reaches + // the server as a method-without-body, hitting the framework's 404 + // fallback. Just skip the redundant set. if ($method != self::METHOD_GET && $method != self::METHOD_HEAD) { curl_setopt($ch, CURLOPT_POSTFIELDS, $query); diff --git a/tests/e2e/Services/Project/ServicesBase.php b/tests/e2e/Services/Project/ServicesBase.php index b5f94f8181..c8c7bd173f 100644 --- a/tests/e2e/Services/Project/ServicesBase.php +++ b/tests/e2e/Services/Project/ServicesBase.php @@ -266,6 +266,94 @@ trait ServicesBase $this->assertSame(true, $response['body']['serviceStatusForTeams']); } + /** + * Concurrency test for the distributed-lock pilot on `updateProjectService`. + * + * Without locking, two concurrent toggles to different services on the + * same project both read the same baseline `services` map, each set their + * own key, and the second sparse `updateDocument()` overwrites the first + * — silent lost-update. + * + * The test fires N parallel PATCH calls via Swoole coroutines (with the + * SWOOLE_HOOK_CURL runtime hook enabled so the test Client's cURL calls + * yield to the scheduler). After all coroutines complete the project is + * refetched and the count of enabled services is compared against the + * count of HTTP 200 responses. + * + * To verify the test catches the bug: + * - `_APP_LOCKING_ENABLED=enabled` → must pass + * - `_APP_LOCKING_ENABLED=disabled` → must FAIL (lost updates) + */ + public function testConcurrentTogglesAllPersist(): void + { + $services = ['teams', 'storage', 'functions', 'sites', 'messaging']; + + // Baseline: disable everything so the toggle direction is unambiguous. + // Done outside the coroutine context so it stays sequential and the + // resulting project state is a clean known-zero before the race. + foreach ($services as $service) { + $this->updateServiceStatus($service, false); + } + + // Enable Swoole's cURL hook so the test Client's HTTP calls yield + // to the scheduler and the foreach below actually runs in parallel. + // Without this, coroutines serialize on cURL and the negative-case + // run (locking disabled) would falsely pass. + \Swoole\Runtime::enableCoroutine(\SWOOLE_HOOK_CURL); + + $results = []; + try { + \Swoole\Coroutine\run(function () use ($services, &$results): void { + foreach ($services as $service) { + \Swoole\Coroutine::create(function () use ($service, &$results): void { + $response = $this->updateServiceStatus($service, true); + $results[$service] = $response['headers']['status-code']; + }); + } + }); + } finally { + // SWOOLE_HOOK_NONE isn't defined in some Swoole builds; pass 0 + // (the integer value of "no hooks") to disable any hooks this + // test enabled so subsequent tests run with native cURL. + \Swoole\Runtime::enableCoroutine(0); + } + + $successCount = count(array_filter($results, fn ($code) => $code === 200)); + + // Refetch the project and count which of the targeted services ended up + // enabled. The endpoint returns serviceStatusFor{Service} keys. + $project = $this->client->call(Client::METHOD_GET, '/projects/' . $this->getProject()['$id'], [ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + ]); + + $enabledCount = 0; + foreach ($services as $service) { + $key = 'serviceStatusFor' . ucfirst($service); + if (($project['body'][$key] ?? false) === true) { + $enabledCount++; + } + } + + $this->assertGreaterThan(0, $successCount, 'At least one concurrent toggle should succeed'); + $this->assertSame( + $successCount, + $enabledCount, + sprintf( + 'Each successful concurrent toggle must persist. successCount=%d enabledCount=%d (lost-update detected — distributed lock not effective)', + $successCount, + $enabledCount, + ), + ); + + // Cleanup: leave all targeted services enabled so subsequent tests + // see a known-good baseline. + foreach ($services as $service) { + $this->updateServiceStatus($service, true); + } + } + // Helpers protected function updateServiceStatus(string $serviceId, bool $enabled, bool $authenticated = true): mixed From 92b5f0dcd60057ec591412ebef4c00539dfcf56b Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Mon, 27 Apr 2026 14:11:17 +0100 Subject: [PATCH 004/151] feat: report lock backend/release errors to logger (Sentry/Raygun/etc.) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lock backend errors (Redis/Dragonfly unreachable) and release errors (TTL expired or backend dropped while held) were previously visible only in the lock.attempts counter and Console::warning lines. They now also push a structured Log entry through the configured logger adapter, so operators using Sentry/Raygun/AppSignal/LogOwl get first-class events for these specific failure modes. Pattern matches Embeddings/Text/Create.php exactly: - Action injects 'log' (per-request Log object) and 'logger' (?Logger, nullable when _APP_LOGGING_CONFIG unset). - Helper mutates the per-request $log instead of constructing a fresh one — preserves the per-request context Embeddings expects. - Same field set: namespace='http', server, version, type, setMessage, setAction, setEnvironment, addTag('code', ...), addExtra('file' / 'line' / 'trace'). - Defensive try/catch around addLog() so logging failures don't break fail-open. Lock-specific tags added for slicing in Sentry: - lock.target — collection name (projects, keys, users, ...). Bounded set, safe for high-cardinality stores. - lock.key_pattern — full key with the trailing document ID stripped (lock:platform:projects:* not lock:platform:projects:abc). Prevents unbounded log cardinality from per-document IDs. Rate limiting via per-pod static buckets, 60s window per (action, target) combo. During a 5-minute Dragonfly outage, a fleet of N pods produces at most N events/min, well within Sentry's dedup tolerance. Static state is per-Swoole-worker; coroutines may race on the bucket boundary but the worst case is one duplicate report. Type level set to Log::TYPE_WARNING (not ERROR): fail-open means the request still succeeds, so this is degraded operation, not a failed request. Deliberately NOT reported to Sentry: - 409 GENERAL_RESOURCE_LOCKED (normal user-facing concurrency) - skip-on-contention events (idempotent fan-out by design) - acquire retry conflicts (internal loop) - destructor cleanups (have an expected baseline rate; the lock.attempts counter aggregates them better than Sentry would) Factory signature change: distributedLock and distributedLockOrFail now accept ?Log and ?Logger as optional named args at call time (rather than capturing Logger at factory-build time). The factory closure runs once at boot but the per-request Log resource is fresh per request — capturing at boot would have given stale state. Existing call sites threaded log: $log, logger: $logger. Sites that don't (workers, CLI tasks) get null and just log to Console as before. --- app/controllers/shared/api.php | 12 ++- app/init/resources.php | 84 ++++++++++++++++--- .../Project/Http/Project/Services/Update.php | 8 +- 3 files changed, 89 insertions(+), 15 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index b07eec1a99..142a20c4f3 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -39,6 +39,8 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\Roles; use Utopia\Http\Http; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Span\Span; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; @@ -101,7 +103,9 @@ Http::init() ->inject('apiKey') ->inject('authorization') ->inject('distributedLock') - ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, callable $distributedLock) { + ->inject('log') + ->inject('logger') + ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, callable $distributedLock, Log $log, ?Logger $logger) { $route = $utopia->getRoute(); if ($route === null) { throw new AppwriteException(AppwriteException::GENERAL_ROUTE_NOT_FOUND); @@ -263,7 +267,7 @@ Http::init() } elseif (! empty($apiKey->getTeamId())) { $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('teams', $team->getId())); } - }); + }, log: $log, logger: $logger); } $userClone = clone $user; @@ -398,7 +402,7 @@ Http::init() $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'accessedAt' => DateTime::now() ]))); - }); + }, log: $log, logger: $logger); } } @@ -419,7 +423,7 @@ Http::init() $authorization->skip(fn () => $dbForPlatform->updateDocument('users', $user->getId(), new Document([ 'accessedAt' => $user->getAttribute('accessedAt') ]))); - }); + }, log: $log, logger: $logger); } } } diff --git a/app/init/resources.php b/app/init/resources.php index d3443ee337..d520c621b5 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -26,6 +26,8 @@ use Utopia\DSN\DSN; use Utopia\Lock\Adapter\Redis as LockRedisAdapter; use Utopia\Lock\Exception\LockAcquireException; use Utopia\Lock\Lock; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Pools\Group; use Utopia\Queue\Broker\Pool as BrokerPool; use Utopia\Queue\Publisher; @@ -225,6 +227,68 @@ $lockTargetOf = function (string $key): string { return $parts[2] ?? 'unknown'; }; +/** + * Push lock-side errors to the configured logger (Sentry/Raygun/AppSignal/etc.) + * by mutating the caller's per-request `Log` object — same pattern as + * Embeddings/Text/Create.php and the http.php request-end error handler. + * + * Rate limited per pod via a static bucket so a sustained backend outage + * doesn't flood the logger. At most one push per 60s per (action, target) + * combo. Across a fleet of N pods this caps at N events/min, well within + * Sentry's own dedup tolerance. + * + * Only "real" errors are reported here: + * - backend_error: Redis/Dragonfly unreachable + * - release_error: lock release failed (TTL expired or backend dropped) + * + * Skipped on purpose: contention 409s (normal user-facing concurrency), + * skip-on-contention events (idempotent fan-out by design), acquire retry + * conflicts (internal loop), destructor cleanups (have an expected + * baseline rate; aggregate via the `lock.attempts` counter instead). + */ +$lockErrorReporter = function (?Log $log, ?Logger $logger, string $action, string $key, string $target, Throwable $e): void { + static $lastReportAt = []; + + Console::warning("Lock {$action} for {$key}: {$e->getMessage()}"); + + if ($logger === null || $log === null) { + return; + } + + $bucket = $action . ':' . $target; + $now = time(); + if (($lastReportAt[$bucket] ?? 0) + 60 > $now) { + return; + } + $lastReportAt[$bucket] = $now; + + $log->setNamespace('http'); + $log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); + $log->setVersion(APP_VERSION_STABLE); + $log->setType(Log::TYPE_WARNING); + $log->setMessage('Distributed lock ' . $action . ': ' . $e->getMessage()); + $log->setAction("lock.{$action}"); + $log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' + ? Log::ENVIRONMENT_PRODUCTION + : Log::ENVIRONMENT_STAGING); + + $log->addTag('lock.target', $target); + // Strip the trailing document ID from the key so log aggregators don't + // see unbounded cardinality; the {target} attribute already covers slicing. + $log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); + $log->addTag('code', $e->getCode()); + + $log->addExtra('file', $e->getFile()); + $log->addExtra('line', $e->getLine()); + $log->addExtra('trace', $e->getTraceAsString()); + + try { + $logger->addLog($log); + } catch (Throwable) { + // best-effort; don't let logging failures break fail-open + } +}; + /** * Distributed-lock factory: skip-on-contention variant. * @@ -242,17 +306,17 @@ $lockTargetOf = function (string $key): string { * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, skipped, * backend_error, release_error}. */ -$container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf) { +$container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf, $lockErrorReporter) { $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); if (! $enabled) { - return function (string $key, \Closure $fn, float $ttl = 5.0): void { + return function (string $key, \Closure $fn, float $ttl = 5.0, ?Log $log = null, ?Logger $logger = null): void { $fn(); }; } - return function (string $key, \Closure $fn, float $ttl = 5.0) use ($redis, $attempts, $lockTargetOf): void { + return function (string $key, \Closure $fn, float $ttl = 5.0, ?Log $log = null, ?Logger $logger = null) use ($redis, $attempts, $lockTargetOf, $lockErrorReporter): void { $target = $lockTargetOf($key); $lock = new Lock(new LockRedisAdapter($redis), $key, $ttl); @@ -260,7 +324,7 @@ $container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry $acquired = $lock->acquire(); } catch (LockAcquireException $e) { $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); - Console::warning("Lock backend unavailable for {$key}, proceeding unlocked: {$e->getMessage()}"); + $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); $fn(); return; } @@ -278,7 +342,7 @@ $container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry $lock->release(); } catch (\Throwable $e) { $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); - Console::warning("Lock release failed for {$key}: {$e->getMessage()}"); + $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); } } }; @@ -301,17 +365,17 @@ $container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, contended, * backend_error, release_error}. */ -$container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf) { +$container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf, $lockErrorReporter) { $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); if (! $enabled) { - return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0): mixed { + return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0, ?Log $log = null, ?Logger $logger = null): mixed { return $fn(); }; } - return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0) use ($redis, $attempts, $lockTargetOf): mixed { + return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0, ?Log $log = null, ?Logger $logger = null) use ($redis, $attempts, $lockTargetOf, $lockErrorReporter): mixed { $target = $lockTargetOf($key); $lock = new Lock(new LockRedisAdapter($redis), $key, $ttl); @@ -319,7 +383,7 @@ $container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $tel $acquired = $lock->acquire(blocking: true, waitTimeout: $waitTimeout, retryDelay: 0.1); } catch (LockAcquireException $e) { $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); - Console::warning("Lock backend unavailable for {$key}, proceeding unlocked: {$e->getMessage()}"); + $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); return $fn(); } @@ -341,7 +405,7 @@ $container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $tel $lock->release(); } catch (\Throwable $e) { $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); - Console::warning("Lock release failed for {$key}: {$e->getMessage()}"); + $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); } } }; diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index 1126da8897..933d524e23 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -12,6 +12,8 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\WhiteList; @@ -61,6 +63,8 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -73,6 +77,8 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { // The services map is a JSON object on the project document. Two // concurrent service toggles read the same baseline, each set their @@ -90,7 +96,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'services' => $services, ]))); - }); + }, log: $log, logger: $logger); $queueForEvents->setParam('serviceId', $serviceId); From 752df210077c3efc1a8951358ec3e16e8f560db2 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Tue, 28 Apr 2026 09:38:08 +0100 Subject: [PATCH 005/151] refactor: switch distributed-lock backend to utopia-php/lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `utopia-php/lock` v0.2.0 was published this week and provides the same Redis SET-NX-EX + Lua-compare-and-delete primitive we built locally as `premtsd-code/lock`. Drop the dev-preview package in favor of the official Utopia PHP library. - composer: replace `premtsd-code/lock` with `utopia-php/lock` 0.2.* (still via VCS — not on Packagist yet) - resources.php: rewire both factory variants - `Lock + Adapter\Redis` → `Distributed` - `acquire()` → `tryAcquire()` for skip variant - `acquire(blocking: true, waitTimeout)` → `acquire($waitTimeout)` for OrFail variant - `LockAcquireException` → `\RedisException` - `(int) $ttl` cast — utopia-php/lock takes seconds as int - docker-compose: thread `_APP_LOCKING_ENABLED` into the appwrite service environment so the kill switch documented in `app/config/variables.php` is actually usable from `.env` Verified end-to-end on local stack: - positive case (locking enabled): 5/5 testConcurrentTogglesAllPersist pass, lock keys observed in `redis-cli MONITOR` with concurrent SET NX contention - negative case (locking disabled): 1/3 detect lost updates as before --- app/init/resources.php | 16 ++--- composer.json | 4 +- composer.lock | 147 +++++++++++++++++++++-------------------- docker-compose.yml | 1 + 4 files changed, 84 insertions(+), 84 deletions(-) diff --git a/app/init/resources.php b/app/init/resources.php index d520c621b5..4a4af38b5f 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -23,9 +23,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\DI\Container; use Utopia\DSN\DSN; -use Utopia\Lock\Adapter\Redis as LockRedisAdapter; -use Utopia\Lock\Exception\LockAcquireException; -use Utopia\Lock\Lock; +use Utopia\Lock\Distributed as DistributedLock; use Utopia\Logger\Log; use Utopia\Logger\Logger; use Utopia\Pools\Group; @@ -318,11 +316,11 @@ $container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry return function (string $key, \Closure $fn, float $ttl = 5.0, ?Log $log = null, ?Logger $logger = null) use ($redis, $attempts, $lockTargetOf, $lockErrorReporter): void { $target = $lockTargetOf($key); - $lock = new Lock(new LockRedisAdapter($redis), $key, $ttl); + $lock = new DistributedLock($redis, $key, (int) $ttl); try { - $acquired = $lock->acquire(); - } catch (LockAcquireException $e) { + $acquired = $lock->tryAcquire(); + } catch (\RedisException $e) { $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); $fn(); @@ -377,11 +375,11 @@ $container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $tel return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0, ?Log $log = null, ?Logger $logger = null) use ($redis, $attempts, $lockTargetOf, $lockErrorReporter): mixed { $target = $lockTargetOf($key); - $lock = new Lock(new LockRedisAdapter($redis), $key, $ttl); + $lock = new DistributedLock($redis, $key, (int) $ttl); try { - $acquired = $lock->acquire(blocking: true, waitTimeout: $waitTimeout, retryDelay: 0.1); - } catch (LockAcquireException $e) { + $acquired = $lock->acquire($waitTimeout); + } catch (\RedisException $e) { $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); return $fn(); diff --git a/composer.json b/composer.json index 50ecd43cb3..42f4303d18 100644 --- a/composer.json +++ b/composer.json @@ -95,12 +95,12 @@ "webonyx/graphql-php": "15.31.*", "league/csv": "9.14.*", "enshrined/svg-sanitize": "0.22.*", - "premtsd-code/lock": "dev-main#7ec10dae33b950bc0f473c51e5b165b20754760c" + "utopia-php/lock": "0.2.*" }, "repositories": [ { "type": "vcs", - "url": "https://github.com/premtsd-code/lock" + "url": "https://github.com/utopia-php/lock" } ], "require-dev": { diff --git a/composer.lock b/composer.lock index 99d1a4df9f..5a4e0135f8 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": "5108bf79532c9d666fb96daa9ec4b3d5", + "content-hash": "bbf2208dac35ff90f57b7e49b8546d45", "packages": [ { "name": "adhocore/jwt", @@ -2104,75 +2104,6 @@ ], "time": "2026-04-10T01:33:53+00:00" }, - { - "name": "premtsd-code/lock", - "version": "dev-main", - "source": { - "type": "git", - "url": "https://github.com/premtsd-code/lock.git", - "reference": "7ec10dae33b950bc0f473c51e5b165b20754760c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/premtsd-code/lock/zipball/7ec10dae33b950bc0f473c51e5b165b20754760c", - "reference": "7ec10dae33b950bc0f473c51e5b165b20754760c", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.12", - "phpunit/phpunit": "^9.5" - }, - "suggest": { - "ext-redis": "Required for Utopia\\Lock\\Adapter\\Redis" - }, - "default-branch": true, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Lock\\": "src/Lock" - } - }, - "autoload-dev": { - "psr-4": { - "Utopia\\Tests\\": "tests/Lock" - } - }, - "scripts": { - "check": [ - "./vendor/bin/phpstan analyse --level 8 src tests" - ], - "lint": [ - "./vendor/bin/pint --test" - ], - "format": [ - "./vendor/bin/pint" - ], - "test": [ - "./vendor/bin/phpunit --configuration phpunit.xml tests" - ] - }, - "license": [ - "MIT" - ], - "description": "A distributed lock library for PHP, part of the Utopia framework", - "keywords": [ - "distributed", - "lock", - "mutex", - "php", - "redis", - "utopia" - ], - "support": { - "source": "https://github.com/premtsd-code/lock/tree/main", - "issues": "https://github.com/premtsd-code/lock/issues" - }, - "time": "2026-04-26T15:50:08+00:00" - }, { "name": "psr/clock", "version": "1.0.0", @@ -4490,6 +4421,78 @@ }, "time": "2025-08-12T12:58:26+00:00" }, + { + "name": "utopia-php/lock", + "version": "0.2.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/lock.git", + "reference": "49317c9493d8f747e4299aa24c22862aa5f6e106" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/lock/zipball/49317c9493d8f747e4299aa24c22862aa5f6e106", + "reference": "49317c9493d8f747e4299aa24c22862aa5f6e106", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "laravel/pint": "1.*", + "phpstan/phpstan": "2.*", + "phpunit/phpunit": "11.*", + "swoole/ide-helper": "*" + }, + "suggest": { + "ext-pcntl": "Required to run the File lock tests", + "ext-redis": "Required for the Distributed lock", + "ext-swoole": "Required for the Mutex and Semaphore locks (>=6.0)" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Lock\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Utopia\\Lock\\Tests\\": "tests/" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpunit" + ], + "lint": [ + "vendor/bin/pint --test" + ], + "format": [ + "vendor/bin/pint" + ], + "format:check": [ + "vendor/bin/pint --test" + ], + "analyze": [ + "vendor/bin/phpstan analyse --memory-limit=512M" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Appwrite Team", + "email": "team@appwrite.io" + } + ], + "description": "Mutex, semaphore, file and distributed locks for PHP — one interface, four backends.", + "support": { + "source": "https://github.com/utopia-php/lock/tree/0.2.0", + "issues": "https://github.com/utopia-php/lock/issues" + }, + "time": "2026-04-24T10:47:56+00:00" + }, { "name": "utopia-php/logger", "version": "0.6.2", @@ -8512,9 +8515,7 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "premtsd-code/lock": 20 - }, + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/docker-compose.yml b/docker-compose.yml index 7d53d2965d..2674e4085d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -212,6 +212,7 @@ services: - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_HOST - _APP_LOGGING_CONFIG + - _APP_LOCKING_ENABLED - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_CACHE From 29a0d6c2bf2685b2ac107ca15081c1459a5d6823 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Tue, 28 Apr 2026 14:13:31 +0100 Subject: [PATCH 006/151] feat: distributed locks on all platform-projects-doc writes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pilot on `Project/Services/Update.php` (commit fb0d43daf3) fixed the silent lost-update on the `services` JSON map. The same read-modify-write pattern exists on 17 other endpoints — all writing to the SAME `projects` document, mostly via sparse `updateDocument`. Concurrent writes silently overwrite each other, both within an endpoint (two toggles to different auth methods) and across endpoints (parallel SMTP update + service toggle). The worst offender is `Projects/Update.php` (`PATCH /v1/projects/:projectId`): it calls `setAttribute` 11 times then writes the WHOLE document back, so a concurrent write to *any* attribute on the project doc — services, auths, smtp, templates, mockNumbers — gets clobbered. Wrap every read-modify-write window with `distributedLockOrFail` keyed on `lock:platform:projects:{$projectId}`. The single shared key serializes both same-endpoint and cross-endpoint races on the same project. Endpoints now under the lock: Projects module (console-managed, plural): - Projects/Update (full doc setAttribute chain) - Projects/Team/Update (sparse + computed permissions; cascade to installations/repositories/vcsComments runs after release — separate collections) Project module (current-project, singular): - AuthMethods/Update (auths[authKey]) - Protocols/Update (apis[protocolId]) - SMTP/Update (smtp map; PHPMailer probe inside lock — 10s default TTL covers Timeout=5) - Templates/Email/Update (templates['email.X-locale']) - MockPhone/{Create,Delete,Update} (auths['mockNumbers'][]) - Policies/MembershipPrivacy (auths['memberships*']) - Policies/PasswordDictionary (auths['passwordDictionary']) - Policies/PasswordHistory (auths['passwordHistory']) - Policies/PasswordPersonalData (auths['personalDataCheck']) - Policies/SessionAlert (auths['sessionAlerts']) - Policies/SessionDuration (auths['duration']) - Policies/SessionInvalidation (auths['invalidateSessions']) - Policies/SessionLimit (auths['maxSessions']) - Policies/UserLimit (auths['limit']) Each endpoint: 1. Injects `distributedLockOrFail`, `log`, `logger` 2. Re-reads the project document inside the lock so the baseline reflects any update that landed between request init and lock acquisition 3. Throws `GENERAL_RESOURCE_LOCKED` (HTTP 409) on contention timeout SMTP/Update and Templates/Email/Update additionally refactor variable- variables (`${$key}`) to an explicit input array — PHPStan can't trace dynamic references through closure `use` clauses. --- .../Http/Project/AuthMethods/Update.php | 24 ++- .../Project/Http/Project/MockPhone/Create.php | 49 +++--- .../Project/Http/Project/MockPhone/Delete.php | 47 +++--- .../Project/Http/Project/MockPhone/Update.php | 50 +++--- .../Policies/MembershipPrivacy/Update.php | 50 +++--- .../Policies/PasswordDictionary/Update.php | 22 ++- .../Policies/PasswordHistory/Update.php | 27 +-- .../Policies/PasswordPersonalData/Update.php | 22 ++- .../Project/Policies/SessionAlert/Update.php | 22 ++- .../Policies/SessionDuration/Update.php | 22 ++- .../Policies/SessionInvalidation/Update.php | 22 ++- .../Project/Policies/SessionLimit/Update.php | 27 +-- .../Project/Policies/UserLimit/Update.php | 27 +-- .../Project/Http/Project/Protocols/Update.php | 22 ++- .../Project/Http/Project/SMTP/Update.php | 155 ++++++++++-------- .../Http/Project/Templates/Email/Update.php | 81 +++++---- .../Projects/Http/Projects/Team/Update.php | 42 +++-- .../Modules/Projects/Http/Projects/Update.php | 45 +++-- 18 files changed, 475 insertions(+), 281 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php index 0d1cd83203..9f06c51880 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php @@ -12,6 +12,8 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\WhiteList; @@ -60,6 +62,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -70,17 +75,24 @@ class Update extends Action Database $dbForPlatform, Document $project, Authorization $authorization, - Event $queueForEvents + Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { $auth = Config::getParam('auth')[$methodId] ?? []; $authKey = $auth['key'] ?? ''; - $auths = $project->getAttribute('auths', []); - $auths[$authKey] = $enabled; + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $authKey, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); + $auths = $project->getAttribute('auths', []); + $auths[$authKey] = $enabled; + + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents->setParam('methodId', $methodId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php index f4002c60ef..08163d644a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php @@ -13,6 +13,8 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; @@ -59,6 +61,9 @@ class Create extends Action ->inject('project') ->inject('dbForPlatform') ->inject('authorization') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -70,21 +75,10 @@ class Create extends Action Document $project, Database $dbForPlatform, Authorization $authorization, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ) { - $auths = $project->getAttribute('auths', []); - - $mockNumbers = $auths['mockNumbers'] ?? []; - - if (\count($mockNumbers) >= APP_LIMIT_COUNT) { - throw new Exception(Exception::MOCK_NUMBER_LIMIT_EXCEEDED); - } - - foreach ($mockNumbers as $mockNumber) { - if ($mockNumber['phone'] === $number) { - throw new Exception(Exception::MOCK_NUMBER_ALREADY_EXISTS); - } - } - // Set to now date $mockNumber = [ 'phone' => $number, @@ -93,14 +87,29 @@ class Create extends Action '$updatedAt' => DateTime::now(), ]; - $mockNumbers[] = $mockNumber; - $auths['mockNumbers'] = $mockNumbers; + $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $mockNumber, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $updates = new Document([ - 'auths' => $auths, - ]); + $auths = $project->getAttribute('auths', []); + $mockNumbers = $auths['mockNumbers'] ?? []; - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + if (\count($mockNumbers) >= APP_LIMIT_COUNT) { + throw new Exception(Exception::MOCK_NUMBER_LIMIT_EXCEEDED); + } + + foreach ($mockNumbers as $existing) { + if ($existing['phone'] === $number) { + throw new Exception(Exception::MOCK_NUMBER_ALREADY_EXISTS); + } + } + + $mockNumbers[] = $mockNumber; + $auths['mockNumbers'] = $mockNumbers; + + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php index 0fb23e1764..560ff4b6e4 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php @@ -13,6 +13,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -58,6 +60,9 @@ class Delete extends Action ->inject('project') ->inject('dbForPlatform') ->inject('authorization') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -68,33 +73,35 @@ class Delete extends Action Document $project, Database $dbForPlatform, Authorization $authorization, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ) { - $auths = $project->getAttribute('auths', []); + $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $mockNumbers = $auths['mockNumbers'] ?? []; + $auths = $project->getAttribute('auths', []); + $mockNumbers = $auths['mockNumbers'] ?? []; - $mockNumberIndex = null; - foreach ($mockNumbers as $index => $mock) { - if ($mock['phone'] === $number) { - $mockNumberIndex = $index; - break; + $mockNumberIndex = null; + foreach ($mockNumbers as $index => $mock) { + if ($mock['phone'] === $number) { + $mockNumberIndex = $index; + break; + } } - } - if (\is_null($mockNumberIndex)) { - throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); - } + if (\is_null($mockNumberIndex)) { + throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); + } - unset($mockNumbers[$mockNumberIndex]); - $mockNumbers = array_values($mockNumbers); + unset($mockNumbers[$mockNumberIndex]); + $auths['mockNumbers'] = array_values($mockNumbers); - $auths['mockNumbers'] = $mockNumbers; - - $updates = new Document([ - 'auths' => $auths, - ]); - - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php index 48b90a1b97..55512ff215 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php @@ -13,6 +13,8 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; @@ -59,6 +61,9 @@ class Update extends Action ->inject('project') ->inject('dbForPlatform') ->inject('authorization') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -70,38 +75,43 @@ class Update extends Action Document $project, Database $dbForPlatform, Authorization $authorization, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ) { - $auths = $project->getAttribute('auths', []); + $mockNumber = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $otp, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $mockNumbers = $auths['mockNumbers'] ?? []; + $auths = $project->getAttribute('auths', []); + $mockNumbers = $auths['mockNumbers'] ?? []; - $mockNumberIndex = null; - foreach ($mockNumbers as $index => $mock) { - if ($mock['phone'] === $number) { - $mockNumberIndex = $index; - break; + $mockNumberIndex = null; + foreach ($mockNumbers as $index => $mock) { + if ($mock['phone'] === $number) { + $mockNumberIndex = $index; + break; + } } - } - if (\is_null($mockNumberIndex)) { - throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); - } + if (\is_null($mockNumberIndex)) { + throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); + } - $mockNumbers[$mockNumberIndex]['otp'] = $otp; - $mockNumbers[$mockNumberIndex]['$updatedAt'] = DateTime::now(); + $mockNumbers[$mockNumberIndex]['otp'] = $otp; + $mockNumbers[$mockNumberIndex]['$updatedAt'] = DateTime::now(); + $auths['mockNumbers'] = $mockNumbers; - $auths['mockNumbers'] = $mockNumbers; + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); - $updates = new Document([ - 'auths' => $auths, - ]); - - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $mockNumbers[$mockNumberIndex]; + }, log: $log, logger: $logger); $queueForEvents->setParam('number', $number); $response ->setStatusCode(Response::STATUS_CODE_OK) - ->dynamic(new Document($mockNumbers[$mockNumberIndex]), Response::MODEL_MOCK_NUMBER); + ->dynamic(new Document($mockNumber), Response::MODEL_MOCK_NUMBER); } } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index c947ff225a..f510801524 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -60,6 +62,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -74,30 +79,35 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $userId, $userEmail, $userPhone, $userName, $userMFA, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - if ($userId !== null) { - $auths['membershipsUserId'] = $userId; - } - if ($userEmail !== null) { - $auths['membershipsUserEmail'] = $userEmail; - } - if ($userPhone !== null) { - $auths['membershipsUserPhone'] = $userPhone; - } - if ($userName !== null) { - $auths['membershipsUserName'] = $userName; - } - if ($userMFA !== null) { - $auths['membershipsMfa'] = $userMFA; - } + $auths = $project->getAttribute('auths', []); - $updates = new Document([ - 'auths' => $auths, - ]); + if ($userId !== null) { + $auths['membershipsUserId'] = $userId; + } + if ($userEmail !== null) { + $auths['membershipsUserEmail'] = $userEmail; + } + if ($userPhone !== null) { + $auths['membershipsUserPhone'] = $userPhone; + } + if ($userName !== null) { + $auths['membershipsUserName'] = $userName; + } + if ($userMFA !== null) { + $auths['membershipsMfa'] = $userMFA; + } - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php index e2c678abb6..7dc7729b47 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -56,6 +58,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -66,15 +71,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); - $auths['passwordDictionary'] = $enabled; + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $updates = new Document([ - 'auths' => $auths, - ]); + $auths = $project->getAttribute('auths', []); + $auths['passwordDictionary'] = $enabled; - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php index a8ae81caff..19ffc9a0b2 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Nullable; use Utopia\Validator\Range; @@ -59,6 +61,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -69,20 +74,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - if (\is_null($total)) { - $auths['passwordHistory'] = 0; - } else { - $auths['passwordHistory'] = $total; - } + $auths = $project->getAttribute('auths', []); + $auths['passwordHistory'] = \is_null($total) ? 0 : $total; - $updates = new Document([ - 'auths' => $auths, - ]); - - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php index 9db7cf0549..95c6b9452a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -57,6 +59,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -67,15 +72,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); - $auths['personalDataCheck'] = $enabled; + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $updates = new Document([ - 'auths' => $auths, - ]); + $auths = $project->getAttribute('auths', []); + $auths['personalDataCheck'] = $enabled; - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php index 22b7a44b04..6948eed85e 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -56,6 +58,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -66,15 +71,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); - $auths['sessionAlerts'] = $enabled; + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $updates = new Document([ - 'auths' => $auths, - ]); + $auths = $project->getAttribute('auths', []); + $auths['sessionAlerts'] = $enabled; - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php index ba72c93a6f..3de157556a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Range; @@ -56,6 +58,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -66,15 +71,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); - $auths['duration'] = $duration; + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $duration, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $updates = new Document([ - 'auths' => $auths, - ]); + $auths = $project->getAttribute('auths', []); + $auths['duration'] = $duration; - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php index 8f8a959959..f6dcb95123 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -56,6 +58,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -66,15 +71,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); - $auths['invalidateSessions'] = $enabled; + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $updates = new Document([ - 'auths' => $auths, - ]); + $auths = $project->getAttribute('auths', []); + $auths['invalidateSessions'] = $enabled; - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php index 382ed6f0d9..826478b713 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Nullable; use Utopia\Validator\Range; @@ -57,6 +59,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -67,20 +72,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - if (\is_null($total)) { - $auths['maxSessions'] = 0; - } else { - $auths['maxSessions'] = $total; - } + $auths = $project->getAttribute('auths', []); + $auths['maxSessions'] = \is_null($total) ? 0 : $total; - $updates = new Document([ - 'auths' => $auths, - ]); - - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php index 9129b81250..a882a72603 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php @@ -11,6 +11,8 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Nullable; use Utopia\Validator\Range; @@ -57,6 +59,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -67,20 +72,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $auths = $project->getAttribute('auths', []); + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - if (\is_null($total)) { - $auths['limit'] = 0; - } else { - $auths['limit'] = $total; - } + $auths = $project->getAttribute('auths', []); + $auths['limit'] = \is_null($total) ? 0 : $total; - $updates = new Document([ - 'auths' => $auths, - ]); - - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + }, log: $log, logger: $logger); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php index ad5691c1e0..5fb40571bf 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php @@ -12,6 +12,8 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\WhiteList; @@ -60,6 +62,9 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -71,13 +76,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - $protocols = $project->getAttribute('apis', []); - $protocols[$protocolId] = $enabled; + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $protocolId, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'apis' => $protocols, - ]))); + $protocols = $project->getAttribute('apis', []); + $protocols[$protocolId] = $enabled; + + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'apis' => $protocols, + ]))); + }, log: $log, logger: $logger); $queueForEvents->setParam('protocolId', $protocolId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index 97e723f52c..12238f7150 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -14,6 +14,8 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Emails\Validator\Email; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\Hostname; @@ -72,6 +74,9 @@ class Update extends Action ->inject('dbForPlatform') ->inject('project') ->inject('authorization') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -90,83 +95,103 @@ class Update extends Action Response $response, Database $dbForPlatform, Document $project, - Authorization $authorization + Authorization $authorization, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ): void { - // Fetch current configuration - $smtp = $project->getAttribute('smtp', []); + $inputs = [ + 'host' => $host, + 'port' => $port, + 'username' => $username, + 'password' => $password, + 'senderEmail' => $senderEmail, + 'senderName' => $senderName, + 'replyToEmail' => $replyToEmail, + 'replyToName' => $replyToName, + 'secure' => $secure, + 'enabled' => $enabled, + ]; - // Apply changes - $keys = ['host', 'port', 'username', 'password', 'senderEmail', 'senderName', 'replyToEmail', 'replyToName', 'secure', 'enabled']; - foreach ($keys as $key) { - if (!\is_null(${$key})) { - $smtp[$key] = ${$key}; - } - } + // The SMTP test (PHPMailer SmtpConnect with Timeout=5) runs inside the + // lock so two concurrent SMTP updates don't validate against the same + // baseline and overwrite each other's secrets. The 10s default lock + // TTL covers the worst-case 5s connection probe with margin. + $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $inputs, $enabled, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - // Backwards compatibility - $smtp['replyToEmail'] = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? ''; + // Fetch current configuration + $smtp = $project->getAttribute('smtp', []); - if (($smtp['enabled'] ?? false) === true) { - // Ensure required fields are set - $requiredKeys = ['host', 'port', 'senderEmail']; - foreach ($requiredKeys as $key) { - if (empty($smtp[$key])) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); + // Apply changes + foreach ($inputs as $key => $value) { + if (!\is_null($value)) { + $smtp[$key] = $value; } } - } - // Validate SMTP credentials - // Validate when the caller is explicitly enabling or hasn't expressed a preference - // (so a credentials-only PATCH can auto-enable). Skip only when the caller is - // explicitly keeping/turning SMTP off. - if (\is_null($enabled) || $enabled === true) { - $mail = new PHPMailer(true); - $mail->isSMTP(); + // Backwards compatibility + $smtp['replyToEmail'] = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? ''; - $mail->Host = $smtp['host'] ?? ''; - $mail->Port = $smtp['port'] ?? ''; - $mail->SMTPSecure = $smtp['secure'] ?? ''; - $mail->setFrom($smtp['senderEmail'], $smtp['senderName'] ?? ''); - - if (!empty($smtp['username'] ?? '')) { - $mail->SMTPAuth = true; - $mail->Username = $smtp['username']; - $mail->Password = $smtp['password'] ?? ''; - } - - if (!empty($smtp['replyToEmail'] ?? '')) { - $mail->addReplyTo($smtp['replyToEmail'], $smtp['replyToName'] ?? ''); - } - - $mail->SMTPAutoTLS = false; - $mail->Timeout = 5; - - try { - $valid = $mail->SmtpConnect(); - - if (!$valid) { - throw new \Exception('Connection is not valid.'); - } - - // Auto-enable if configuration is valid - // Dont do this if specifically request to mark disabled - if (\is_null($enabled)) { - $smtp['enabled'] = true; - } - } catch (Throwable $error) { - if (($smtp['enabled'] ?? null) === true) { - throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, $error->getMessage()); + if (($smtp['enabled'] ?? false) === true) { + // Ensure required fields are set + $requiredKeys = ['host', 'port', 'senderEmail']; + foreach ($requiredKeys as $key) { + if (empty($smtp[$key])) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); + } } } - } - // Save configuration - $updates = new Document([ - 'smtp' => $smtp, - ]); + // Validate SMTP credentials + // Validate when the caller is explicitly enabling or hasn't expressed a preference + // (so a credentials-only PATCH can auto-enable). Skip only when the caller is + // explicitly keeping/turning SMTP off. + if (\is_null($enabled) || $enabled === true) { + $mail = new PHPMailer(true); + $mail->isSMTP(); - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $mail->Host = $smtp['host'] ?? ''; + $mail->Port = $smtp['port'] ?? ''; + $mail->SMTPSecure = $smtp['secure'] ?? ''; + $mail->setFrom($smtp['senderEmail'], $smtp['senderName'] ?? ''); + + if (!empty($smtp['username'] ?? '')) { + $mail->SMTPAuth = true; + $mail->Username = $smtp['username']; + $mail->Password = $smtp['password'] ?? ''; + } + + if (!empty($smtp['replyToEmail'] ?? '')) { + $mail->addReplyTo($smtp['replyToEmail'], $smtp['replyToName'] ?? ''); + } + + $mail->SMTPAutoTLS = false; + $mail->Timeout = 5; + + try { + $valid = $mail->SmtpConnect(); + + if (!$valid) { + throw new \Exception('Connection is not valid.'); + } + + // Auto-enable if configuration is valid + // Dont do this if specifically request to mark disabled + if (\is_null($enabled)) { + $smtp['enabled'] = true; + } + } catch (Throwable $error) { + if (($smtp['enabled'] ?? null) === true) { + throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, $error->getMessage()); + } + } + } + + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'smtp' => $smtp, + ]))); + }, log: $log, logger: $logger); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php index ef93abf683..103a3e83d8 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php @@ -13,6 +13,8 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Emails\Validator\Email; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; @@ -69,6 +71,9 @@ class Update extends Action ->inject('dbForPlatform') ->inject('authorization') ->inject('project') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } @@ -86,47 +91,63 @@ class Update extends Action Database $dbForPlatform, Authorization $authorization, Document $project, + callable $distributedLockOrFail, + Log $log, + ?Logger $logger, ) { $locale = $locale ?: System::getEnv('_APP_LOCALE', 'en'); - // Prevent template update if custom SMTP is not configured - $smtp = $project->getAttribute('smtp', []); - if (($smtp['enabled'] ?? false) !== true) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP must be enabled on the project to configure custom email templates.'); - } + $inputs = [ + 'senderName' => $senderName, + 'senderEmail' => $senderEmail, + 'replyToEmail' => $replyToEmail, + 'replyToName' => $replyToName, + 'message' => $message, + 'subject' => $subject, + ]; - // Fetch current configuration - $templates = $project->getAttribute('templates', []); - $template = $templates['email.' . $templateId . '-' . $locale] ?? []; + $template = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $templateId, $locale, $inputs, $dbForPlatform, $authorization) { + $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); - // Apply changes - $keys = ['senderName', 'senderEmail', 'replyToEmail', 'replyToName', 'message', 'subject']; - foreach ($keys as $key) { - if (!\is_null(${$key})) { - $template[$key] = ${$key}; + // Prevent template update if custom SMTP is not configured + $smtp = $project->getAttribute('smtp', []); + if (($smtp['enabled'] ?? false) !== true) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP must be enabled on the project to configure custom email templates.'); } - } - // Backwards compatibility - if (!\is_null($template['replyTo'] ?? null)) { - $template['replyToEmail'] = $template['replyToEmail'] ?? $template['replyTo'] ?? ''; - } + // Fetch current configuration + $templates = $project->getAttribute('templates', []); + $template = $templates['email.' . $templateId . '-' . $locale] ?? []; - // Ensure required fields are set - $requiredKeys = ['subject', 'message']; - foreach ($requiredKeys as $key) { - if (empty($template[$key])) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); + // Apply changes + foreach ($inputs as $key => $value) { + if (!\is_null($value)) { + $template[$key] = $value; + } } - } - // Save configuration - $templates['email.' . $templateId . '-' . $locale] = $template; - $updates = new Document([ - 'templates' => $templates, - ]); + // Backwards compatibility + if (!\is_null($template['replyTo'] ?? null)) { + $template['replyToEmail'] = $template['replyToEmail'] ?? $template['replyTo'] ?? ''; + } - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + // Ensure required fields are set + $requiredKeys = ['subject', 'message']; + foreach ($requiredKeys as $key) { + if (empty($template[$key])) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); + } + } + + // Save configuration + $templates['email.' . $templateId . '-' . $locale] = $template; + + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'templates' => $templates, + ]))); + + return $template; + }, log: $log, logger: $logger); $queueForEvents->setParam('templateId', $templateId); 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 ab92d1a15f..ab8ca7312e 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php @@ -13,6 +13,8 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\UID; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator; @@ -55,29 +57,39 @@ class Update extends Action ->param('teamId', '', new UID(), 'Team ID of the team to transfer project to.') ->inject('response') ->inject('dbForPlatform') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } - public function action(string $projectId, string $teamId, Response $response, Database $dbForPlatform) + public function action(string $projectId, string $teamId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail, Log $log, ?Logger $logger) { - $project = $dbForPlatform->getDocument('projects', $projectId); - $team = $dbForPlatform->getDocument('teams', $teamId); + // Lock around the project doc RMW. Cascade fan-out to installations, + // repositories and vcsComments runs after the lock is released — + // those write to separate collections, not the project doc. + [$project, $permissions] = $distributedLockOrFail("lock:platform:projects:{$projectId}", function () use ($projectId, $teamId, $dbForPlatform) { + $project = $dbForPlatform->getDocument('projects', $projectId); + $team = $dbForPlatform->getDocument('teams', $teamId); - if ($project->isEmpty()) { - throw new Exception(Exception::PROJECT_NOT_FOUND); - } + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } - if ($team->isEmpty()) { - throw new Exception(Exception::TEAM_NOT_FOUND); - } + if ($team->isEmpty()) { + throw new Exception(Exception::TEAM_NOT_FOUND); + } - $permissions = $this->getPermissions($teamId, $projectId); + $permissions = $this->getPermissions($teamId, $projectId); - $project = $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'teamId' => $teamId, - 'teamInternalId' => $team->getSequence(), - '$permissions' => $permissions, - ])); + $project = $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'teamId' => $teamId, + 'teamInternalId' => $team->getSequence(), + '$permissions' => $permissions, + ])); + + return [$project, $permissions]; + }, log: $log, logger: $logger); $installations = $dbForPlatform->find('installations', [ Query::equal('projectInternalId', [$project->getSequence()]), diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php index 29c26b33ea..11e7c669c4 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php @@ -10,6 +10,8 @@ use Appwrite\Utopia\Database\Validator\Queries\Projects; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator; use Utopia\Validator\Text; @@ -65,29 +67,38 @@ class Update extends Action ->param('legalTaxId', '', new Text(256), 'Project legal tax ID. Max length: 256 chars.', true) ->inject('response') ->inject('dbForPlatform') + ->inject('distributedLockOrFail') + ->inject('log') + ->inject('logger') ->callback($this->action(...)); } - public function action(string $projectId, string $name, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForPlatform) + public function action(string $projectId, string $name, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail, Log $log, ?Logger $logger) { - $project = $dbForPlatform->getDocument('projects', $projectId); + // Re-fetch and write the full project doc inside the lock. This is the + // worst RMW window in the projects API — the endpoint passes the entire + // document back to updateDocument(), so a concurrent write to *any* + // attribute (services, auths, smtp, ...) would be silently overwritten. + $project = $distributedLockOrFail("lock:platform:projects:{$projectId}", function () use ($projectId, $name, $description, $logo, $url, $legalName, $legalCountry, $legalState, $legalCity, $legalAddress, $legalTaxId, $dbForPlatform) { + $project = $dbForPlatform->getDocument('projects', $projectId); - if ($project->isEmpty()) { - throw new Exception(Exception::PROJECT_NOT_FOUND); - } + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } - $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project - ->setAttribute('name', $name) - ->setAttribute('description', $description) - ->setAttribute('logo', $logo) - ->setAttribute('url', $url) - ->setAttribute('legalName', $legalName) - ->setAttribute('legalCountry', $legalCountry) - ->setAttribute('legalState', $legalState) - ->setAttribute('legalCity', $legalCity) - ->setAttribute('legalAddress', $legalAddress) - ->setAttribute('legalTaxId', $legalTaxId) - ->setAttribute('search', implode(' ', [$projectId, $name]))); + return $dbForPlatform->updateDocument('projects', $project->getId(), $project + ->setAttribute('name', $name) + ->setAttribute('description', $description) + ->setAttribute('logo', $logo) + ->setAttribute('url', $url) + ->setAttribute('legalName', $legalName) + ->setAttribute('legalCountry', $legalCountry) + ->setAttribute('legalState', $legalState) + ->setAttribute('legalCity', $legalCity) + ->setAttribute('legalAddress', $legalAddress) + ->setAttribute('legalTaxId', $legalTaxId) + ->setAttribute('search', implode(' ', [$projectId, $name]))); + }, log: $log, logger: $logger); $response->dynamic($project, Response::MODEL_PROJECT); } From b29f9f4a453aba6d82ea1f6a0b0693d24904c2a6 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 01:36:38 +0100 Subject: [PATCH 007/151] feat: distributed lock on router projects.accessedAt RMW MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every request that arrives via a custom-domain rule (router path) reads the project's `accessedAt` timestamp and, if the throttle window (`APP_PROJECT_ACCESS`) has elapsed, writes a fresh value. With concurrent traffic across multiple pods, this is a per-row hot RMW that loses updates silently — the surviving timestamp depends on which pod's write landed last. Wrap the read-modify-write in `distributedLock('lock:platform:projects:{id}')` (skip-on-contention variant). Every concurrent pod would write the same throttled value, so losing the race is correct: the winner's update covers ours. Wires `distributedLock` and `?Logger` through: - `router()` function signature (app/controllers/general.php:70) - the three Http::init / Http::get callbacks that invoke router(): `*` catch-all (init), `/robots.txt`, `/humans.txt` Two related cloud-only RMW sites (`teams.accessedAt`, `projects.mcpAccessedAt`) live in `appwrite-labs/cloud` and need a follow-up PR there. They depend on this branch reaching 1.9.x so the `distributedLock` DI resource is available downstream. --- app/controllers/general.php | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 2cec14cc1d..053786b191 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -67,7 +67,7 @@ use Utopia\Validator\Text; Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount) +function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { $host = $request->getHostname(); if (!empty($previewHostname)) { @@ -136,9 +136,14 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S if (!$project->isEmpty() && $project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'accessedAt' => DateTime::now() - ]))); + // Skip-on-contention: every concurrent router request would write + // the same throttled timestamp, so losing the race is correct — + // the winning pod's update covers ours. + $distributedLock('lock:platform:projects:' . $project->getId(), function () use ($dbForPlatform, $project, $authorization) { + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'accessedAt' => DateTime::now() + ]))); + }, log: $log, logger: $logger); } /** @@ -847,7 +852,9 @@ Http::init() ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->inject('distributedLock') + ->inject('logger') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { /* * Appwrite Router */ @@ -855,7 +862,7 @@ Http::init() $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!\in_array($hostname, $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { $utopia->getRoute()?->label('router', true); } } @@ -1140,14 +1147,16 @@ Http::options() ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->inject('distributedLock') + ->inject('logger') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { /* * Appwrite Router */ $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { $utopia->getRoute()?->label('router', true); } } @@ -1542,13 +1551,15 @@ Http::get('/robots.txt') ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->inject('distributedLock') + ->inject('logger') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { $utopia->getRoute()?->label('router', true); } } @@ -1576,13 +1587,15 @@ Http::get('/humans.txt') ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->inject('distributedLock') + ->inject('logger') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { $utopia->getRoute()?->label('router', true); } } From 380cc3eb27446f4307db7baaebc41b720ad20983 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 02:02:28 +0100 Subject: [PATCH 008/151] refactor: drop log/logger boilerplate from lock call sites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous shape required every caller to thread `log: $log, logger: $logger` as named args into each `distributedLock(...)` invocation, plus inject `log` and `logger` into the surrounding action just to forward them to the lock. Across 21 call sites this added ~100 LOC of pure plumbing. The cause: the lock factory was registered on the global container in `app/init/resources.php`, where per-request resources like `log` aren't visible. That forced the factory to expose its inner closure with optional `?Log $log = null, ?Logger $logger = null` params, which every caller had to satisfy. Move the lock factory + its `lockErrorReporter`/`lockTargetOf` helpers from the global container to the per-request container (`resources/request.php`), and add `'log'` + `'logger'` to the factory's dep list. The factory closure now runs per-request and closes over the per-request `Log`/`Logger`. Inner closure returned to callers no longer needs the optional params, and call sites drop the named args entirely. Knock-on cleanup: - Drop `->inject('log')`, `->inject('logger')`, the corresponding action params, and `use Utopia\Logger\{Log,Logger}` imports from 19 endpoint files where they were only there for the lock - Drop the same plumbing from `app/controllers/shared/api.php` (3 lock call sites) - Drop just the Logger plumbing from `app/controllers/general.php` (router function + 3 callbacks); `Log` is kept because it's used elsewhere in that file - Net 120 LOC removed across 23 files No behavior change: the lock factories still produce the same closures (skip-on-contention `distributedLock`, blocking-with-409 `distributedLockOrFail`). The static lockErrorReporter rate limiter (1 push per 60s per `(action, target)` bucket) continues to work — it lives on a closure-static in the helper, which is independent of where the helper is constructed. Verified end-to-end: testConcurrentTogglesAllPersist passes 4/5 (the cold- start race flake is the same one we've consistently seen and is orthogonal to lock changes). --- app/controllers/general.php | 24 +-- app/controllers/shared/api.php | 12 +- app/init/resources.php | 196 ------------------ app/init/resources/request.php | 194 +++++++++++++++++ .../Http/Project/AuthMethods/Update.php | 8 +- .../Project/Http/Project/MockPhone/Create.php | 8 +- .../Project/Http/Project/MockPhone/Delete.php | 8 +- .../Project/Http/Project/MockPhone/Update.php | 8 +- .../Policies/MembershipPrivacy/Update.php | 8 +- .../Policies/PasswordDictionary/Update.php | 8 +- .../Policies/PasswordHistory/Update.php | 8 +- .../Policies/PasswordPersonalData/Update.php | 8 +- .../Project/Policies/SessionAlert/Update.php | 8 +- .../Policies/SessionDuration/Update.php | 8 +- .../Policies/SessionInvalidation/Update.php | 8 +- .../Project/Policies/SessionLimit/Update.php | 8 +- .../Project/Policies/UserLimit/Update.php | 8 +- .../Project/Http/Project/Protocols/Update.php | 8 +- .../Project/Http/Project/SMTP/Update.php | 8 +- .../Project/Http/Project/Services/Update.php | 8 +- .../Http/Project/Templates/Email/Update.php | 8 +- .../Projects/Http/Projects/Team/Update.php | 8 +- .../Modules/Projects/Http/Projects/Update.php | 8 +- 23 files changed, 229 insertions(+), 349 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 053786b191..3fcfd712c2 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -67,7 +67,7 @@ use Utopia\Validator\Text; Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) +function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { $host = $request->getHostname(); if (!empty($previewHostname)) { @@ -143,7 +143,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'accessedAt' => DateTime::now() ]))); - }, log: $log, logger: $logger); + }); } /** @@ -853,8 +853,7 @@ Http::init() ->inject('queueForDeletes') ->inject('executionsRetentionCount') ->inject('distributedLock') - ->inject('logger') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { /* * Appwrite Router */ @@ -862,7 +861,7 @@ Http::init() $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!\in_array($hostname, $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { $utopia->getRoute()?->label('router', true); } } @@ -1148,15 +1147,14 @@ Http::options() ->inject('queueForDeletes') ->inject('executionsRetentionCount') ->inject('distributedLock') - ->inject('logger') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { /* * Appwrite Router */ $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { $utopia->getRoute()?->label('router', true); } } @@ -1552,14 +1550,13 @@ Http::get('/robots.txt') ->inject('queueForDeletes') ->inject('executionsRetentionCount') ->inject('distributedLock') - ->inject('logger') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { $utopia->getRoute()?->label('router', true); } } @@ -1588,14 +1585,13 @@ Http::get('/humans.txt') ->inject('queueForDeletes') ->inject('executionsRetentionCount') ->inject('distributedLock') - ->inject('logger') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock, ?Logger $logger) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock, $logger)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { $utopia->getRoute()?->label('router', true); } } diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 142a20c4f3..b07eec1a99 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -39,8 +39,6 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\Roles; use Utopia\Http\Http; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Span\Span; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; @@ -103,9 +101,7 @@ Http::init() ->inject('apiKey') ->inject('authorization') ->inject('distributedLock') - ->inject('log') - ->inject('logger') - ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, callable $distributedLock, Log $log, ?Logger $logger) { + ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, callable $distributedLock) { $route = $utopia->getRoute(); if ($route === null) { throw new AppwriteException(AppwriteException::GENERAL_ROUTE_NOT_FOUND); @@ -267,7 +263,7 @@ Http::init() } elseif (! empty($apiKey->getTeamId())) { $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('teams', $team->getId())); } - }, log: $log, logger: $logger); + }); } $userClone = clone $user; @@ -402,7 +398,7 @@ Http::init() $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'accessedAt' => DateTime::now() ]))); - }, log: $log, logger: $logger); + }); } } @@ -423,7 +419,7 @@ Http::init() $authorization->skip(fn () => $dbForPlatform->updateDocument('users', $user->getId(), new Document([ 'accessedAt' => $user->getAttribute('accessedAt') ]))); - }, log: $log, logger: $logger); + }); } } } diff --git a/app/init/resources.php b/app/init/resources.php index 4a4af38b5f..29506bfc9c 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -8,7 +8,6 @@ use Appwrite\Event\Publisher\Migration as MigrationPublisher; use Appwrite\Event\Publisher\Screenshot as ScreenshotPublisher; use Appwrite\Event\Publisher\StatsResources as StatsResourcesPublisher; use Appwrite\Event\Publisher\Usage as UsagePublisher; -use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Utopia\Database\Documents\User; use Executor\Executor; use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis; @@ -23,9 +22,6 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\DI\Container; use Utopia\DSN\DSN; -use Utopia\Lock\Distributed as DistributedLock; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Pools\Group; use Utopia\Queue\Broker\Pool as BrokerPool; use Utopia\Queue\Publisher; @@ -217,198 +213,6 @@ $container->set('timelimit', function (\Redis $redis) { }; }, ['redis']); -// Extract the collection segment ("keys" / "projects" / "users") from keys -// of the form "lock:platform:{target}:{id}" so metrics can slice by target. -// Used by both distributedLock and distributedLockOrFail factories below. -$lockTargetOf = function (string $key): string { - $parts = explode(':', $key, 4); - return $parts[2] ?? 'unknown'; -}; - -/** - * Push lock-side errors to the configured logger (Sentry/Raygun/AppSignal/etc.) - * by mutating the caller's per-request `Log` object — same pattern as - * Embeddings/Text/Create.php and the http.php request-end error handler. - * - * Rate limited per pod via a static bucket so a sustained backend outage - * doesn't flood the logger. At most one push per 60s per (action, target) - * combo. Across a fleet of N pods this caps at N events/min, well within - * Sentry's own dedup tolerance. - * - * Only "real" errors are reported here: - * - backend_error: Redis/Dragonfly unreachable - * - release_error: lock release failed (TTL expired or backend dropped) - * - * Skipped on purpose: contention 409s (normal user-facing concurrency), - * skip-on-contention events (idempotent fan-out by design), acquire retry - * conflicts (internal loop), destructor cleanups (have an expected - * baseline rate; aggregate via the `lock.attempts` counter instead). - */ -$lockErrorReporter = function (?Log $log, ?Logger $logger, string $action, string $key, string $target, Throwable $e): void { - static $lastReportAt = []; - - Console::warning("Lock {$action} for {$key}: {$e->getMessage()}"); - - if ($logger === null || $log === null) { - return; - } - - $bucket = $action . ':' . $target; - $now = time(); - if (($lastReportAt[$bucket] ?? 0) + 60 > $now) { - return; - } - $lastReportAt[$bucket] = $now; - - $log->setNamespace('http'); - $log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); - $log->setVersion(APP_VERSION_STABLE); - $log->setType(Log::TYPE_WARNING); - $log->setMessage('Distributed lock ' . $action . ': ' . $e->getMessage()); - $log->setAction("lock.{$action}"); - $log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' - ? Log::ENVIRONMENT_PRODUCTION - : Log::ENVIRONMENT_STAGING); - - $log->addTag('lock.target', $target); - // Strip the trailing document ID from the key so log aggregators don't - // see unbounded cardinality; the {target} attribute already covers slicing. - $log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); - $log->addTag('code', $e->getCode()); - - $log->addExtra('file', $e->getFile()); - $log->addExtra('line', $e->getLine()); - $log->addExtra('trace', $e->getTraceAsString()); - - try { - $logger->addLog($log); - } catch (Throwable) { - // best-effort; don't let logging failures break fail-open - } -}; - -/** - * Distributed-lock factory: skip-on-contention variant. - * - * For idempotent writes where losing the race is correct (e.g., per-request - * `accessedAt` updates from N pods all writing the same value). On contention, - * the callback is silently skipped — another pod is doing the same work. - * - * Behavior: - * - Non-blocking acquire (one attempt). On conflict, skip and return. - * - Fail-open: if Redis is unreachable, run the callback unlocked + warn. - * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. - * - * Returns void — the caller can't distinguish "acquired and ran" from "skipped". - * - * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, skipped, - * backend_error, release_error}. - */ -$container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf, $lockErrorReporter) { - $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; - $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); - - if (! $enabled) { - return function (string $key, \Closure $fn, float $ttl = 5.0, ?Log $log = null, ?Logger $logger = null): void { - $fn(); - }; - } - - return function (string $key, \Closure $fn, float $ttl = 5.0, ?Log $log = null, ?Logger $logger = null) use ($redis, $attempts, $lockTargetOf, $lockErrorReporter): void { - $target = $lockTargetOf($key); - $lock = new DistributedLock($redis, $key, (int) $ttl); - - try { - $acquired = $lock->tryAcquire(); - } catch (\RedisException $e) { - $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); - $fn(); - return; - } - - if (! $acquired) { - $attempts->add(1, ['outcome' => 'skipped', 'target' => $target]); - return; - } - - $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); - try { - $fn(); - } finally { - try { - $lock->release(); - } catch (\Throwable $e) { - $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); - } - } - }; -}, ['redis', 'telemetry']); - -/** - * Distributed-lock factory: 409-on-contention variant. - * - * For explicit user-write endpoints where read-modify-write on shared mutable - * state must NOT silently drop a request. On contention, throws - * `Exception::GENERAL_RESOURCE_LOCKED` (HTTP 409) so the client retries. - * - * Behavior: - * - Blocking acquire with short timeout (default 3s). - * - On timeout, throws `GENERAL_RESOURCE_LOCKED`. - * - Fail-open: backend unreachable runs the callback unlocked + warning. - * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. - * - Returns the callback's return value so callers can use the result. - * - * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, contended, - * backend_error, release_error}. - */ -$container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $telemetry) use ($lockTargetOf, $lockErrorReporter) { - $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; - $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); - - if (! $enabled) { - return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0, ?Log $log = null, ?Logger $logger = null): mixed { - return $fn(); - }; - } - - return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0, ?Log $log = null, ?Logger $logger = null) use ($redis, $attempts, $lockTargetOf, $lockErrorReporter): mixed { - $target = $lockTargetOf($key); - $lock = new DistributedLock($redis, $key, (int) $ttl); - - try { - $acquired = $lock->acquire($waitTimeout); - } catch (\RedisException $e) { - $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); - return $fn(); - } - - if (! $acquired) { - $attempts->add(1, ['outcome' => 'contended', 'target' => $target]); - // Don't pass a custom message — the catalog message in - // app/config/errors.php is reused so we don't leak the internal - // lock key (which embeds collection name and document id) into a - // user-facing 409 response. The telemetry attribute already - // carries the target collection for operator-side observability. - throw new AppwriteException(AppwriteException::GENERAL_RESOURCE_LOCKED); - } - - $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); - try { - return $fn(); - } finally { - try { - $lock->release(); - } catch (\Throwable $e) { - $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); - } - } - }; -}, ['redis', 'telemetry']); - $container->set('deviceForLocal', function (Telemetry $telemetry) { return new Device\Telemetry($telemetry, new Local()); }, ['telemetry']); diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 7d1731b80d..602efe64f0 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -37,6 +37,7 @@ use Utopia\Auth\Proofs\Token; use Utopia\Auth\Store; use Utopia\Cache\Cache; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime as DatabaseDateTime; @@ -48,7 +49,9 @@ use Utopia\Domains\Domain; use Utopia\DSN\DSN; use Utopia\Http\Http; use Utopia\Locale\Locale; +use Utopia\Lock\Distributed as DistributedLock; use Utopia\Logger\Log; +use Utopia\Logger\Logger; use Utopia\Pools\Group; use Utopia\Queue\Publisher; use Utopia\Storage\Device; @@ -73,6 +76,197 @@ return function (Container $container): void { return $register->get('logger'); }, ['register']); + /** + * Push lock-side errors to the configured logger (Sentry/Raygun/AppSignal/etc.) + * by mutating the per-request `Log` object — same pattern as + * Embeddings/Text/Create.php and the http.php request-end error handler. + * + * Rate limited per pod via a static bucket so a sustained backend outage + * doesn't flood the logger. At most one push per 60s per (action, target) + * combo. Across a fleet of N pods this caps at N events/min, well within + * Sentry's own dedup tolerance. + * + * Only "real" errors are reported here: + * - backend_error: Redis/Dragonfly unreachable + * - release_error: lock release failed (TTL expired or backend dropped) + * + * Skipped on purpose: contention 409s (normal user-facing concurrency), + * skip-on-contention events (idempotent fan-out by design), acquire retry + * conflicts (internal loop), destructor cleanups (have an expected + * baseline rate; aggregate via the `lock.attempts` counter instead). + */ + $lockErrorReporter = function (Log $log, ?Logger $logger, string $action, string $key, string $target, Throwable $e): void { + static $lastReportAt = []; + + Console::warning("Lock {$action} for {$key}: {$e->getMessage()}"); + + if ($logger === null) { + return; + } + + $bucket = $action . ':' . $target; + $now = time(); + if (($lastReportAt[$bucket] ?? 0) + 60 > $now) { + return; + } + $lastReportAt[$bucket] = $now; + + $log->setNamespace('http'); + $log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); + $log->setVersion(APP_VERSION_STABLE); + $log->setType(Log::TYPE_WARNING); + $log->setMessage('Distributed lock ' . $action . ': ' . $e->getMessage()); + $log->setAction("lock.{$action}"); + $log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' + ? Log::ENVIRONMENT_PRODUCTION + : Log::ENVIRONMENT_STAGING); + + $log->addTag('lock.target', $target); + // Strip the trailing document ID from the key so log aggregators don't + // see unbounded cardinality; the {target} attribute already covers slicing. + $log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); + $log->addTag('code', $e->getCode()); + + $log->addExtra('file', $e->getFile()); + $log->addExtra('line', $e->getLine()); + $log->addExtra('trace', $e->getTraceAsString()); + + try { + $logger->addLog($log); + } catch (Throwable) { + // best-effort; don't let logging failures break fail-open + } + }; + + // Extract the collection segment ("keys" / "projects" / "users") from keys + // of the form "lock:platform:{target}:{id}" so metrics can slice by target. + $lockTargetOf = function (string $key): string { + $parts = explode(':', $key, 4); + return $parts[2] ?? 'unknown'; + }; + + /** + * Distributed-lock factory: skip-on-contention variant. + * + * For idempotent writes where losing the race is correct (e.g., per-request + * `accessedAt` updates from N pods all writing the same value). On contention, + * the callback is silently skipped — another pod is doing the same work. + * + * Behavior: + * - Non-blocking acquire (one attempt). On conflict, skip and return. + * - Fail-open: if Redis is unreachable, run the callback unlocked + warn. + * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. + * + * Returns void — the caller can't distinguish "acquired and ran" from "skipped". + * + * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, skipped, + * backend_error, release_error}. + */ + $container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry, Log $log, ?Logger $logger) use ($lockTargetOf, $lockErrorReporter) { + $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; + $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); + + if (! $enabled) { + return function (string $key, \Closure $fn, float $ttl = 5.0): void { + $fn(); + }; + } + + return function (string $key, \Closure $fn, float $ttl = 5.0) use ($redis, $attempts, $log, $logger, $lockTargetOf, $lockErrorReporter): void { + $target = $lockTargetOf($key); + $lock = new DistributedLock($redis, $key, (int) $ttl); + + try { + $acquired = $lock->tryAcquire(); + } catch (\RedisException $e) { + $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); + $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); + $fn(); + return; + } + + if (! $acquired) { + $attempts->add(1, ['outcome' => 'skipped', 'target' => $target]); + return; + } + + $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); + try { + $fn(); + } finally { + try { + $lock->release(); + } catch (\Throwable $e) { + $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); + $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); + } + } + }; + }, ['redis', 'telemetry', 'log', 'logger']); + + /** + * Distributed-lock factory: 409-on-contention variant. + * + * For explicit user-write endpoints where read-modify-write on shared mutable + * state must NOT silently drop a request. On contention, throws + * `Exception::GENERAL_RESOURCE_LOCKED` (HTTP 409) so the client retries. + * + * Behavior: + * - Blocking acquire with short timeout (default 3s). + * - On timeout, throws `GENERAL_RESOURCE_LOCKED`. + * - Fail-open: backend unreachable runs the callback unlocked + warning. + * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. + * - Returns the callback's return value so callers can use the result. + * + * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, contended, + * backend_error, release_error}. + */ + $container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $telemetry, Log $log, ?Logger $logger) use ($lockTargetOf, $lockErrorReporter) { + $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; + $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); + + if (! $enabled) { + return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0): mixed { + return $fn(); + }; + } + + return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0) use ($redis, $attempts, $log, $logger, $lockTargetOf, $lockErrorReporter): mixed { + $target = $lockTargetOf($key); + $lock = new DistributedLock($redis, $key, (int) $ttl); + + try { + $acquired = $lock->acquire($waitTimeout); + } catch (\RedisException $e) { + $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); + $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); + return $fn(); + } + + if (! $acquired) { + $attempts->add(1, ['outcome' => 'contended', 'target' => $target]); + // Don't pass a custom message — the catalog message in + // app/config/errors.php is reused so we don't leak the internal + // lock key (which embeds collection name and document id) into a + // user-facing 409 response. The telemetry attribute already + // carries the target collection for operator-side observability. + throw new Exception(Exception::GENERAL_RESOURCE_LOCKED); + } + + $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); + try { + return $fn(); + } finally { + try { + $lock->release(); + } catch (\Throwable $e) { + $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); + $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); + } + } + }; + }, ['redis', 'telemetry', 'log', 'logger']); + $container->set('authorization', function () { return new Authorization(); }, []); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php index 9f06c51880..1ce36c8577 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php @@ -12,8 +12,6 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\WhiteList; @@ -63,8 +61,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -77,8 +73,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $auth = Config::getParam('auth')[$methodId] ?? []; $authKey = $auth['key'] ?? ''; @@ -92,7 +86,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents->setParam('methodId', $methodId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php index 08163d644a..8ab0653df3 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php @@ -13,8 +13,6 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; @@ -62,8 +60,6 @@ class Create extends Action ->inject('dbForPlatform') ->inject('authorization') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -76,8 +72,6 @@ class Create extends Action Database $dbForPlatform, Authorization $authorization, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ) { // Set to now date $mockNumber = [ @@ -109,7 +103,7 @@ class Create extends Action $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php index 560ff4b6e4..bbc534fdf8 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php @@ -13,8 +13,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -61,8 +59,6 @@ class Delete extends Action ->inject('dbForPlatform') ->inject('authorization') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -74,8 +70,6 @@ class Delete extends Action Database $dbForPlatform, Authorization $authorization, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ) { $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -101,7 +95,7 @@ class Delete extends Action $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php index 55512ff215..a492d7c7bd 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php @@ -13,8 +13,6 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; @@ -62,8 +60,6 @@ class Update extends Action ->inject('dbForPlatform') ->inject('authorization') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -76,8 +72,6 @@ class Update extends Action Database $dbForPlatform, Authorization $authorization, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ) { $mockNumber = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $otp, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -106,7 +100,7 @@ class Update extends Action ]))); return $mockNumbers[$mockNumberIndex]; - }, log: $log, logger: $logger); + }); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index f510801524..a912ee48a6 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -63,8 +61,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -80,8 +76,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $userId, $userEmail, $userPhone, $userName, $userMFA, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -107,7 +101,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php index 7dc7729b47..9cb310257e 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -59,8 +57,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -72,8 +68,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -84,7 +78,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php index 19ffc9a0b2..cfff58c8f0 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Nullable; use Utopia\Validator\Range; @@ -62,8 +60,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -75,8 +71,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -87,7 +81,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php index 95c6b9452a..580b04754b 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -60,8 +58,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -73,8 +69,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -85,7 +79,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php index 6948eed85e..8f9f0a4c48 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -59,8 +57,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -72,8 +68,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -84,7 +78,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php index 3de157556a..c8111b5563 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Range; @@ -59,8 +57,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -72,8 +68,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $duration, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -84,7 +78,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php index f6dcb95123..e10c0d4081 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; @@ -59,8 +57,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -72,8 +68,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -84,7 +78,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php index 826478b713..b111534430 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Nullable; use Utopia\Validator\Range; @@ -60,8 +58,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -73,8 +69,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -85,7 +79,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php index a882a72603..c59a17b61f 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php @@ -11,8 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Nullable; use Utopia\Validator\Range; @@ -60,8 +58,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -73,8 +69,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -85,7 +79,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php index 5fb40571bf..0f3174b143 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php @@ -12,8 +12,6 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\WhiteList; @@ -63,8 +61,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -77,8 +73,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $protocolId, $enabled, $dbForPlatform, $authorization) { $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); @@ -89,7 +83,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'apis' => $protocols, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents->setParam('protocolId', $protocolId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index 12238f7150..b8e3c6e09f 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -14,8 +14,6 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Emails\Validator\Email; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\Hostname; @@ -75,8 +73,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -97,8 +93,6 @@ class Update extends Action Document $project, Authorization $authorization, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { $inputs = [ 'host' => $host, @@ -191,7 +185,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'smtp' => $smtp, ]))); - }, log: $log, logger: $logger); + }); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index 933d524e23..1126da8897 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -12,8 +12,6 @@ use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\WhiteList; @@ -63,8 +61,6 @@ class Update extends Action ->inject('authorization') ->inject('queueForEvents') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -77,8 +73,6 @@ class Update extends Action Authorization $authorization, Event $queueForEvents, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ): void { // The services map is a JSON object on the project document. Two // concurrent service toggles read the same baseline, each set their @@ -96,7 +90,7 @@ class Update extends Action return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'services' => $services, ]))); - }, log: $log, logger: $logger); + }); $queueForEvents->setParam('serviceId', $serviceId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php index 103a3e83d8..ed1f7d8f7f 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php @@ -13,8 +13,6 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Emails\Validator\Email; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; @@ -72,8 +70,6 @@ class Update extends Action ->inject('authorization') ->inject('project') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } @@ -92,8 +88,6 @@ class Update extends Action Authorization $authorization, Document $project, callable $distributedLockOrFail, - Log $log, - ?Logger $logger, ) { $locale = $locale ?: System::getEnv('_APP_LOCALE', 'en'); @@ -147,7 +141,7 @@ class Update extends Action ]))); return $template; - }, log: $log, logger: $logger); + }); $queueForEvents->setParam('templateId', $templateId); 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 ab8ca7312e..25286a2227 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php @@ -13,8 +13,6 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\UID; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator; @@ -58,12 +56,10 @@ class Update extends Action ->inject('response') ->inject('dbForPlatform') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } - public function action(string $projectId, string $teamId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail, Log $log, ?Logger $logger) + public function action(string $projectId, string $teamId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail) { // Lock around the project doc RMW. Cascade fan-out to installations, // repositories and vcsComments runs after the lock is released — @@ -89,7 +85,7 @@ class Update extends Action ])); return [$project, $permissions]; - }, log: $log, logger: $logger); + }); $installations = $dbForPlatform->find('installations', [ Query::equal('projectInternalId', [$project->getSequence()]), diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php index 11e7c669c4..4b79b37bfa 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php @@ -10,8 +10,6 @@ use Appwrite\Utopia\Database\Validator\Queries\Projects; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Platform\Scope\HTTP; use Utopia\Validator; use Utopia\Validator\Text; @@ -68,12 +66,10 @@ class Update extends Action ->inject('response') ->inject('dbForPlatform') ->inject('distributedLockOrFail') - ->inject('log') - ->inject('logger') ->callback($this->action(...)); } - public function action(string $projectId, string $name, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail, Log $log, ?Logger $logger) + public function action(string $projectId, string $name, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail) { // Re-fetch and write the full project doc inside the lock. This is the // worst RMW window in the projects API — the endpoint passes the entire @@ -98,7 +94,7 @@ class Update extends Action ->setAttribute('legalAddress', $legalAddress) ->setAttribute('legalTaxId', $legalTaxId) ->setAttribute('search', implode(' ', [$projectId, $name]))); - }, log: $log, logger: $logger); + }); $response->dynamic($project, Response::MODEL_PROJECT); } From fce2abfd4c952121073b3b189b2bdfcacef2a964 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 05:31:18 +0100 Subject: [PATCH 009/151] revert: scope distributed-lock PR to thundering-herd sites only Drop the 18 lost-update endpoint locks (Project/* settings + Projects team/update). Those address a different bug class (read-modify-write races) than the manager-flagged production problem (regions slow queries to platform from thundering herd on accessedAt writes). Kept: - distributedLock + distributedLockOrFail factories on the per-request container, GENERAL_RESOURCE_LOCKED exception, 409 mapping - 4 thundering-herd sites: cache-invalidation in shared/api.php (3) + router projects.accessedAt in general.php (1) Dropped: - 18 endpoint OrFail wires - testConcurrentTogglesAllPersist + Swoole-cURL test client patches - dev/test-distributed-lock.sh smoke script --- dev/test-distributed-lock.sh | 157 ------------------ .../Http/Project/AuthMethods/Update.php | 18 +- .../Project/Http/Project/MockPhone/Create.php | 43 +++-- .../Project/Http/Project/MockPhone/Delete.php | 41 +++-- .../Project/Http/Project/MockPhone/Update.php | 44 +++-- .../Policies/MembershipPrivacy/Update.php | 44 +++-- .../Policies/PasswordDictionary/Update.php | 16 +- .../Policies/PasswordHistory/Update.php | 21 +-- .../Policies/PasswordPersonalData/Update.php | 16 +- .../Project/Policies/SessionAlert/Update.php | 16 +- .../Policies/SessionDuration/Update.php | 16 +- .../Policies/SessionInvalidation/Update.php | 16 +- .../Project/Policies/SessionLimit/Update.php | 21 +-- .../Project/Policies/UserLimit/Update.php | 21 +-- .../Project/Http/Project/Protocols/Update.php | 16 +- .../Project/Http/Project/SMTP/Update.php | 149 ++++++++--------- .../Project/Http/Project/Services/Update.php | 25 +-- .../Http/Project/Templates/Email/Update.php | 75 ++++----- .../Projects/Http/Projects/Team/Update.php | 38 ++--- .../Modules/Projects/Http/Projects/Update.php | 41 ++--- tests/e2e/Client.php | 15 +- tests/e2e/Services/Project/ServicesBase.php | 88 ---------- 22 files changed, 290 insertions(+), 647 deletions(-) delete mode 100755 dev/test-distributed-lock.sh diff --git a/dev/test-distributed-lock.sh b/dev/test-distributed-lock.sh deleted file mode 100755 index 6a740a4169..0000000000 --- a/dev/test-distributed-lock.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env bash -# -# Manual smoke test for the distributed-lock pilot on `updateProjectService`. -# -# Fires N concurrent PATCH /project/services/:serviceId requests against the -# same project, each toggling a different service to "enabled=true". Then -# refetches the project and counts how many of the targeted services actually -# persisted. -# -# Usage: -# APPWRITE_ENDPOINT=http://localhost \ -# APPWRITE_PROJECT_ID= \ -# APPWRITE_API_KEY= \ -# ./dev/test-distributed-lock.sh -# -# Required scopes on the API key: -# - project.write (to toggle services) -# - projects.read (to refetch project state via GET /v1/projects/:id) -# -# To prove the lock fixes the bug, run twice: -# 1. With `_APP_LOCKING_ENABLED=enabled` (default): expect successes == enabled -# 2. With `_APP_LOCKING_ENABLED=disabled` : expect successes > enabled (lost updates) -# -# Set `_APP_LOCKING_ENABLED` in `.env` and `docker compose up -d --force-recreate` -# between runs. Use `--parallelism N` to tune the concurrency level. - -set -eu - -# --- Configuration --------------------------------------------------------- - -ENDPOINT="${APPWRITE_ENDPOINT:?set APPWRITE_ENDPOINT, e.g. http://localhost}" -PROJECT_ID="${APPWRITE_PROJECT_ID:?set APPWRITE_PROJECT_ID}" -API_KEY="${APPWRITE_API_KEY:?set APPWRITE_API_KEY}" -PARALLELISM="${PARALLELISM:-5}" - -# Services to toggle concurrently — must be in the optional-services list of -# the project. These are the same set used by the e2e ServicesBase trait. -SERVICES=(teams storage functions sites messaging) - -# Trim or extend SERVICES to match PARALLELISM. -SERVICES=("${SERVICES[@]:0:$PARALLELISM}") - -if [ "${#SERVICES[@]}" -lt 2 ]; then - echo "ERROR: PARALLELISM must be >= 2 to detect contention" >&2 - exit 1 -fi - -# --- Helpers --------------------------------------------------------------- - -curl_appwrite() { - local method="$1" - local path="$2" - shift 2 - curl -sS -o /tmp/lock-smoke-body.$$ -w '%{http_code}' \ - -X "$method" \ - -H "Content-Type: application/json" \ - -H "X-Appwrite-Project: $PROJECT_ID" \ - -H "X-Appwrite-Key: $API_KEY" \ - "$ENDPOINT/v1$path" \ - "$@" -} - -toggle_service() { - local service="$1" - local enabled="$2" - local code - code=$(curl_appwrite PATCH "/project/services/$service" \ - -d "{\"enabled\": $enabled}") - echo "$code" -} - -get_project_state() { - curl -sS \ - -H "Content-Type: application/json" \ - -H "X-Appwrite-Project: console" \ - -H "X-Appwrite-Key: $API_KEY" \ - "$ENDPOINT/v1/projects/$PROJECT_ID" -} - -# --- Run ------------------------------------------------------------------- - -echo "==> Distributed-lock smoke test" -echo " endpoint: $ENDPOINT" -echo " project: $PROJECT_ID" -echo " parallelism: $PARALLELISM" -echo " services: ${SERVICES[*]}" -echo - -# 1. Baseline — disable all targeted services sequentially. -echo "==> Baseline: disabling ${SERVICES[*]}" -for svc in "${SERVICES[@]}"; do - code=$(toggle_service "$svc" false) - if [ "$code" != "200" ]; then - echo " WARN: baseline disable of $svc returned $code (expected 200)" - fi -done - -# 2. Fire concurrent toggles to enabled=true. Capture each child's HTTP status. -echo -echo "==> Firing ${#SERVICES[@]} concurrent toggle requests..." -RESULTS_FILE=$(mktemp -t lock-smoke-results.XXXXXX) -for svc in "${SERVICES[@]}"; do - ( - code=$(toggle_service "$svc" true) - printf '%s %s\n' "$svc" "$code" >> "$RESULTS_FILE" - ) & -done -wait - -# 3. Tally responses. -SUCCESS_COUNT=$(awk '$2 == 200' "$RESULTS_FILE" | wc -l | tr -d ' ') -CONFLICT_COUNT=$(awk '$2 == 409' "$RESULTS_FILE" | wc -l | tr -d ' ') -OTHER_COUNT=$(awk '$2 != 200 && $2 != 409' "$RESULTS_FILE" | wc -l | tr -d ' ') - -echo -echo "==> Child responses:" -sort "$RESULTS_FILE" -echo -echo " successes (200): $SUCCESS_COUNT" -echo " conflicts (409): $CONFLICT_COUNT" -echo " other: $OTHER_COUNT" -rm -f "$RESULTS_FILE" - -# 4. Refetch project; count how many targeted services are enabled. -PROJECT_JSON=$(get_project_state) -ENABLED_COUNT=0 -for svc in "${SERVICES[@]}"; do - # Capitalize first letter to form serviceStatusFor key. - Cap="$(echo "$svc" | awk '{print toupper(substr($1,1,1)) substr($1,2)}')" - val=$(echo "$PROJECT_JSON" | sed -nE "s/.*\"serviceStatusFor${Cap}\":[[:space:]]*(true|false).*/\1/p" | head -n1) - if [ "$val" = "true" ]; then - ENABLED_COUNT=$((ENABLED_COUNT + 1)) - fi -done - -echo " enabled in project state: $ENABLED_COUNT" -echo - -# 5. Verdict. -if [ "$SUCCESS_COUNT" -eq "$ENABLED_COUNT" ]; then - echo "PASS: every successful toggle persisted (no lost updates)." - EXIT=0 -else - echo "FAIL: lost updates detected. successes=$SUCCESS_COUNT enabled=$ENABLED_COUNT" - echo " Locking is either disabled or not effective on this endpoint." - EXIT=1 -fi - -# 6. Cleanup — re-enable all targeted services. -echo -echo "==> Cleanup: re-enabling ${SERVICES[*]}" -for svc in "${SERVICES[@]}"; do - toggle_service "$svc" true >/dev/null || true -done - -rm -f /tmp/lock-smoke-body.$$ -exit "$EXIT" diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php index 1ce36c8577..0d1cd83203 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php @@ -60,7 +60,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -71,22 +70,17 @@ class Update extends Action Database $dbForPlatform, Document $project, Authorization $authorization, - Event $queueForEvents, - callable $distributedLockOrFail, + Event $queueForEvents ): void { $auth = Config::getParam('auth')[$methodId] ?? []; $authKey = $auth['key'] ?? ''; - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $authKey, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); + $auths[$authKey] = $enabled; - $auths = $project->getAttribute('auths', []); - $auths[$authKey] = $enabled; - - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); $queueForEvents->setParam('methodId', $methodId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php index 8ab0653df3..f4002c60ef 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php @@ -59,7 +59,6 @@ class Create extends Action ->inject('project') ->inject('dbForPlatform') ->inject('authorization') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -71,8 +70,21 @@ class Create extends Action Document $project, Database $dbForPlatform, Authorization $authorization, - callable $distributedLockOrFail, ) { + $auths = $project->getAttribute('auths', []); + + $mockNumbers = $auths['mockNumbers'] ?? []; + + if (\count($mockNumbers) >= APP_LIMIT_COUNT) { + throw new Exception(Exception::MOCK_NUMBER_LIMIT_EXCEEDED); + } + + foreach ($mockNumbers as $mockNumber) { + if ($mockNumber['phone'] === $number) { + throw new Exception(Exception::MOCK_NUMBER_ALREADY_EXISTS); + } + } + // Set to now date $mockNumber = [ 'phone' => $number, @@ -81,29 +93,14 @@ class Create extends Action '$updatedAt' => DateTime::now(), ]; - $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $mockNumber, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $mockNumbers[] = $mockNumber; + $auths['mockNumbers'] = $mockNumbers; - $auths = $project->getAttribute('auths', []); - $mockNumbers = $auths['mockNumbers'] ?? []; + $updates = new Document([ + 'auths' => $auths, + ]); - if (\count($mockNumbers) >= APP_LIMIT_COUNT) { - throw new Exception(Exception::MOCK_NUMBER_LIMIT_EXCEEDED); - } - - foreach ($mockNumbers as $existing) { - if ($existing['phone'] === $number) { - throw new Exception(Exception::MOCK_NUMBER_ALREADY_EXISTS); - } - } - - $mockNumbers[] = $mockNumber; - $auths['mockNumbers'] = $mockNumbers; - - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php index bbc534fdf8..0fb23e1764 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php @@ -58,7 +58,6 @@ class Delete extends Action ->inject('project') ->inject('dbForPlatform') ->inject('authorization') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -69,33 +68,33 @@ class Delete extends Action Document $project, Database $dbForPlatform, Authorization $authorization, - callable $distributedLockOrFail, ) { - $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); - $auths = $project->getAttribute('auths', []); - $mockNumbers = $auths['mockNumbers'] ?? []; + $mockNumbers = $auths['mockNumbers'] ?? []; - $mockNumberIndex = null; - foreach ($mockNumbers as $index => $mock) { - if ($mock['phone'] === $number) { - $mockNumberIndex = $index; - break; - } + $mockNumberIndex = null; + foreach ($mockNumbers as $index => $mock) { + if ($mock['phone'] === $number) { + $mockNumberIndex = $index; + break; } + } - if (\is_null($mockNumberIndex)) { - throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); - } + if (\is_null($mockNumberIndex)) { + throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); + } - unset($mockNumbers[$mockNumberIndex]); - $auths['mockNumbers'] = array_values($mockNumbers); + unset($mockNumbers[$mockNumberIndex]); + $mockNumbers = array_values($mockNumbers); - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $auths['mockNumbers'] = $mockNumbers; + + $updates = new Document([ + 'auths' => $auths, + ]); + + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php index a492d7c7bd..48b90a1b97 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php @@ -59,7 +59,6 @@ class Update extends Action ->inject('project') ->inject('dbForPlatform') ->inject('authorization') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -71,41 +70,38 @@ class Update extends Action Document $project, Database $dbForPlatform, Authorization $authorization, - callable $distributedLockOrFail, ) { - $mockNumber = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $number, $otp, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); - $auths = $project->getAttribute('auths', []); - $mockNumbers = $auths['mockNumbers'] ?? []; + $mockNumbers = $auths['mockNumbers'] ?? []; - $mockNumberIndex = null; - foreach ($mockNumbers as $index => $mock) { - if ($mock['phone'] === $number) { - $mockNumberIndex = $index; - break; - } + $mockNumberIndex = null; + foreach ($mockNumbers as $index => $mock) { + if ($mock['phone'] === $number) { + $mockNumberIndex = $index; + break; } + } - if (\is_null($mockNumberIndex)) { - throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); - } + if (\is_null($mockNumberIndex)) { + throw new Exception(Exception::MOCK_NUMBER_NOT_FOUND); + } - $mockNumbers[$mockNumberIndex]['otp'] = $otp; - $mockNumbers[$mockNumberIndex]['$updatedAt'] = DateTime::now(); - $auths['mockNumbers'] = $mockNumbers; + $mockNumbers[$mockNumberIndex]['otp'] = $otp; + $mockNumbers[$mockNumberIndex]['$updatedAt'] = DateTime::now(); - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); + $auths['mockNumbers'] = $mockNumbers; - return $mockNumbers[$mockNumberIndex]; - }); + $updates = new Document([ + 'auths' => $auths, + ]); + + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents->setParam('number', $number); $response ->setStatusCode(Response::STATUS_CODE_OK) - ->dynamic(new Document($mockNumber), Response::MODEL_MOCK_NUMBER); + ->dynamic(new Document($mockNumbers[$mockNumberIndex]), Response::MODEL_MOCK_NUMBER); } } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index a912ee48a6..c947ff225a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -60,7 +60,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -75,33 +74,30 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $userId, $userEmail, $userPhone, $userName, $userMFA, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); - $auths = $project->getAttribute('auths', []); + if ($userId !== null) { + $auths['membershipsUserId'] = $userId; + } + if ($userEmail !== null) { + $auths['membershipsUserEmail'] = $userEmail; + } + if ($userPhone !== null) { + $auths['membershipsUserPhone'] = $userPhone; + } + if ($userName !== null) { + $auths['membershipsUserName'] = $userName; + } + if ($userMFA !== null) { + $auths['membershipsMfa'] = $userMFA; + } - if ($userId !== null) { - $auths['membershipsUserId'] = $userId; - } - if ($userEmail !== null) { - $auths['membershipsUserEmail'] = $userEmail; - } - if ($userPhone !== null) { - $auths['membershipsUserPhone'] = $userPhone; - } - if ($userName !== null) { - $auths['membershipsUserName'] = $userName; - } - if ($userMFA !== null) { - $auths['membershipsMfa'] = $userMFA; - } + $updates = new Document([ + 'auths' => $auths, + ]); - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php index 9cb310257e..e2c678abb6 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php @@ -56,7 +56,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -67,18 +66,15 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); + $auths['passwordDictionary'] = $enabled; - $auths = $project->getAttribute('auths', []); - $auths['passwordDictionary'] = $enabled; + $updates = new Document([ + 'auths' => $auths, + ]); - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php index cfff58c8f0..a8ae81caff 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php @@ -59,7 +59,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -70,18 +69,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); - $auths = $project->getAttribute('auths', []); - $auths['passwordHistory'] = \is_null($total) ? 0 : $total; + if (\is_null($total)) { + $auths['passwordHistory'] = 0; + } else { + $auths['passwordHistory'] = $total; + } - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $updates = new Document([ + 'auths' => $auths, + ]); + + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php index 580b04754b..9db7cf0549 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php @@ -57,7 +57,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -68,18 +67,15 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); + $auths['personalDataCheck'] = $enabled; - $auths = $project->getAttribute('auths', []); - $auths['personalDataCheck'] = $enabled; + $updates = new Document([ + 'auths' => $auths, + ]); - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php index 8f9f0a4c48..22b7a44b04 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php @@ -56,7 +56,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -67,18 +66,15 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); + $auths['sessionAlerts'] = $enabled; - $auths = $project->getAttribute('auths', []); - $auths['sessionAlerts'] = $enabled; + $updates = new Document([ + 'auths' => $auths, + ]); - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php index c8111b5563..ba72c93a6f 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php @@ -56,7 +56,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -67,18 +66,15 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $duration, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); + $auths['duration'] = $duration; - $auths = $project->getAttribute('auths', []); - $auths['duration'] = $duration; + $updates = new Document([ + 'auths' => $auths, + ]); - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php index e10c0d4081..8f8a959959 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php @@ -56,7 +56,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -67,18 +66,15 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); + $auths['invalidateSessions'] = $enabled; - $auths = $project->getAttribute('auths', []); - $auths['invalidateSessions'] = $enabled; + $updates = new Document([ + 'auths' => $auths, + ]); - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php index b111534430..382ed6f0d9 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php @@ -57,7 +57,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -68,18 +67,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); - $auths = $project->getAttribute('auths', []); - $auths['maxSessions'] = \is_null($total) ? 0 : $total; + if (\is_null($total)) { + $auths['maxSessions'] = 0; + } else { + $auths['maxSessions'] = $total; + } - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $updates = new Document([ + 'auths' => $auths, + ]); + + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php index c59a17b61f..9129b81250 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php @@ -57,7 +57,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -68,18 +67,20 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $total, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $auths = $project->getAttribute('auths', []); - $auths = $project->getAttribute('auths', []); - $auths['limit'] = \is_null($total) ? 0 : $total; + if (\is_null($total)) { + $auths['limit'] = 0; + } else { + $auths['limit'] = $total; + } - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'auths' => $auths, - ]))); - }); + $updates = new Document([ + 'auths' => $auths, + ]); + + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php index 0f3174b143..ad5691c1e0 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php @@ -60,7 +60,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -72,18 +71,13 @@ class Update extends Action Document $project, Authorization $authorization, Event $queueForEvents, - callable $distributedLockOrFail, ): void { - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $protocolId, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $protocols = $project->getAttribute('apis', []); + $protocols[$protocolId] = $enabled; - $protocols = $project->getAttribute('apis', []); - $protocols[$protocolId] = $enabled; - - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'apis' => $protocols, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'apis' => $protocols, + ]))); $queueForEvents->setParam('protocolId', $protocolId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index b8e3c6e09f..97e723f52c 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -72,7 +72,6 @@ class Update extends Action ->inject('dbForPlatform') ->inject('project') ->inject('authorization') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -91,101 +90,83 @@ class Update extends Action Response $response, Database $dbForPlatform, Document $project, - Authorization $authorization, - callable $distributedLockOrFail, + Authorization $authorization ): void { - $inputs = [ - 'host' => $host, - 'port' => $port, - 'username' => $username, - 'password' => $password, - 'senderEmail' => $senderEmail, - 'senderName' => $senderName, - 'replyToEmail' => $replyToEmail, - 'replyToName' => $replyToName, - 'secure' => $secure, - 'enabled' => $enabled, - ]; + // Fetch current configuration + $smtp = $project->getAttribute('smtp', []); - // The SMTP test (PHPMailer SmtpConnect with Timeout=5) runs inside the - // lock so two concurrent SMTP updates don't validate against the same - // baseline and overwrite each other's secrets. The 10s default lock - // TTL covers the worst-case 5s connection probe with margin. - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $inputs, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + // Apply changes + $keys = ['host', 'port', 'username', 'password', 'senderEmail', 'senderName', 'replyToEmail', 'replyToName', 'secure', 'enabled']; + foreach ($keys as $key) { + if (!\is_null(${$key})) { + $smtp[$key] = ${$key}; + } + } - // Fetch current configuration - $smtp = $project->getAttribute('smtp', []); + // Backwards compatibility + $smtp['replyToEmail'] = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? ''; - // Apply changes - foreach ($inputs as $key => $value) { - if (!\is_null($value)) { - $smtp[$key] = $value; + if (($smtp['enabled'] ?? false) === true) { + // Ensure required fields are set + $requiredKeys = ['host', 'port', 'senderEmail']; + foreach ($requiredKeys as $key) { + if (empty($smtp[$key])) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); } } + } - // Backwards compatibility - $smtp['replyToEmail'] = $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? ''; + // Validate SMTP credentials + // Validate when the caller is explicitly enabling or hasn't expressed a preference + // (so a credentials-only PATCH can auto-enable). Skip only when the caller is + // explicitly keeping/turning SMTP off. + if (\is_null($enabled) || $enabled === true) { + $mail = new PHPMailer(true); + $mail->isSMTP(); - if (($smtp['enabled'] ?? false) === true) { - // Ensure required fields are set - $requiredKeys = ['host', 'port', 'senderEmail']; - foreach ($requiredKeys as $key) { - if (empty($smtp[$key])) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); - } - } + $mail->Host = $smtp['host'] ?? ''; + $mail->Port = $smtp['port'] ?? ''; + $mail->SMTPSecure = $smtp['secure'] ?? ''; + $mail->setFrom($smtp['senderEmail'], $smtp['senderName'] ?? ''); + + if (!empty($smtp['username'] ?? '')) { + $mail->SMTPAuth = true; + $mail->Username = $smtp['username']; + $mail->Password = $smtp['password'] ?? ''; } - // Validate SMTP credentials - // Validate when the caller is explicitly enabling or hasn't expressed a preference - // (so a credentials-only PATCH can auto-enable). Skip only when the caller is - // explicitly keeping/turning SMTP off. - if (\is_null($enabled) || $enabled === true) { - $mail = new PHPMailer(true); - $mail->isSMTP(); - - $mail->Host = $smtp['host'] ?? ''; - $mail->Port = $smtp['port'] ?? ''; - $mail->SMTPSecure = $smtp['secure'] ?? ''; - $mail->setFrom($smtp['senderEmail'], $smtp['senderName'] ?? ''); - - if (!empty($smtp['username'] ?? '')) { - $mail->SMTPAuth = true; - $mail->Username = $smtp['username']; - $mail->Password = $smtp['password'] ?? ''; - } - - if (!empty($smtp['replyToEmail'] ?? '')) { - $mail->addReplyTo($smtp['replyToEmail'], $smtp['replyToName'] ?? ''); - } - - $mail->SMTPAutoTLS = false; - $mail->Timeout = 5; - - try { - $valid = $mail->SmtpConnect(); - - if (!$valid) { - throw new \Exception('Connection is not valid.'); - } - - // Auto-enable if configuration is valid - // Dont do this if specifically request to mark disabled - if (\is_null($enabled)) { - $smtp['enabled'] = true; - } - } catch (Throwable $error) { - if (($smtp['enabled'] ?? null) === true) { - throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, $error->getMessage()); - } - } + if (!empty($smtp['replyToEmail'] ?? '')) { + $mail->addReplyTo($smtp['replyToEmail'], $smtp['replyToName'] ?? ''); } - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'smtp' => $smtp, - ]))); - }); + $mail->SMTPAutoTLS = false; + $mail->Timeout = 5; + + try { + $valid = $mail->SmtpConnect(); + + if (!$valid) { + throw new \Exception('Connection is not valid.'); + } + + // Auto-enable if configuration is valid + // Dont do this if specifically request to mark disabled + if (\is_null($enabled)) { + $smtp['enabled'] = true; + } + } catch (Throwable $error) { + if (($smtp['enabled'] ?? null) === true) { + throw new Exception(Exception::PROJECT_SMTP_CONFIG_INVALID, $error->getMessage()); + } + } + } + + // Save configuration + $updates = new Document([ + 'smtp' => $smtp, + ]); + + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index 1126da8897..7aab6f5ad0 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -60,7 +60,6 @@ class Update extends Action ->inject('project') ->inject('authorization') ->inject('queueForEvents') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -71,26 +70,14 @@ class Update extends Action Database $dbForPlatform, Document $project, Authorization $authorization, - Event $queueForEvents, - callable $distributedLockOrFail, + Event $queueForEvents ): void { - // The services map is a JSON object on the project document. Two - // concurrent service toggles read the same baseline, each set their - // own key, and the second updateDocument() overwrites the first — - // silent lost-update on a sparse write. Lock the project doc for - // the read-modify-write window; re-read inside the lock so the - // baseline reflects any update that landed between request init - // and lock acquisition. - $project = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $serviceId, $enabled, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + $services = $project->getAttribute('services', []); + $services[$serviceId] = $enabled; - $services = $project->getAttribute('services', []); - $services[$serviceId] = $enabled; - - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'services' => $services, - ]))); - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'services' => $services, + ]))); $queueForEvents->setParam('serviceId', $serviceId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php index ed1f7d8f7f..ef93abf683 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php @@ -69,7 +69,6 @@ class Update extends Action ->inject('dbForPlatform') ->inject('authorization') ->inject('project') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } @@ -87,61 +86,47 @@ class Update extends Action Database $dbForPlatform, Authorization $authorization, Document $project, - callable $distributedLockOrFail, ) { $locale = $locale ?: System::getEnv('_APP_LOCALE', 'en'); - $inputs = [ - 'senderName' => $senderName, - 'senderEmail' => $senderEmail, - 'replyToEmail' => $replyToEmail, - 'replyToName' => $replyToName, - 'message' => $message, - 'subject' => $subject, - ]; + // Prevent template update if custom SMTP is not configured + $smtp = $project->getAttribute('smtp', []); + if (($smtp['enabled'] ?? false) !== true) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP must be enabled on the project to configure custom email templates.'); + } - $template = $distributedLockOrFail("lock:platform:projects:{$project->getId()}", function () use ($project, $templateId, $locale, $inputs, $dbForPlatform, $authorization) { - $project = $authorization->skip(fn () => $dbForPlatform->getDocument('projects', $project->getId())); + // Fetch current configuration + $templates = $project->getAttribute('templates', []); + $template = $templates['email.' . $templateId . '-' . $locale] ?? []; - // Prevent template update if custom SMTP is not configured - $smtp = $project->getAttribute('smtp', []); - if (($smtp['enabled'] ?? false) !== true) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'SMTP must be enabled on the project to configure custom email templates.'); + // Apply changes + $keys = ['senderName', 'senderEmail', 'replyToEmail', 'replyToName', 'message', 'subject']; + foreach ($keys as $key) { + if (!\is_null(${$key})) { + $template[$key] = ${$key}; } + } - // Fetch current configuration - $templates = $project->getAttribute('templates', []); - $template = $templates['email.' . $templateId . '-' . $locale] ?? []; + // Backwards compatibility + if (!\is_null($template['replyTo'] ?? null)) { + $template['replyToEmail'] = $template['replyToEmail'] ?? $template['replyTo'] ?? ''; + } - // Apply changes - foreach ($inputs as $key => $value) { - if (!\is_null($value)) { - $template[$key] = $value; - } + // Ensure required fields are set + $requiredKeys = ['subject', 'message']; + foreach ($requiredKeys as $key) { + if (empty($template[$key])) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); } + } - // Backwards compatibility - if (!\is_null($template['replyTo'] ?? null)) { - $template['replyToEmail'] = $template['replyToEmail'] ?? $template['replyTo'] ?? ''; - } + // Save configuration + $templates['email.' . $templateId . '-' . $locale] = $template; + $updates = new Document([ + 'templates' => $templates, + ]); - // Ensure required fields are set - $requiredKeys = ['subject', 'message']; - foreach ($requiredKeys as $key) { - if (empty($template[$key])) { - throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Param "' . $key . '" is not optional.'); - } - } - - // Save configuration - $templates['email.' . $templateId . '-' . $locale] = $template; - - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'templates' => $templates, - ]))); - - return $template; - }); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); $queueForEvents->setParam('templateId', $templateId); 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 25286a2227..ab92d1a15f 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Team/Update.php @@ -55,37 +55,29 @@ class Update extends Action ->param('teamId', '', new UID(), 'Team ID of the team to transfer project to.') ->inject('response') ->inject('dbForPlatform') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } - public function action(string $projectId, string $teamId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail) + public function action(string $projectId, string $teamId, Response $response, Database $dbForPlatform) { - // Lock around the project doc RMW. Cascade fan-out to installations, - // repositories and vcsComments runs after the lock is released — - // those write to separate collections, not the project doc. - [$project, $permissions] = $distributedLockOrFail("lock:platform:projects:{$projectId}", function () use ($projectId, $teamId, $dbForPlatform) { - $project = $dbForPlatform->getDocument('projects', $projectId); - $team = $dbForPlatform->getDocument('teams', $teamId); + $project = $dbForPlatform->getDocument('projects', $projectId); + $team = $dbForPlatform->getDocument('teams', $teamId); - if ($project->isEmpty()) { - throw new Exception(Exception::PROJECT_NOT_FOUND); - } + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } - if ($team->isEmpty()) { - throw new Exception(Exception::TEAM_NOT_FOUND); - } + if ($team->isEmpty()) { + throw new Exception(Exception::TEAM_NOT_FOUND); + } - $permissions = $this->getPermissions($teamId, $projectId); + $permissions = $this->getPermissions($teamId, $projectId); - $project = $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'teamId' => $teamId, - 'teamInternalId' => $team->getSequence(), - '$permissions' => $permissions, - ])); - - return [$project, $permissions]; - }); + $project = $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'teamId' => $teamId, + 'teamInternalId' => $team->getSequence(), + '$permissions' => $permissions, + ])); $installations = $dbForPlatform->find('installations', [ Query::equal('projectInternalId', [$project->getSequence()]), diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php index 4b79b37bfa..29c26b33ea 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php @@ -65,36 +65,29 @@ class Update extends Action ->param('legalTaxId', '', new Text(256), 'Project legal tax ID. Max length: 256 chars.', true) ->inject('response') ->inject('dbForPlatform') - ->inject('distributedLockOrFail') ->callback($this->action(...)); } - public function action(string $projectId, string $name, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForPlatform, callable $distributedLockOrFail) + public function action(string $projectId, string $name, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForPlatform) { - // Re-fetch and write the full project doc inside the lock. This is the - // worst RMW window in the projects API — the endpoint passes the entire - // document back to updateDocument(), so a concurrent write to *any* - // attribute (services, auths, smtp, ...) would be silently overwritten. - $project = $distributedLockOrFail("lock:platform:projects:{$projectId}", function () use ($projectId, $name, $description, $logo, $url, $legalName, $legalCountry, $legalState, $legalCity, $legalAddress, $legalTaxId, $dbForPlatform) { - $project = $dbForPlatform->getDocument('projects', $projectId); + $project = $dbForPlatform->getDocument('projects', $projectId); - if ($project->isEmpty()) { - throw new Exception(Exception::PROJECT_NOT_FOUND); - } + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } - return $dbForPlatform->updateDocument('projects', $project->getId(), $project - ->setAttribute('name', $name) - ->setAttribute('description', $description) - ->setAttribute('logo', $logo) - ->setAttribute('url', $url) - ->setAttribute('legalName', $legalName) - ->setAttribute('legalCountry', $legalCountry) - ->setAttribute('legalState', $legalState) - ->setAttribute('legalCity', $legalCity) - ->setAttribute('legalAddress', $legalAddress) - ->setAttribute('legalTaxId', $legalTaxId) - ->setAttribute('search', implode(' ', [$projectId, $name]))); - }); + $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project + ->setAttribute('name', $name) + ->setAttribute('description', $description) + ->setAttribute('logo', $logo) + ->setAttribute('url', $url) + ->setAttribute('legalName', $legalName) + ->setAttribute('legalCountry', $legalCountry) + ->setAttribute('legalState', $legalState) + ->setAttribute('legalCity', $legalCity) + ->setAttribute('legalAddress', $legalAddress) + ->setAttribute('legalTaxId', $legalTaxId) + ->setAttribute('search', implode(' ', [$projectId, $name]))); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 84c937d2d1..4358058fe3 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -211,13 +211,7 @@ class Client } } - // CURLOPT_PATH_AS_IS isn't supported by Swoole's emulated cURL when the - // SWOOLE_HOOK_CURL coroutine hook is active. Skip it in that case so - // tests that need real parallel HTTP (Swoole\Coroutine\run + cURL hook) - // don't fatal-error here. Native (non-hooked) cURL keeps the option. - if (! \extension_loaded('swoole') || ! (\Swoole\Runtime::getHookFlags() & SWOOLE_HOOK_CURL)) { - curl_setopt($ch, CURLOPT_PATH_AS_IS, 1); - } + curl_setopt($ch, CURLOPT_PATH_AS_IS, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $followRedirects); @@ -243,12 +237,9 @@ class Client if ($method === self::METHOD_HEAD) { curl_setopt($ch, CURLOPT_NOBODY, true); // This is crucial for HEAD requests curl_setopt($ch, CURLOPT_HEADER, false); + } else { + curl_setopt($ch, CURLOPT_NOBODY, false); } - // Note: explicit CURLOPT_NOBODY=false on non-HEAD requests is redundant - // (false is cURL's default) and actively breaks Swoole's emulated cURL - // on PATCH-with-body — Swoole strips the body and the request reaches - // the server as a method-without-body, hitting the framework's 404 - // fallback. Just skip the redundant set. if ($method != self::METHOD_GET && $method != self::METHOD_HEAD) { curl_setopt($ch, CURLOPT_POSTFIELDS, $query); diff --git a/tests/e2e/Services/Project/ServicesBase.php b/tests/e2e/Services/Project/ServicesBase.php index c8c7bd173f..b5f94f8181 100644 --- a/tests/e2e/Services/Project/ServicesBase.php +++ b/tests/e2e/Services/Project/ServicesBase.php @@ -266,94 +266,6 @@ trait ServicesBase $this->assertSame(true, $response['body']['serviceStatusForTeams']); } - /** - * Concurrency test for the distributed-lock pilot on `updateProjectService`. - * - * Without locking, two concurrent toggles to different services on the - * same project both read the same baseline `services` map, each set their - * own key, and the second sparse `updateDocument()` overwrites the first - * — silent lost-update. - * - * The test fires N parallel PATCH calls via Swoole coroutines (with the - * SWOOLE_HOOK_CURL runtime hook enabled so the test Client's cURL calls - * yield to the scheduler). After all coroutines complete the project is - * refetched and the count of enabled services is compared against the - * count of HTTP 200 responses. - * - * To verify the test catches the bug: - * - `_APP_LOCKING_ENABLED=enabled` → must pass - * - `_APP_LOCKING_ENABLED=disabled` → must FAIL (lost updates) - */ - public function testConcurrentTogglesAllPersist(): void - { - $services = ['teams', 'storage', 'functions', 'sites', 'messaging']; - - // Baseline: disable everything so the toggle direction is unambiguous. - // Done outside the coroutine context so it stays sequential and the - // resulting project state is a clean known-zero before the race. - foreach ($services as $service) { - $this->updateServiceStatus($service, false); - } - - // Enable Swoole's cURL hook so the test Client's HTTP calls yield - // to the scheduler and the foreach below actually runs in parallel. - // Without this, coroutines serialize on cURL and the negative-case - // run (locking disabled) would falsely pass. - \Swoole\Runtime::enableCoroutine(\SWOOLE_HOOK_CURL); - - $results = []; - try { - \Swoole\Coroutine\run(function () use ($services, &$results): void { - foreach ($services as $service) { - \Swoole\Coroutine::create(function () use ($service, &$results): void { - $response = $this->updateServiceStatus($service, true); - $results[$service] = $response['headers']['status-code']; - }); - } - }); - } finally { - // SWOOLE_HOOK_NONE isn't defined in some Swoole builds; pass 0 - // (the integer value of "no hooks") to disable any hooks this - // test enabled so subsequent tests run with native cURL. - \Swoole\Runtime::enableCoroutine(0); - } - - $successCount = count(array_filter($results, fn ($code) => $code === 200)); - - // Refetch the project and count which of the targeted services ended up - // enabled. The endpoint returns serviceStatusFor{Service} keys. - $project = $this->client->call(Client::METHOD_GET, '/projects/' . $this->getProject()['$id'], [ - 'content-type' => 'application/json', - 'x-appwrite-project' => 'console', - 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ]); - - $enabledCount = 0; - foreach ($services as $service) { - $key = 'serviceStatusFor' . ucfirst($service); - if (($project['body'][$key] ?? false) === true) { - $enabledCount++; - } - } - - $this->assertGreaterThan(0, $successCount, 'At least one concurrent toggle should succeed'); - $this->assertSame( - $successCount, - $enabledCount, - sprintf( - 'Each successful concurrent toggle must persist. successCount=%d enabledCount=%d (lost-update detected — distributed lock not effective)', - $successCount, - $enabledCount, - ), - ); - - // Cleanup: leave all targeted services enabled so subsequent tests - // see a known-good baseline. - foreach ($services as $service) { - $this->updateServiceStatus($service, true); - } - } - // Helpers protected function updateServiceStatus(string $serviceId, bool $enabled, bool $authenticated = true): mixed From b15457bccad6facf63fb43cb27dcdad28aaf2d7e Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 05:50:37 +0100 Subject: [PATCH 010/151] style: trim verbose comments on lock factories and call sites --- app/controllers/general.php | 3 -- app/controllers/shared/api.php | 3 -- app/init/resources/request.php | 67 ++++------------------------------ 3 files changed, 8 insertions(+), 65 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index aa4134614c..0fde400b89 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -136,9 +136,6 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S if (!$project->isEmpty() && $project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - // Skip-on-contention: every concurrent router request would write - // the same throttled timestamp, so losing the race is correct — - // the winning pod's update covers ours. $distributedLock('lock:platform:projects:' . $project->getId(), function () use ($dbForPlatform, $project, $authorization) { $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'accessedAt' => DateTime::now() diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index b07eec1a99..0ce1b6ca33 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -250,9 +250,6 @@ Http::init() } if (! $updates->isEmpty()) { - // Serialize concurrent per-request writes to this key across API nodes. - // Skip on contention is safe: the winner applies the same idempotent update; - // if this node observed a new SDK the other didn't, the next request catches up. $distributedLock('lock:platform:keys:' . $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $apiKey, $project, $user, $team) { $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 6d5663cdae..71af68b4b2 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -76,25 +76,8 @@ return function (Container $container): void { return $register->get('logger'); }, ['register']); - /** - * Push lock-side errors to the configured logger (Sentry/Raygun/AppSignal/etc.) - * by mutating the per-request `Log` object — same pattern as - * Embeddings/Text/Create.php and the http.php request-end error handler. - * - * Rate limited per pod via a static bucket so a sustained backend outage - * doesn't flood the logger. At most one push per 60s per (action, target) - * combo. Across a fleet of N pods this caps at N events/min, well within - * Sentry's own dedup tolerance. - * - * Only "real" errors are reported here: - * - backend_error: Redis/Dragonfly unreachable - * - release_error: lock release failed (TTL expired or backend dropped) - * - * Skipped on purpose: contention 409s (normal user-facing concurrency), - * skip-on-contention events (idempotent fan-out by design), acquire retry - * conflicts (internal loop), destructor cleanups (have an expected - * baseline rate; aggregate via the `lock.attempts` counter instead). - */ + // Rate-limited to one push per 60s per (action, target) so a sustained + // backend outage doesn't flood Sentry across the pod fleet. $lockErrorReporter = function (Log $log, ?Logger $logger, string $action, string $key, string $target, Throwable $e): void { static $lastReportAt = []; @@ -122,8 +105,7 @@ return function (Container $container): void { : Log::ENVIRONMENT_STAGING); $log->addTag('lock.target', $target); - // Strip the trailing document ID from the key so log aggregators don't - // see unbounded cardinality; the {target} attribute already covers slicing. + // Strip trailing document ID to keep aggregator cardinality bounded. $log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); $log->addTag('code', $e->getCode()); @@ -134,33 +116,17 @@ return function (Container $container): void { try { $logger->addLog($log); } catch (Throwable) { - // best-effort; don't let logging failures break fail-open } }; - // Extract the collection segment ("keys" / "projects" / "users") from keys - // of the form "lock:platform:{target}:{id}" so metrics can slice by target. $lockTargetOf = function (string $key): string { $parts = explode(':', $key, 4); return $parts[2] ?? 'unknown'; }; /** - * Distributed-lock factory: skip-on-contention variant. - * - * For idempotent writes where losing the race is correct (e.g., per-request - * `accessedAt` updates from N pods all writing the same value). On contention, - * the callback is silently skipped — another pod is doing the same work. - * - * Behavior: - * - Non-blocking acquire (one attempt). On conflict, skip and return. - * - Fail-open: if Redis is unreachable, run the callback unlocked + warn. - * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. - * - * Returns void — the caller can't distinguish "acquired and ran" from "skipped". - * - * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, skipped, - * backend_error, release_error}. + * Skip-on-contention. For idempotent writes where losing the race is correct + * (e.g., the winning pod's update covers ours). Fail-open on backend error. */ $container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry, Log $log, ?Logger $logger) use ($lockTargetOf, $lockErrorReporter) { $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; @@ -205,21 +171,8 @@ return function (Container $container): void { }, ['redis', 'telemetry', 'log', 'logger']); /** - * Distributed-lock factory: 409-on-contention variant. - * - * For explicit user-write endpoints where read-modify-write on shared mutable - * state must NOT silently drop a request. On contention, throws - * `Exception::GENERAL_RESOURCE_LOCKED` (HTTP 409) so the client retries. - * - * Behavior: - * - Blocking acquire with short timeout (default 3s). - * - On timeout, throws `GENERAL_RESOURCE_LOCKED`. - * - Fail-open: backend unreachable runs the callback unlocked + warning. - * - Kill switch: `_APP_LOCKING_ENABLED=disabled` runs the callback unlocked. - * - Returns the callback's return value so callers can use the result. - * - * Metric: `lock.attempts{outcome,target}` where outcome ∈ {acquired, contended, - * backend_error, release_error}. + * Block-then-409 on contention. For read-modify-write on shared mutable state + * where silently dropping a request is wrong. Fail-open on backend error. */ $container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $telemetry, Log $log, ?Logger $logger) use ($lockTargetOf, $lockErrorReporter) { $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; @@ -245,11 +198,7 @@ return function (Container $container): void { if (! $acquired) { $attempts->add(1, ['outcome' => 'contended', 'target' => $target]); - // Don't pass a custom message — the catalog message in - // app/config/errors.php is reused so we don't leak the internal - // lock key (which embeds collection name and document id) into a - // user-facing 409 response. The telemetry attribute already - // carries the target collection for operator-side observability. + // No custom message — the lock key embeds collection + document id. throw new Exception(Exception::GENERAL_RESOURCE_LOCKED); } From ce15eeb7229dff70114951c5c5bf9594b82e042f Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 07:17:04 +0100 Subject: [PATCH 011/151] refactor: introduce Lock facade for platform-DB lock sites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extracts the lock-key format and the lock+auth-skip+sparse-update pattern into Appwrite\Locking\Lock with three methods: - set(collection, id, attribute=accessedAt, value=null) — throttled single-attribute write - run(collection, id, fn) — generic skip-on-contention - runOrFail(collection, id, fn) — block-then-409 for the deferred lost-update follow-up Migrates the 4 call sites (router projects accessedAt + 3 in shared/api) off the raw $distributedLock callable. Raw factories stay as escape hatches for non-platform key shapes. --- app/controllers/general.php | 33 ++++++++---------- app/controllers/shared/api.php | 19 ++++------ app/init/resources/request.php | 10 ++++++ src/Appwrite/Locking/Lock.php | 63 ++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 31 deletions(-) create mode 100644 src/Appwrite/Locking/Lock.php diff --git a/app/controllers/general.php b/app/controllers/general.php index 0fde400b89..9381843b64 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -11,6 +11,7 @@ use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Event\Publisher\Certificate; use Appwrite\Extend\Exception as AppwriteException; +use Appwrite\Locking\Lock; use Appwrite\Network\Cors; use Appwrite\Platform\Appwrite; use Appwrite\SDK\Method; @@ -67,7 +68,7 @@ use Utopia\Validator\Text; Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) +function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount, Lock $lock) { $host = $request->getHostname(); if (!empty($previewHostname)) { @@ -136,11 +137,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S if (!$project->isEmpty() && $project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $distributedLock('lock:platform:projects:' . $project->getId(), function () use ($dbForPlatform, $project, $authorization) { - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'accessedAt' => DateTime::now() - ]))); - }); + $lock->set('projects', $project->getId()); } /** @@ -849,8 +846,8 @@ Http::init() ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->inject('distributedLock') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { + ->inject('lock') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, Lock $lock) { /* * Appwrite Router */ @@ -858,7 +855,7 @@ Http::init() $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!\in_array($hostname, $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $lock)) { $utopia->getRoute()?->label('router', true); } } @@ -1143,15 +1140,15 @@ Http::options() ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->inject('distributedLock') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { + ->inject('lock') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, Lock $lock) { /* * Appwrite Router */ $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $lock)) { $utopia->getRoute()?->label('router', true); } } @@ -1546,14 +1543,14 @@ Http::get('/robots.txt') ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->inject('distributedLock') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { + ->inject('lock') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, Lock $lock) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $lock)) { $utopia->getRoute()?->label('router', true); } } @@ -1581,14 +1578,14 @@ Http::get('/humans.txt') ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->inject('distributedLock') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, callable $distributedLock) { + ->inject('lock') + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount, Lock $lock) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $distributedLock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount, $lock)) { $utopia->getRoute()?->label('router', true); } } diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 0ce1b6ca33..3c679ce6ec 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -20,6 +20,7 @@ use Appwrite\Event\Webhook; use Appwrite\Extend\Exception; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Functions\EventProcessor; +use Appwrite\Locking\Lock; use Appwrite\SDK\Method; use Appwrite\Usage\Context; use Appwrite\Utopia\Database\Documents\User; @@ -100,8 +101,8 @@ Http::init() ->inject('team') ->inject('apiKey') ->inject('authorization') - ->inject('distributedLock') - ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, callable $distributedLock) { + ->inject('lock') + ->action(function (Http $utopia, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, Lock $lock) { $route = $utopia->getRoute(); if ($route === null) { throw new AppwriteException(AppwriteException::GENERAL_ROUTE_NOT_FOUND); @@ -250,7 +251,7 @@ Http::init() } if (! $updates->isEmpty()) { - $distributedLock('lock:platform:keys:' . $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $apiKey, $project, $user, $team) { + $lock->run('keys', $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $apiKey, $project, $user, $team) { $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); if (! empty($apiKey->getProjectId())) { @@ -391,11 +392,7 @@ Http::init() if ($project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $distributedLock('lock:platform:projects:' . $project->getId(), function () use ($authorization, $dbForPlatform, $project) { - $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'accessedAt' => DateTime::now() - ]))); - }); + $lock->set('projects', $project->getId()); } } @@ -412,11 +409,7 @@ Http::init() 'accessedAt' => $user->getAttribute('accessedAt') ])); } else { - $distributedLock('lock:platform:users:' . $user->getId(), function () use ($authorization, $dbForPlatform, $user) { - $authorization->skip(fn () => $dbForPlatform->updateDocument('users', $user->getId(), new Document([ - 'accessedAt' => $user->getAttribute('accessedAt') - ]))); - }); + $lock->set('users', $user->getId(), 'accessedAt', $user->getAttribute('accessedAt')); } } } diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 71af68b4b2..c5fafbef47 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -17,6 +17,7 @@ use Appwrite\Event\Webhook; use Appwrite\Extend\Exception; use Appwrite\Functions\EventProcessor; use Appwrite\GraphQL\Schema; +use Appwrite\Locking\Lock; use Appwrite\Network\Cors; use Appwrite\Network\Platform; use Appwrite\Network\Validator\Origin; @@ -216,6 +217,15 @@ return function (Container $container): void { }; }, ['redis', 'telemetry', 'log', 'logger']); + $container->set('lock', function (callable $distributedLock, callable $distributedLockOrFail, Database $dbForPlatform, Authorization $authorization): Lock { + return new Lock( + \Closure::fromCallable($distributedLock), + \Closure::fromCallable($distributedLockOrFail), + $dbForPlatform, + $authorization, + ); + }, ['distributedLock', 'distributedLockOrFail', 'dbForPlatform', 'authorization']); + $container->set('authorization', function () { return new Authorization(); }, []); diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php new file mode 100644 index 0000000000..ec85fe0fa6 --- /dev/null +++ b/src/Appwrite/Locking/Lock.php @@ -0,0 +1,63 @@ +skipLock)(self::key($collection, $id), function () use ($collection, $id, $attribute, $value) { + $this->authorization->skip(fn () => $this->dbForPlatform->updateDocument( + $collection, + $id, + new Document([$attribute => $value ?? DateTime::now()]) + )); + }); + } + + /** + * Skip-on-contention lock around an arbitrary callback. For idempotent + * writes that don't fit the set shape (e.g., updates with cache purge). + */ + public function run(string $collection, string $id, Closure $fn): void + { + ($this->skipLock)(self::key($collection, $id), $fn); + } + + /** + * Block-then-409 lock around an arbitrary callback. For read-modify-write + * endpoints where silently dropping a concurrent request would lose data. + */ + public function runOrFail(string $collection, string $id, Closure $fn): mixed + { + return ($this->failLock)(self::key($collection, $id), $fn); + } + + private static function key(string $collection, string $id): string + { + return "lock:platform:{$collection}:{$id}"; + } +} From e63414561206ea7b2420737ef4fe79455f24701f Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 07:41:54 +0100 Subject: [PATCH 012/151] refactor: consolidate lock implementation into Lock class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lock now uses Utopia\Lock\Distributed directly and owns the full acquire/release/telemetry/error-reporting/fail-open/kill-switch logic that previously lived in two inline DI factory closures. Adds withKey($key, $fn, $ttl, $orFail, $waitTimeout) as a generic escape hatch for non-platform key shapes (cache, queue, edge) and unusual TTL/timeout requirements. Per-attribute lock keys for set() so that an accessedAt bump and a mcpAccessedAt bump on the same projects:{id} document don't compete. Whole-document operations (run, runOrFail) keep document-level keys. Removes the standalone distributedLock and distributedLockOrFail DI factories — Lock is the single API. request.php shrinks ~150 LOC; Lock.php grows to ~190 LOC. --- app/init/resources/request.php | 153 +---------------------------- src/Appwrite/Locking/Lock.php | 169 ++++++++++++++++++++++++++++----- 2 files changed, 150 insertions(+), 172 deletions(-) diff --git a/app/init/resources/request.php b/app/init/resources/request.php index c5fafbef47..d927c1dff8 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -38,7 +38,6 @@ use Utopia\Auth\Proofs\Token; use Utopia\Auth\Store; use Utopia\Cache\Cache; use Utopia\Config\Config; -use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime as DatabaseDateTime; @@ -50,7 +49,6 @@ use Utopia\Domains\Domain; use Utopia\DSN\DSN; use Utopia\Http\Http; use Utopia\Locale\Locale; -use Utopia\Lock\Distributed as DistributedLock; use Utopia\Logger\Log; use Utopia\Logger\Logger; use Utopia\Pools\Group; @@ -77,154 +75,9 @@ return function (Container $container): void { return $register->get('logger'); }, ['register']); - // Rate-limited to one push per 60s per (action, target) so a sustained - // backend outage doesn't flood Sentry across the pod fleet. - $lockErrorReporter = function (Log $log, ?Logger $logger, string $action, string $key, string $target, Throwable $e): void { - static $lastReportAt = []; - - Console::warning("Lock {$action} for {$key}: {$e->getMessage()}"); - - if ($logger === null) { - return; - } - - $bucket = $action . ':' . $target; - $now = time(); - if (($lastReportAt[$bucket] ?? 0) + 60 > $now) { - return; - } - $lastReportAt[$bucket] = $now; - - $log->setNamespace('http'); - $log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); - $log->setVersion(APP_VERSION_STABLE); - $log->setType(Log::TYPE_WARNING); - $log->setMessage('Distributed lock ' . $action . ': ' . $e->getMessage()); - $log->setAction("lock.{$action}"); - $log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' - ? Log::ENVIRONMENT_PRODUCTION - : Log::ENVIRONMENT_STAGING); - - $log->addTag('lock.target', $target); - // Strip trailing document ID to keep aggregator cardinality bounded. - $log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); - $log->addTag('code', $e->getCode()); - - $log->addExtra('file', $e->getFile()); - $log->addExtra('line', $e->getLine()); - $log->addExtra('trace', $e->getTraceAsString()); - - try { - $logger->addLog($log); - } catch (Throwable) { - } - }; - - $lockTargetOf = function (string $key): string { - $parts = explode(':', $key, 4); - return $parts[2] ?? 'unknown'; - }; - - /** - * Skip-on-contention. For idempotent writes where losing the race is correct - * (e.g., the winning pod's update covers ours). Fail-open on backend error. - */ - $container->set('distributedLock', function (\Redis $redis, Telemetry $telemetry, Log $log, ?Logger $logger) use ($lockTargetOf, $lockErrorReporter) { - $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; - $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); - - if (! $enabled) { - return function (string $key, \Closure $fn, float $ttl = 5.0): void { - $fn(); - }; - } - - return function (string $key, \Closure $fn, float $ttl = 5.0) use ($redis, $attempts, $log, $logger, $lockTargetOf, $lockErrorReporter): void { - $target = $lockTargetOf($key); - $lock = new DistributedLock($redis, $key, (int) $ttl); - - try { - $acquired = $lock->tryAcquire(); - } catch (\RedisException $e) { - $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); - $fn(); - return; - } - - if (! $acquired) { - $attempts->add(1, ['outcome' => 'skipped', 'target' => $target]); - return; - } - - $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); - try { - $fn(); - } finally { - try { - $lock->release(); - } catch (\Throwable $e) { - $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); - } - } - }; - }, ['redis', 'telemetry', 'log', 'logger']); - - /** - * Block-then-409 on contention. For read-modify-write on shared mutable state - * where silently dropping a request is wrong. Fail-open on backend error. - */ - $container->set('distributedLockOrFail', function (\Redis $redis, Telemetry $telemetry, Log $log, ?Logger $logger) use ($lockTargetOf, $lockErrorReporter) { - $enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; - $attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); - - if (! $enabled) { - return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0): mixed { - return $fn(); - }; - } - - return function (string $key, \Closure $fn, float $ttl = 10.0, float $waitTimeout = 3.0) use ($redis, $attempts, $log, $logger, $lockTargetOf, $lockErrorReporter): mixed { - $target = $lockTargetOf($key); - $lock = new DistributedLock($redis, $key, (int) $ttl); - - try { - $acquired = $lock->acquire($waitTimeout); - } catch (\RedisException $e) { - $attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'backend_error', $key, $target, $e); - return $fn(); - } - - if (! $acquired) { - $attempts->add(1, ['outcome' => 'contended', 'target' => $target]); - // No custom message — the lock key embeds collection + document id. - throw new Exception(Exception::GENERAL_RESOURCE_LOCKED); - } - - $attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); - try { - return $fn(); - } finally { - try { - $lock->release(); - } catch (\Throwable $e) { - $attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); - $lockErrorReporter($log, $logger, 'release_error', $key, $target, $e); - } - } - }; - }, ['redis', 'telemetry', 'log', 'logger']); - - $container->set('lock', function (callable $distributedLock, callable $distributedLockOrFail, Database $dbForPlatform, Authorization $authorization): Lock { - return new Lock( - \Closure::fromCallable($distributedLock), - \Closure::fromCallable($distributedLockOrFail), - $dbForPlatform, - $authorization, - ); - }, ['distributedLock', 'distributedLockOrFail', 'dbForPlatform', 'authorization']); + $container->set('lock', function (\Redis $redis, Telemetry $telemetry, Database $dbForPlatform, Authorization $authorization, Log $log, ?Logger $logger): Lock { + return new Lock($redis, $telemetry, $dbForPlatform, $authorization, $log, $logger); + }, ['redis', 'telemetry', 'dbForPlatform', 'authorization', 'log', 'logger']); $container->set('authorization', function () { return new Authorization(); diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php index ec85fe0fa6..288b50c6ea 100644 --- a/src/Appwrite/Locking/Lock.php +++ b/src/Appwrite/Locking/Lock.php @@ -2,26 +2,46 @@ namespace Appwrite\Locking; +use Appwrite\Extend\Exception; use Closure; +use Throwable; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\Lock\Distributed as DistributedLock; +use Utopia\Logger\Log; +use Utopia\Logger\Logger; +use Utopia\System\System; +use Utopia\Telemetry\Adapter as Telemetry; final class Lock { + private readonly bool $enabled; + + private readonly mixed $attempts; + + /** @var array */ + private static array $lastReportAt = []; + public function __construct( - private readonly Closure $skipLock, - private readonly Closure $failLock, + private readonly \Redis $redis, + Telemetry $telemetry, private readonly Database $dbForPlatform, private readonly Authorization $authorization, - ) {} + private readonly Log $log, + private readonly ?Logger $logger, + ) { + $this->enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; + $this->attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); + } /** - * Throttled single-attribute write under a skip-on-contention lock with - * authorization bypass. For idempotent timestamp-style updates (accessedAt, - * mcpAccessedAt) where regional pods writing the same value would thrash - * the platform DB. + * Throttled single-attribute write under a per-attribute skip-on-contention + * lock with authorization bypass. For idempotent timestamp-style updates + * (accessedAt, mcpAccessedAt) where regional pods writing the same value + * would thrash the platform DB. */ public function set( string $collection, @@ -29,35 +49,140 @@ final class Lock string $attribute = 'accessedAt', ?string $value = null, ): void { - ($this->skipLock)(self::key($collection, $id), function () use ($collection, $id, $attribute, $value) { - $this->authorization->skip(fn () => $this->dbForPlatform->updateDocument( - $collection, - $id, - new Document([$attribute => $value ?? DateTime::now()]) - )); - }); + $this->withKey( + "lock:platform:{$collection}:{$id}:{$attribute}", + function () use ($collection, $id, $attribute, $value) { + $this->authorization->skip(fn () => $this->dbForPlatform->updateDocument( + $collection, + $id, + new Document([$attribute => $value ?? DateTime::now()]) + )); + } + ); } /** - * Skip-on-contention lock around an arbitrary callback. For idempotent - * writes that don't fit the set shape (e.g., updates with cache purge). + * Skip-on-contention lock around an arbitrary callback for a platform + * document. For idempotent multi-statement writes that don't fit `set`. */ public function run(string $collection, string $id, Closure $fn): void { - ($this->skipLock)(self::key($collection, $id), $fn); + $this->withKey("lock:platform:{$collection}:{$id}", $fn); } /** - * Block-then-409 lock around an arbitrary callback. For read-modify-write - * endpoints where silently dropping a concurrent request would lose data. + * Block-then-409 lock around an arbitrary callback for a platform document. + * For read-modify-write endpoints where silently dropping a concurrent + * request would lose user data. */ public function runOrFail(string $collection, string $id, Closure $fn): mixed { - return ($this->failLock)(self::key($collection, $id), $fn); + return $this->withKey( + "lock:platform:{$collection}:{$id}", + $fn, + ttl: 10, + orFail: true, + ); } - private static function key(string $collection, string $id): string + /** + * Generic lock primitive with full control over key, TTL, contention + * behavior, and wait timeout. Escape hatch for non-platform keys + * (cache, queue, edge) and for unusual TTL/timeout requirements. + */ + public function withKey( + string $key, + Closure $fn, + int $ttl = 5, + bool $orFail = false, + float $waitTimeout = 3.0, + ): mixed { + if (! $this->enabled) { + return $fn(); + } + + $target = self::targetOf($key); + $lock = new DistributedLock($this->redis, $key, $ttl); + + try { + $acquired = $orFail ? $lock->acquire($waitTimeout) : $lock->tryAcquire(); + } catch (\RedisException $e) { + $this->attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); + $this->reportError('backend_error', $key, $target, $e); + + return $fn(); + } + + if (! $acquired) { + if ($orFail) { + $this->attempts->add(1, ['outcome' => 'contended', 'target' => $target]); + // No custom message — the lock key embeds collection + document id. + throw new Exception(Exception::GENERAL_RESOURCE_LOCKED); + } + $this->attempts->add(1, ['outcome' => 'skipped', 'target' => $target]); + + return null; + } + + $this->attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); + try { + return $fn(); + } finally { + try { + $lock->release(); + } catch (Throwable $e) { + $this->attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); + $this->reportError('release_error', $key, $target, $e); + } + } + } + + private static function targetOf(string $key): string { - return "lock:platform:{$collection}:{$id}"; + $parts = explode(':', $key, 4); + + return $parts[2] ?? 'unknown'; + } + + /** + * Rate-limited to one push per 60s per (action, target) so a sustained + * backend outage doesn't flood Sentry across the pod fleet. + */ + private function reportError(string $action, string $key, string $target, Throwable $e): void + { + Console::warning("Lock {$action} for {$key}: {$e->getMessage()}"); + + if ($this->logger === null) { + return; + } + + $bucket = $action.':'.$target; + $now = time(); + if ((self::$lastReportAt[$bucket] ?? 0) + 60 > $now) { + return; + } + self::$lastReportAt[$bucket] = $now; + + $this->log->setNamespace('http'); + $this->log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); + $this->log->setVersion(APP_VERSION_STABLE); + $this->log->setType(Log::TYPE_WARNING); + $this->log->setMessage('Distributed lock '.$action.': '.$e->getMessage()); + $this->log->setAction("lock.{$action}"); + $this->log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' + ? Log::ENVIRONMENT_PRODUCTION + : Log::ENVIRONMENT_STAGING); + $this->log->addTag('lock.target', $target); + // Strip trailing document ID to keep aggregator cardinality bounded. + $this->log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); + $this->log->addTag('code', $e->getCode()); + $this->log->addExtra('file', $e->getFile()); + $this->log->addExtra('line', $e->getLine()); + $this->log->addExtra('trace', $e->getTraceAsString()); + + try { + $this->logger->addLog($this->log); + } catch (Throwable) { + } } } From 18a67e00d3428b51473a5b1be75bc75bad95ca4e Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 07:55:38 +0100 Subject: [PATCH 013/151] fix: refresh composer.lock content-hash --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index df129b87a5..84bd5e4f13 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": "bbf2208dac35ff90f57b7e49b8546d45", + "content-hash": "2063a411993b66c5235a87f6cc682ba7", "packages": [ { "name": "adhocore/jwt", From b2b9ac5b4d6046240eba55c153b4535db1cba7de Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 10:16:17 +0100 Subject: [PATCH 014/151] fix: redis resource reads _APP_CONNECTIONS_CACHE with _APP_REDIS_* fallback The dedicated \Redis DI resource (used by timelimit and the new Lock class) was reading _APP_REDIS_HOST/PORT/PASS exclusively. Cloud deployments configure cache via _APP_CONNECTIONS_CACHE URI form (e.g. cache=redis://dragonfly:6379) and don't pass the legacy _APP_REDIS_* vars to the appwrite container locally, so timelimit and Lock both fail to connect outside production where Helm separately injects the legacy vars. Now prefers _APP_CONNECTIONS_CACHE when set (matching the cache pool backend), falls back to _APP_REDIS_* for CE-style configs. No new env vars introduced; both timelimit and Lock work in CE, cloud-local, and cloud-production without compose changes. --- app/init/resources.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/init/resources.php b/app/init/resources.php index 29506bfc9c..aa82c19b75 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -193,12 +193,25 @@ $container->set('cache', function (Group $pools, Telemetry $telemetry) { }, ['pools', 'telemetry']); $container->set('redis', function () { - $host = System::getEnv('_APP_REDIS_HOST', 'localhost'); - $port = System::getEnv('_APP_REDIS_PORT', 6379); - $pass = System::getEnv('_APP_REDIS_PASS', ''); + // Prefer _APP_CONNECTIONS_CACHE (URI form, used by cloud and the pool layer) + // so that direct \Redis consumers (timelimit, Lock) match the same backend + // as the cache pool. Fall back to _APP_REDIS_* for CE-style configs. + $cacheDsn = System::getEnv('_APP_CONNECTIONS_CACHE', ''); + if ($cacheDsn !== '') { + $first = explode(';', $cacheDsn)[0]; + $uri = explode('=', $first, 2)[1] ?? $first; + $dsn = new DSN($uri); + $host = $dsn->getHost(); + $port = (int) ($dsn->getPort() ?: 6379); + $pass = $dsn->getPassword() ?? ''; + } else { + $host = System::getEnv('_APP_REDIS_HOST', 'localhost'); + $port = (int) System::getEnv('_APP_REDIS_PORT', 6379); + $pass = System::getEnv('_APP_REDIS_PASS', ''); + } $redis = new \Redis(); - @$redis->pconnect($host, (int) $port); + @$redis->pconnect($host, $port); if ($pass) { $redis->auth($pass); } From c2a249c48b7c3f1995a91395eaa2139ad47bdb54 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 11:26:18 +0100 Subject: [PATCH 015/151] feat(lock): include project internal id in lock key + telemetry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per-manager request, lock keys are now prefixed with the project's internal id (sequence) so that: - Locks are partitioned by project — Redis cluster slot affinity if/when sharded. - Cross-project requests can't compete on the same key for collection-scoped resources. - Telemetry (counter + Sentry tags) carries 'project' alongside 'target', so dashboards can filter contention by project. Key shapes: set: lock:platform:{project}:{collection}:{id}:{attribute} run/orFail: lock:platform:{project}:{collection}:{id} withKey: raw (caller-provided) Lock now requires a project document at construction. All existing call sites (4 in CE + 2 in cloud) run inside Http::init()-resolved request scope where the project document is set, so no migration needed. Workers/CLI without project context can use withKey directly. --- app/init/resources/request.php | 6 +-- src/Appwrite/Locking/Lock.php | 71 +++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/app/init/resources/request.php b/app/init/resources/request.php index d927c1dff8..03d860715e 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -75,9 +75,9 @@ return function (Container $container): void { return $register->get('logger'); }, ['register']); - $container->set('lock', function (\Redis $redis, Telemetry $telemetry, Database $dbForPlatform, Authorization $authorization, Log $log, ?Logger $logger): Lock { - return new Lock($redis, $telemetry, $dbForPlatform, $authorization, $log, $logger); - }, ['redis', 'telemetry', 'dbForPlatform', 'authorization', 'log', 'logger']); + $container->set('lock', function (\Redis $redis, Telemetry $telemetry, Database $dbForPlatform, Authorization $authorization, Log $log, ?Logger $logger, Document $project): Lock { + return new Lock($redis, $telemetry, $dbForPlatform, $authorization, $log, $logger, $project); + }, ['redis', 'telemetry', 'dbForPlatform', 'authorization', 'log', 'logger', 'project']); $container->set('authorization', function () { return new Authorization(); diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php index 288b50c6ea..77b278860b 100644 --- a/src/Appwrite/Locking/Lock.php +++ b/src/Appwrite/Locking/Lock.php @@ -22,6 +22,8 @@ final class Lock private readonly mixed $attempts; + private readonly string $projectInternalId; + /** @var array */ private static array $lastReportAt = []; @@ -32,9 +34,12 @@ final class Lock private readonly Authorization $authorization, private readonly Log $log, private readonly ?Logger $logger, + Document $project, ) { $this->enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; $this->attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); + $sequence = $project->getSequence(); + $this->projectInternalId = ($sequence !== null && $sequence !== '') ? (string) $sequence : 'unknown'; } /** @@ -49,16 +54,14 @@ final class Lock string $attribute = 'accessedAt', ?string $value = null, ): void { - $this->withKey( - "lock:platform:{$collection}:{$id}:{$attribute}", - function () use ($collection, $id, $attribute, $value) { - $this->authorization->skip(fn () => $this->dbForPlatform->updateDocument( - $collection, - $id, - new Document([$attribute => $value ?? DateTime::now()]) - )); - } - ); + $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}:{$attribute}"; + $this->execute($key, $collection, function () use ($collection, $id, $attribute, $value) { + $this->authorization->skip(fn () => $this->dbForPlatform->updateDocument( + $collection, + $id, + new Document([$attribute => $value ?? DateTime::now()]) + )); + }); } /** @@ -67,7 +70,8 @@ final class Lock */ public function run(string $collection, string $id, Closure $fn): void { - $this->withKey("lock:platform:{$collection}:{$id}", $fn); + $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}"; + $this->execute($key, $collection, $fn); } /** @@ -77,18 +81,19 @@ final class Lock */ public function runOrFail(string $collection, string $id, Closure $fn): mixed { - return $this->withKey( - "lock:platform:{$collection}:{$id}", - $fn, - ttl: 10, - orFail: true, - ); + $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}"; + + return $this->execute($key, $collection, $fn, ttl: 10, orFail: true); } /** * Generic lock primitive with full control over key, TTL, contention * behavior, and wait timeout. Escape hatch for non-platform keys * (cache, queue, edge) and for unusual TTL/timeout requirements. + * + * Caller may pass `target` for telemetry; otherwise it's extracted by + * position from the key (best-effort for keys following the standard + * `lock::<...>::<...>` shape). */ public function withKey( string $key, @@ -96,18 +101,37 @@ final class Lock int $ttl = 5, bool $orFail = false, float $waitTimeout = 3.0, + ?string $target = null, + ): mixed { + return $this->execute( + $key, + $target ?? self::targetOf($key), + $fn, + ttl: $ttl, + orFail: $orFail, + waitTimeout: $waitTimeout, + ); + } + + private function execute( + string $key, + string $target, + Closure $fn, + int $ttl = 5, + bool $orFail = false, + float $waitTimeout = 3.0, ): mixed { if (! $this->enabled) { return $fn(); } - $target = self::targetOf($key); $lock = new DistributedLock($this->redis, $key, $ttl); + $labels = ['target' => $target, 'project' => $this->projectInternalId]; try { $acquired = $orFail ? $lock->acquire($waitTimeout) : $lock->tryAcquire(); } catch (\RedisException $e) { - $this->attempts->add(1, ['outcome' => 'backend_error', 'target' => $target]); + $this->attempts->add(1, ['outcome' => 'backend_error', ...$labels]); $this->reportError('backend_error', $key, $target, $e); return $fn(); @@ -115,23 +139,23 @@ final class Lock if (! $acquired) { if ($orFail) { - $this->attempts->add(1, ['outcome' => 'contended', 'target' => $target]); + $this->attempts->add(1, ['outcome' => 'contended', ...$labels]); // No custom message — the lock key embeds collection + document id. throw new Exception(Exception::GENERAL_RESOURCE_LOCKED); } - $this->attempts->add(1, ['outcome' => 'skipped', 'target' => $target]); + $this->attempts->add(1, ['outcome' => 'skipped', ...$labels]); return null; } - $this->attempts->add(1, ['outcome' => 'acquired', 'target' => $target]); + $this->attempts->add(1, ['outcome' => 'acquired', ...$labels]); try { return $fn(); } finally { try { $lock->release(); } catch (Throwable $e) { - $this->attempts->add(1, ['outcome' => 'release_error', 'target' => $target]); + $this->attempts->add(1, ['outcome' => 'release_error', ...$labels]); $this->reportError('release_error', $key, $target, $e); } } @@ -173,6 +197,7 @@ final class Lock ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); $this->log->addTag('lock.target', $target); + $this->log->addTag('lock.project', $this->projectInternalId); // Strip trailing document ID to keep aggregator cardinality bounded. $this->log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); $this->log->addTag('code', $e->getCode()); From 2f2a124a06cba627757158bb5367433aeffa957d Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 29 Apr 2026 16:39:36 +0100 Subject: [PATCH 016/151] revert: redis resource cluster support + _APP_CONNECTIONS_CACHE fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cloud production runs four separate single-master+replica Dragonfly deployments (cache, queue-dragonfly, queue-usage, pubsub-dragonfly), not sharded Redis Cluster topology — confirmed by deploy/cloud/values + environments/production/*.values.yaml (Dragonfly Operator with replicas=2 = 1 primary + 1 read replica), and by the dev DSN scheme 'redis://' (not 'redis-cluster://'). So a standard \Redis client suffices for the direct redis resource (timelimit, Lock). Cloud just needs to pass _APP_REDIS_HOST/PORT/USER/ PASS through to the appwrite container — handled in the cloud PR's docker-compose.yml change. This reverts the resource to its original pre-PR shape. The utopia-php/lock cluster-support PR (utopia-php/lock#1) stays open at upstream as a future-ready option if cloud ever moves to actual Redis Cluster mode. --- app/controllers/general.php | 2 +- app/controllers/shared/api.php | 2 +- app/init/resources.php | 21 ++++----------------- src/Appwrite/Locking/Lock.php | 7 +++---- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 9381843b64..9eabe56eac 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -137,7 +137,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S if (!$project->isEmpty() && $project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $lock->set('projects', $project->getId()); + $lock->set('projects', $project->getId(), 'accessedAt', DateTime::now()); } /** diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 3c679ce6ec..f88dc5eb4b 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -392,7 +392,7 @@ Http::init() if ($project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $lock->set('projects', $project->getId()); + $lock->set('projects', $project->getId(), 'accessedAt', DateTime::now()); } } diff --git a/app/init/resources.php b/app/init/resources.php index aa82c19b75..29506bfc9c 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -193,25 +193,12 @@ $container->set('cache', function (Group $pools, Telemetry $telemetry) { }, ['pools', 'telemetry']); $container->set('redis', function () { - // Prefer _APP_CONNECTIONS_CACHE (URI form, used by cloud and the pool layer) - // so that direct \Redis consumers (timelimit, Lock) match the same backend - // as the cache pool. Fall back to _APP_REDIS_* for CE-style configs. - $cacheDsn = System::getEnv('_APP_CONNECTIONS_CACHE', ''); - if ($cacheDsn !== '') { - $first = explode(';', $cacheDsn)[0]; - $uri = explode('=', $first, 2)[1] ?? $first; - $dsn = new DSN($uri); - $host = $dsn->getHost(); - $port = (int) ($dsn->getPort() ?: 6379); - $pass = $dsn->getPassword() ?? ''; - } else { - $host = System::getEnv('_APP_REDIS_HOST', 'localhost'); - $port = (int) System::getEnv('_APP_REDIS_PORT', 6379); - $pass = System::getEnv('_APP_REDIS_PASS', ''); - } + $host = System::getEnv('_APP_REDIS_HOST', 'localhost'); + $port = System::getEnv('_APP_REDIS_PORT', 6379); + $pass = System::getEnv('_APP_REDIS_PASS', ''); $redis = new \Redis(); - @$redis->pconnect($host, $port); + @$redis->pconnect($host, (int) $port); if ($pass) { $redis->auth($pass); } diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php index 77b278860b..e545254ef3 100644 --- a/src/Appwrite/Locking/Lock.php +++ b/src/Appwrite/Locking/Lock.php @@ -7,7 +7,6 @@ use Closure; use Throwable; use Utopia\Console; use Utopia\Database\Database; -use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Lock\Distributed as DistributedLock; @@ -51,15 +50,15 @@ final class Lock public function set( string $collection, string $id, - string $attribute = 'accessedAt', - ?string $value = null, + string $attribute, + string $value, ): void { $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}:{$attribute}"; $this->execute($key, $collection, function () use ($collection, $id, $attribute, $value) { $this->authorization->skip(fn () => $this->dbForPlatform->updateDocument( $collection, $id, - new Document([$attribute => $value ?? DateTime::now()]) + new Document([$attribute => $value]) )); }); } From 7430de293e325f7d0c431816c653fec799fabb92 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 30 Apr 2026 06:05:50 +0100 Subject: [PATCH 017/151] test: unit tests for Lock facade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers the four public methods (set, run, runOrFail, withKey) plus the kill switch and the project-fallback behavior. Tests against a real Redis (the appwrite container has it always-on); no markTestSkipped fallback — the suite fails loudly if Redis is unreachable rather than silently passing. --- tests/unit/Locking/LockTest.php | 257 ++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 tests/unit/Locking/LockTest.php diff --git a/tests/unit/Locking/LockTest.php b/tests/unit/Locking/LockTest.php new file mode 100644 index 0000000000..e04745c4f9 --- /dev/null +++ b/tests/unit/Locking/LockTest.php @@ -0,0 +1,257 @@ +redis = new Redis; + $this->redis->connect($host, $port, 1.0); + + $this->project = new Document([ + '$id' => 'test-project', + '$sequence' => self::PROJECT_SEQUENCE, + ]); + $this->authorization = new Authorization; + $this->log = new Log; + + $this->cleanupKeys(); + } + + protected function tearDown(): void + { + if (isset($this->redis) && $this->redis->isConnected()) { + $this->cleanupKeys(); + } + } + + private function cleanupKeys(): void + { + foreach ($this->redis->keys(self::KEY_PREFIX.'*') as $key) { + $this->redis->del($key); + } + // also clean keys produced by withKey() tests + foreach ($this->redis->keys('lock:test:*') as $key) { + $this->redis->del($key); + } + } + + private function makeLock(?Database $db = null, ?Authorization $auth = null): Lock + { + return new Lock( + $this->redis, + new NoTelemetry, + $db ?? $this->createStub(Database::class), + $auth ?? $this->authorization, + $this->log, + null, + $this->project, + ); + } + + public function test_set_uses_per_attribute_key_and_auth_skipped_update(): void + { + $captured = null; + $db = $this->createMock(Database::class); + $db->expects($this->once()) + ->method('updateDocument') + ->with('projects', 'p1', $this->callback(function (Document $doc) use (&$captured) { + $captured = $doc->getArrayCopy(); + + return true; + })) + ->willReturnArgument(2); + + $lock = $this->makeLock($db); + $lock->set('projects', 'p1', 'accessedAt', '2024-06-01 12:00:00'); + + $this->assertSame(['accessedAt' => '2024-06-01 12:00:00'], $captured); + $this->assertSame(0, $this->redis->exists(self::KEY_PREFIX.'projects:p1:accessedAt')); + } + + public function test_set_skips_on_contention(): void + { + $key = self::KEY_PREFIX.'projects:p1:accessedAt'; + $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); + + $db = $this->createMock(Database::class); + $db->expects($this->never())->method('updateDocument'); + + $lock = $this->makeLock($db); + $lock->set('projects', 'p1', 'accessedAt', '2024-06-01 12:00:00'); + + $this->assertSame('other-owner', $this->redis->get($key)); + } + + public function test_set_different_attributes_do_not_compete(): void + { + // Hold accessedAt + $heldKey = self::KEY_PREFIX.'projects:p1:accessedAt'; + $this->redis->set($heldKey, 'other-owner', ['NX', 'EX' => 30]); + + // mcpAccessedAt should still be acquirable + $db = $this->createMock(Database::class); + $db->expects($this->once()) + ->method('updateDocument') + ->with('projects', 'p1', $this->isInstanceOf(Document::class)) + ->willReturnArgument(2); + + $lock = $this->makeLock($db); + $lock->set('projects', 'p1', 'mcpAccessedAt', '2024-06-01 12:00:00'); + + $this->assertSame('other-owner', $this->redis->get($heldKey)); + } + + public function test_run_uses_per_document_key_and_invokes_callback(): void + { + $called = false; + $lock = $this->makeLock(); + $lock->run('keys', 'k1', function () use (&$called) { + $called = true; + }); + + $this->assertTrue($called); + $this->assertSame(0, $this->redis->exists(self::KEY_PREFIX.'keys:k1')); + } + + public function test_run_skips_on_contention(): void + { + $key = self::KEY_PREFIX.'keys:k1'; + $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); + + $called = false; + $lock = $this->makeLock(); + $lock->run('keys', 'k1', function () use (&$called) { + $called = true; + }); + + $this->assertFalse($called); + $this->assertSame('other-owner', $this->redis->get($key)); + } + + public function test_run_or_fail_throws_on_contention(): void + { + $key = self::KEY_PREFIX.'projects:p1'; + $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); + + $lock = $this->makeLock(); + + $this->expectException(Exception::class); + try { + $lock->runOrFail('projects', 'p1', fn () => 'never-runs'); + } catch (Exception $e) { + $this->assertSame(Exception::GENERAL_RESOURCE_LOCKED, $e->getType()); + throw $e; + } + } + + public function test_run_or_fail_returns_callback_value_when_uncontended(): void + { + $lock = $this->makeLock(); + $result = $lock->runOrFail('projects', 'p1', fn () => 'ok'); + + $this->assertSame('ok', $result); + $this->assertSame(0, $this->redis->exists(self::KEY_PREFIX.'projects:p1')); + } + + public function test_with_key_uses_raw_key(): void + { + $custom = 'lock:test:custom-key'; + $called = false; + $lock = $this->makeLock(); + $lock->withKey($custom, function () use (&$called) { + $called = true; + }); + + $this->assertTrue($called); + $this->assertSame(0, $this->redis->exists($custom)); + } + + public function test_with_key_or_fail_flag_throws_on_contention(): void + { + $custom = 'lock:test:contended'; + $this->redis->set($custom, 'other', ['NX', 'EX' => 30]); + + $lock = $this->makeLock(); + $this->expectException(Exception::class); + $lock->withKey($custom, fn () => null, ttl: 5, orFail: true, waitTimeout: 0.1); + } + + public function test_disabled_mode_runs_callback_unlocked(): void + { + $previous = \getenv('_APP_LOCKING_ENABLED'); + \putenv('_APP_LOCKING_ENABLED=disabled'); + try { + // Even when the key is already held, the callback must still run. + $key = self::KEY_PREFIX.'keys:k1'; + $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); + + $called = false; + $lock = $this->makeLock(); + $lock->run('keys', 'k1', function () use (&$called) { + $called = true; + }); + + $this->assertTrue($called); + $this->assertSame('other-owner', $this->redis->get($key)); + } finally { + $previous === false ? \putenv('_APP_LOCKING_ENABLED') : \putenv('_APP_LOCKING_ENABLED='.$previous); + } + } + + public function test_project_without_sequence_falls_back_to_unknown(): void + { + $emptyProject = new Document; + $lock = new Lock( + $this->redis, + new NoTelemetry, + $this->createStub(Database::class), + $this->authorization, + $this->log, + null, + $emptyProject, + ); + + // Pre-acquire the lock at the 'unknown' projectInternalId path. + $key = 'lock:platform:unknown:keys:k1'; + $this->redis->set($key, 'held', ['NX', 'EX' => 30]); + + $called = false; + $lock->run('keys', 'k1', function () use (&$called) { + $called = true; + }); + $this->assertFalse($called, 'Lock without project sequence should hash to the unknown bucket'); + + $this->redis->del($key); + } +} From 7b2f6ac692a26d246a89d0bf71dbcd8015411092 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 30 Apr 2026 07:13:51 +0100 Subject: [PATCH 018/151] fix: add explicit parens to new ClassName calls in LockTest (PSR-12) --- tests/unit/Locking/LockTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/Locking/LockTest.php b/tests/unit/Locking/LockTest.php index e04745c4f9..b789ffe3e0 100644 --- a/tests/unit/Locking/LockTest.php +++ b/tests/unit/Locking/LockTest.php @@ -35,15 +35,15 @@ class LockTest extends TestCase $host = \getenv('_APP_REDIS_HOST') ?: 'redis'; $port = (int) (\getenv('_APP_REDIS_PORT') ?: 6379); - $this->redis = new Redis; + $this->redis = new Redis(); $this->redis->connect($host, $port, 1.0); $this->project = new Document([ '$id' => 'test-project', '$sequence' => self::PROJECT_SEQUENCE, ]); - $this->authorization = new Authorization; - $this->log = new Log; + $this->authorization = new Authorization(); + $this->log = new Log(); $this->cleanupKeys(); } @@ -70,7 +70,7 @@ class LockTest extends TestCase { return new Lock( $this->redis, - new NoTelemetry, + new NoTelemetry(), $db ?? $this->createStub(Database::class), $auth ?? $this->authorization, $this->log, @@ -231,10 +231,10 @@ class LockTest extends TestCase public function test_project_without_sequence_falls_back_to_unknown(): void { - $emptyProject = new Document; + $emptyProject = new Document(); $lock = new Lock( $this->redis, - new NoTelemetry, + new NoTelemetry(), $this->createStub(Database::class), $this->authorization, $this->log, From 2762e849749ba193b6b23b2156e97d492ea66051 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 30 Apr 2026 07:26:45 +0100 Subject: [PATCH 019/151] fix(lock): broaden acquire catch + clone Log before reportError Two P1s from review: - Acquire path caught only \RedisException; any other Throwable from the lock library would escape and skip the fail-open callback. Widened to \Throwable so any backend failure falls back to running unlocked. - reportError mutated the per-request $log directly, leaving it in a 'lock.{action}' state that the request-end handler would then submit as the request log. Clones $log into a dedicated $lockLog so the shared instance is untouched. --- src/Appwrite/Locking/Lock.php | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php index e545254ef3..38e034b220 100644 --- a/src/Appwrite/Locking/Lock.php +++ b/src/Appwrite/Locking/Lock.php @@ -129,7 +129,7 @@ final class Lock try { $acquired = $orFail ? $lock->acquire($waitTimeout) : $lock->tryAcquire(); - } catch (\RedisException $e) { + } catch (Throwable $e) { $this->attempts->add(1, ['outcome' => 'backend_error', ...$labels]); $this->reportError('backend_error', $key, $target, $e); @@ -186,26 +186,30 @@ final class Lock } self::$lastReportAt[$bucket] = $now; - $this->log->setNamespace('http'); - $this->log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); - $this->log->setVersion(APP_VERSION_STABLE); - $this->log->setType(Log::TYPE_WARNING); - $this->log->setMessage('Distributed lock '.$action.': '.$e->getMessage()); - $this->log->setAction("lock.{$action}"); - $this->log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' + // Clone the per-request Log so our lock-error fields don't bleed into the + // request-end submission of $this->log (action/message/tags get reset on the + // shared instance otherwise). + $lockLog = clone $this->log; + $lockLog->setNamespace('http'); + $lockLog->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); + $lockLog->setVersion(APP_VERSION_STABLE); + $lockLog->setType(Log::TYPE_WARNING); + $lockLog->setMessage('Distributed lock '.$action.': '.$e->getMessage()); + $lockLog->setAction("lock.{$action}"); + $lockLog->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); - $this->log->addTag('lock.target', $target); - $this->log->addTag('lock.project', $this->projectInternalId); + $lockLog->addTag('lock.target', $target); + $lockLog->addTag('lock.project', $this->projectInternalId); // Strip trailing document ID to keep aggregator cardinality bounded. - $this->log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); - $this->log->addTag('code', $e->getCode()); - $this->log->addExtra('file', $e->getFile()); - $this->log->addExtra('line', $e->getLine()); - $this->log->addExtra('trace', $e->getTraceAsString()); + $lockLog->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); + $lockLog->addTag('code', $e->getCode()); + $lockLog->addExtra('file', $e->getFile()); + $lockLog->addExtra('line', $e->getLine()); + $lockLog->addExtra('trace', $e->getTraceAsString()); try { - $this->logger->addLog($this->log); + $this->logger->addLog($lockLog); } catch (Throwable) { } } From 03575e68c44a6c6b5a58c9c131f3dff3688d4593 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 30 Apr 2026 07:31:15 +0100 Subject: [PATCH 020/151] fix(lock): re-read keys inside lock body to avoid sdks append loss The sdks attribute is an append-only list, not idempotent. With the read happening outside the lock, two sequential acquirers could each read the same stale list and overwrite each other's appends. Now the lock body re-reads the keys document and re-derives the sdks array from the fresh state. Skip-on-contention still drops the update when the lock is held, but a same-SDK retry on the next request picks the registration up. Bounded loss only affects the rare 'first-seen' SDK request that happens to land while the lock is held; sequential traffic from the same SDK (or any later request from any SDK) re-attempts and writes. Co-authored-by: greptile-apps[bot] --- app/controllers/shared/api.php | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index a1b68ddcde..2a1beadc04 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -232,27 +232,37 @@ Http::init() $updates = new Document(); $accessedAt = $dbKey->getAttribute('accessedAt', 0); + $accessedAtStale = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_KEY_ACCESS)) > $accessedAt; - if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_KEY_ACCESS)) > $accessedAt) { + if ($accessedAtStale) { $updates->setAttribute('accessedAt', DateTime::now()); } $sdkValidator = new WhiteList($servers, true); $sdk = $request->getHeader('x-sdk-name', 'UNKNOWN'); + $sdkCandidate = ($sdk !== 'UNKNOWN' && $sdkValidator->isValid($sdk) && ! in_array($sdk, $dbKey->getAttribute('sdks', []))) ? $sdk : null; - if ($sdk !== 'UNKNOWN' && $sdkValidator->isValid($sdk)) { - $sdks = $dbKey->getAttribute('sdks', []); + if (! $updates->isEmpty() || $sdkCandidate !== null) { + $lock->run('keys', $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $sdkCandidate, $apiKey, $project, $user, $team) { + // Re-read inside the lock so two sequential acquirers don't clobber each other's + // sdks-array appends. Skip semantics still drop concurrent acquirers' updates, + // but a same-SDK retry on the next request will pick the registration up. + if ($sdkCandidate !== null) { + $current = $dbForPlatform->getAuthorization()->skip( + fn () => $dbForPlatform->getDocument('keys', $dbKey->getId()) + ); + $sdks = $current->getAttribute('sdks', []); + if (! in_array($sdkCandidate, $sdks)) { + $sdks[] = $sdkCandidate; + $updates->setAttribute('sdks', $sdks); + $updates->setAttribute('accessedAt', DateTime::now()); + } + } - if (! in_array($sdk, $sdks)) { - $sdks[] = $sdk; + if ($updates->isEmpty()) { + return; + } - $updates->setAttribute('sdks', $sdks); - $updates->setAttribute('accessedAt', Datetime::now()); - } - } - - if (! $updates->isEmpty()) { - $lock->run('keys', $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $apiKey, $project, $user, $team) { $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); if (! empty($apiKey->getProjectId())) { From bae328efa19126e35d2a8523b5e48a6901d99151 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 30 Apr 2026 07:42:59 +0100 Subject: [PATCH 021/151] revert: keep narrow RedisException catch on lock acquire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reverts the catch widening from earlier — the underlying Utopia\Lock\Distributed::tryAcquire only calls ext-redis methods, which throw RedisException exclusively. Catching Throwable was over-broad and would silently swallow real bugs (TypeError, Error) into a fail-open path. --- src/Appwrite/Locking/Lock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php index 38e034b220..6390a4a4be 100644 --- a/src/Appwrite/Locking/Lock.php +++ b/src/Appwrite/Locking/Lock.php @@ -129,7 +129,7 @@ final class Lock try { $acquired = $orFail ? $lock->acquire($waitTimeout) : $lock->tryAcquire(); - } catch (Throwable $e) { + } catch (\RedisException $e) { $this->attempts->add(1, ['outcome' => 'backend_error', ...$labels]); $this->reportError('backend_error', $key, $target, $e); From 18f3280bad3bf2549c807fe0fa613cb77f956ea6 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 30 Apr 2026 07:48:04 +0100 Subject: [PATCH 022/151] refactor(lock): extract magic numbers and outcome strings, fix target parse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TTL defaults (5s skip / 10s fail), 3s wait timeout, and 60s sentry rate-limit window are now class constants. - Telemetry outcome labels (acquired/skipped/contended/backend_error/ release_error) are class constants — typo-safe across the 9 use sites. - Fix: inferTargetFromKey was indexing into segment 2 with limit 4, which returned the project sequence instead of the collection name ever since project-id was added to the key in c2a249c48b. Telemetry was tagging 'target' with project sequences instead of 'projects' / 'users' / etc. Now indexes segment 3 with limit 5 to correctly pick the collection segment from lock:platform:{project}:{target}:... --- src/Appwrite/Locking/Lock.php | 63 ++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php index 6390a4a4be..6227ae3f5e 100644 --- a/src/Appwrite/Locking/Lock.php +++ b/src/Appwrite/Locking/Lock.php @@ -17,6 +17,24 @@ use Utopia\Telemetry\Adapter as Telemetry; final class Lock { + private const SKIP_TTL_SECONDS = 5; + + private const FAIL_TTL_SECONDS = 10; + + private const FAIL_WAIT_SECONDS = 3.0; + + private const REPORT_RATE_LIMIT_SECONDS = 60; + + private const OUTCOME_ACQUIRED = 'acquired'; + + private const OUTCOME_SKIPPED = 'skipped'; + + private const OUTCOME_CONTENDED = 'contended'; + + private const OUTCOME_BACKEND_ERROR = 'backend_error'; + + private const OUTCOME_RELEASE_ERROR = 'release_error'; + private readonly bool $enabled; private readonly mixed $attempts; @@ -82,7 +100,7 @@ final class Lock { $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}"; - return $this->execute($key, $collection, $fn, ttl: 10, orFail: true); + return $this->execute($key, $collection, $fn, ttl: self::FAIL_TTL_SECONDS, orFail: true); } /** @@ -92,19 +110,19 @@ final class Lock * * Caller may pass `target` for telemetry; otherwise it's extracted by * position from the key (best-effort for keys following the standard - * `lock::<...>::<...>` shape). + * `lock:platform:{project}:{target}:...` shape). */ public function withKey( string $key, Closure $fn, - int $ttl = 5, + int $ttl = self::SKIP_TTL_SECONDS, bool $orFail = false, - float $waitTimeout = 3.0, + float $waitTimeout = self::FAIL_WAIT_SECONDS, ?string $target = null, ): mixed { return $this->execute( $key, - $target ?? self::targetOf($key), + $target ?? self::inferTargetFromKey($key), $fn, ttl: $ttl, orFail: $orFail, @@ -116,9 +134,9 @@ final class Lock string $key, string $target, Closure $fn, - int $ttl = 5, + int $ttl = self::SKIP_TTL_SECONDS, bool $orFail = false, - float $waitTimeout = 3.0, + float $waitTimeout = self::FAIL_WAIT_SECONDS, ): mixed { if (! $this->enabled) { return $fn(); @@ -130,46 +148,51 @@ final class Lock try { $acquired = $orFail ? $lock->acquire($waitTimeout) : $lock->tryAcquire(); } catch (\RedisException $e) { - $this->attempts->add(1, ['outcome' => 'backend_error', ...$labels]); - $this->reportError('backend_error', $key, $target, $e); + $this->attempts->add(1, ['outcome' => self::OUTCOME_BACKEND_ERROR, ...$labels]); + $this->reportError(self::OUTCOME_BACKEND_ERROR, $key, $target, $e); return $fn(); } if (! $acquired) { if ($orFail) { - $this->attempts->add(1, ['outcome' => 'contended', ...$labels]); + $this->attempts->add(1, ['outcome' => self::OUTCOME_CONTENDED, ...$labels]); // No custom message — the lock key embeds collection + document id. throw new Exception(Exception::GENERAL_RESOURCE_LOCKED); } - $this->attempts->add(1, ['outcome' => 'skipped', ...$labels]); + $this->attempts->add(1, ['outcome' => self::OUTCOME_SKIPPED, ...$labels]); return null; } - $this->attempts->add(1, ['outcome' => 'acquired', ...$labels]); + $this->attempts->add(1, ['outcome' => self::OUTCOME_ACQUIRED, ...$labels]); try { return $fn(); } finally { try { $lock->release(); } catch (Throwable $e) { - $this->attempts->add(1, ['outcome' => 'release_error', ...$labels]); - $this->reportError('release_error', $key, $target, $e); + $this->attempts->add(1, ['outcome' => self::OUTCOME_RELEASE_ERROR, ...$labels]); + $this->reportError(self::OUTCOME_RELEASE_ERROR, $key, $target, $e); } } } - private static function targetOf(string $key): string + /** + * Best-effort target extraction for telemetry. Assumes the standard + * `lock:platform:{project}:{target}:...` shape. For non-platform keys + * passed via withKey(), callers should pass `target` explicitly. + */ + private static function inferTargetFromKey(string $key): string { - $parts = explode(':', $key, 4); + $parts = explode(':', $key, 5); - return $parts[2] ?? 'unknown'; + return $parts[3] ?? 'unknown'; } /** - * Rate-limited to one push per 60s per (action, target) so a sustained - * backend outage doesn't flood Sentry across the pod fleet. + * Rate-limited to one push per REPORT_RATE_LIMIT_SECONDS per (action, target) + * so a sustained backend outage doesn't flood Sentry across the pod fleet. */ private function reportError(string $action, string $key, string $target, Throwable $e): void { @@ -181,7 +204,7 @@ final class Lock $bucket = $action.':'.$target; $now = time(); - if ((self::$lastReportAt[$bucket] ?? 0) + 60 > $now) { + if ((self::$lastReportAt[$bucket] ?? 0) + self::REPORT_RATE_LIMIT_SECONDS > $now) { return; } self::$lastReportAt[$bucket] = $now; From e0ec28f02a802862e1b68c3b9cf07097cfa436c3 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 30 Apr 2026 08:24:56 +0100 Subject: [PATCH 023/151] revert: drop $log clone and sdks in-lock re-read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both were defensive against rare edge cases the reviewer flagged but which don't justify the complexity: - $log clone: protects against tag pollution on the per-request Log if reportError fires AND the request later errors. http.php's request-end handler overwrites the core fields (namespace, message, action, etc.) anyway; only addTag/addExtra accumulate. Aligns with Embeddings/Text/Create.php precedent which mutates $log directly. - sdks in-lock re-read: closes a sequential-acquire stale-read race on the sdks append-list. The race exists but the impact is bounded — one SDK registration delayed until the next request from that SDK fires. Self-healing on retry. The codebase already accepts this exact race for auths, oAuthProviders, services, identities, sessions, factors, etc. Special-casing this one site is precision the analytics use case doesn't need. --- app/controllers/shared/api.php | 34 ++++++++++++---------------------- src/Appwrite/Locking/Lock.php | 34 +++++++++++++++------------------- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 2a1beadc04..ce0fd004cf 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -232,37 +232,27 @@ Http::init() $updates = new Document(); $accessedAt = $dbKey->getAttribute('accessedAt', 0); - $accessedAtStale = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_KEY_ACCESS)) > $accessedAt; - if ($accessedAtStale) { + if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_KEY_ACCESS)) > $accessedAt) { $updates->setAttribute('accessedAt', DateTime::now()); } $sdkValidator = new WhiteList($servers, true); $sdk = $request->getHeader('x-sdk-name', 'UNKNOWN'); - $sdkCandidate = ($sdk !== 'UNKNOWN' && $sdkValidator->isValid($sdk) && ! in_array($sdk, $dbKey->getAttribute('sdks', []))) ? $sdk : null; - if (! $updates->isEmpty() || $sdkCandidate !== null) { - $lock->run('keys', $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $sdkCandidate, $apiKey, $project, $user, $team) { - // Re-read inside the lock so two sequential acquirers don't clobber each other's - // sdks-array appends. Skip semantics still drop concurrent acquirers' updates, - // but a same-SDK retry on the next request will pick the registration up. - if ($sdkCandidate !== null) { - $current = $dbForPlatform->getAuthorization()->skip( - fn () => $dbForPlatform->getDocument('keys', $dbKey->getId()) - ); - $sdks = $current->getAttribute('sdks', []); - if (! in_array($sdkCandidate, $sdks)) { - $sdks[] = $sdkCandidate; - $updates->setAttribute('sdks', $sdks); - $updates->setAttribute('accessedAt', DateTime::now()); - } - } + if ($sdk !== 'UNKNOWN' && $sdkValidator->isValid($sdk)) { + $sdks = $dbKey->getAttribute('sdks', []); - if ($updates->isEmpty()) { - return; - } + if (! in_array($sdk, $sdks)) { + $sdks[] = $sdk; + $updates->setAttribute('sdks', $sdks); + $updates->setAttribute('accessedAt', DateTime::now()); + } + } + + if (! $updates->isEmpty()) { + $lock->run('keys', $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $apiKey, $project, $user, $team) { $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); if (! empty($apiKey->getProjectId())) { diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php index 6227ae3f5e..9ef6d70c03 100644 --- a/src/Appwrite/Locking/Lock.php +++ b/src/Appwrite/Locking/Lock.php @@ -209,30 +209,26 @@ final class Lock } self::$lastReportAt[$bucket] = $now; - // Clone the per-request Log so our lock-error fields don't bleed into the - // request-end submission of $this->log (action/message/tags get reset on the - // shared instance otherwise). - $lockLog = clone $this->log; - $lockLog->setNamespace('http'); - $lockLog->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); - $lockLog->setVersion(APP_VERSION_STABLE); - $lockLog->setType(Log::TYPE_WARNING); - $lockLog->setMessage('Distributed lock '.$action.': '.$e->getMessage()); - $lockLog->setAction("lock.{$action}"); - $lockLog->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' + $this->log->setNamespace('http'); + $this->log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); + $this->log->setVersion(APP_VERSION_STABLE); + $this->log->setType(Log::TYPE_WARNING); + $this->log->setMessage('Distributed lock '.$action.': '.$e->getMessage()); + $this->log->setAction("lock.{$action}"); + $this->log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' ? Log::ENVIRONMENT_PRODUCTION : Log::ENVIRONMENT_STAGING); - $lockLog->addTag('lock.target', $target); - $lockLog->addTag('lock.project', $this->projectInternalId); + $this->log->addTag('lock.target', $target); + $this->log->addTag('lock.project', $this->projectInternalId); // Strip trailing document ID to keep aggregator cardinality bounded. - $lockLog->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); - $lockLog->addTag('code', $e->getCode()); - $lockLog->addExtra('file', $e->getFile()); - $lockLog->addExtra('line', $e->getLine()); - $lockLog->addExtra('trace', $e->getTraceAsString()); + $this->log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); + $this->log->addTag('code', $e->getCode()); + $this->log->addExtra('file', $e->getFile()); + $this->log->addExtra('line', $e->getLine()); + $this->log->addExtra('trace', $e->getTraceAsString()); try { - $this->logger->addLog($lockLog); + $this->logger->addLog($this->log); } catch (Throwable) { } } From 77b0925ecb728fc3c4ca50e9a6c113ffdc5729fd Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 3 Jun 2026 18:22:27 +0400 Subject: [PATCH 024/151] Add account MFA authenticator flow tests --- .../Account/AccountCustomClientTest.php | 276 ++++++++++++++++++ 1 file changed, 276 insertions(+) diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index 5b0d947198..e6a31ba3d2 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -4142,6 +4142,282 @@ class AccountCustomClientTest extends Scope $this->assertEquals(401, $verification3['headers']['status-code']); } + public function testRegenerateMFARecoveryCodesRequiresRecentChallenge(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $recoveryCodes = $this->client->call(Client::METHOD_POST, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(201, $recoveryCodes['headers']['status-code']); + $this->assertNotEmpty($recoveryCodes['body']['recoveryCodes']); + + $regenerateWithoutChallenge = $this->client->call(Client::METHOD_PATCH, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(401, $regenerateWithoutChallenge['headers']['status-code']); + $this->assertEquals('user_challenge_required', $regenerateWithoutChallenge['body']['type']); + + $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(200, $authenticator['headers']['status-code']); + $this->assertNotEmpty($authenticator['body']['secret']); + + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $verification['headers']['status-code']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ + 'factor' => 'totp', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $regeneratedCodes = $this->client->call(Client::METHOD_PATCH, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(200, $regeneratedCodes['headers']['status-code']); + $this->assertNotEmpty($regeneratedCodes['body']['recoveryCodes']); + $this->assertNotEquals($recoveryCodes['body']['recoveryCodes'], $regeneratedCodes['body']['recoveryCodes']); + } + + public function testDeleteMFAAuthenticatorRequiresRecentChallenge(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(200, $authenticator['headers']['status-code']); + $this->assertNotEmpty($authenticator['body']['secret']); + + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $verification['headers']['status-code']); + + $deleteWithoutChallenge = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(401, $deleteWithoutChallenge['headers']['status-code']); + $this->assertEquals('user_challenge_required', $deleteWithoutChallenge['body']['type']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ + 'factor' => 'totp', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertArrayHasKey('mfaUpdatedAt', $challengeVerification['body']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $delete = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(204, $delete['headers']['status-code']); + } + + public function testMFAAuthenticatorLifecycle(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $factors = $this->client->call(Client::METHOD_GET, '/account/mfa/factors', $headers); + + $this->assertEquals(200, $factors['headers']['status-code']); + $this->assertFalse($factors['body']['totp']); + + $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(200, $authenticator['headers']['status-code']); + $this->assertNotEmpty($authenticator['body']['secret']); + $this->assertNotEmpty($authenticator['body']['uri']); + + $factors = $this->client->call(Client::METHOD_GET, '/account/mfa/factors', $headers); + + $this->assertEquals(200, $factors['headers']['status-code']); + $this->assertFalse($factors['body']['totp']); + + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + $invalidOtp = $totp->now() === '000000' ? '111111' : '000000'; + + $invalidVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $invalidOtp, + ]); + + $this->assertEquals(401, $invalidVerification['headers']['status-code']); + $this->assertEquals('user_invalid_token', $invalidVerification['body']['type']); + + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $verification['headers']['status-code']); + + $factors = $this->client->call(Client::METHOD_GET, '/account/mfa/factors', $headers); + + $this->assertEquals(200, $factors['headers']['status-code']); + $this->assertTrue($factors['body']['totp']); + + $duplicateAuthenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(409, $duplicateAuthenticator['headers']['status-code']); + $this->assertEquals('user_authenticator_already_verified', $duplicateAuthenticator['body']['type']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ + 'factor' => 'totp', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $invalidChallengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $invalidOtp, + ]); + + $this->assertEquals(401, $invalidChallengeVerification['headers']['status-code']); + $this->assertEquals('user_invalid_token', $invalidChallengeVerification['body']['type']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertContains('totp', $challengeVerification['body']['factors']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $delete = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(204, $delete['headers']['status-code']); + + $deleteAgain = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(404, $deleteAgain['headers']['status-code']); + $this->assertEquals('user_authenticator_not_found', $deleteAgain['body']['type']); + } + + public function testMFAAuthenticatorCompletesEmailPasswordSession(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(200, $authenticator['headers']['status-code']); + $this->assertNotEmpty($authenticator['body']['secret']); + + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $verification['headers']['status-code']); + + $mfa = $this->client->call(Client::METHOD_PATCH, '/account/mfa', $headers, [ + 'mfa' => true, + ]); + + $this->assertEquals(200, $mfa['headers']['status-code']); + $this->assertTrue($mfa['body']['mfa']); + + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => $data['email'], + 'password' => $data['password'], + ]); + + $this->assertEquals(201, $session['headers']['status-code']); + $this->assertEquals(['password'], $session['body']['factors']); + $this->assertNotEmpty($session['cookies']['a_session_' . $projectId]); + + $newSessionHeaders = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $session['cookies']['a_session_' . $projectId], + ]; + + $account = $this->client->call(Client::METHOD_GET, '/account', $newSessionHeaders); + + $this->assertEquals(401, $account['headers']['status-code']); + $this->assertEquals('user_more_factors_required', $account['body']['type']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $newSessionHeaders, [ + 'factor' => 'totp', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $newSessionHeaders, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $totp->now(), + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertContains('password', $challengeVerification['body']['factors']); + $this->assertContains('totp', $challengeVerification['body']['factors']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $account = $this->client->call(Client::METHOD_GET, '/account', $newSessionHeaders); + + $this->assertEquals(200, $account['headers']['status-code']); + $this->assertEquals($data['id'], $account['body']['$id']); + } + public function testRefreshEmailPasswordSession(): void { $email = uniqid() . 'user@localhost.test'; From 8438ef65d5345cb69d9bac13ad5c422a6276f94f Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 3 Jun 2026 18:50:47 +0400 Subject: [PATCH 025/151] Avoid reusing TOTP codes in MFA tests --- .../Account/AccountCustomClientTest.php | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index e6a31ba3d2..d14ca33cd1 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -129,6 +129,16 @@ class AccountCustomClientTest extends Scope ]; } + protected function getNextTOTP(\OTPHP\TOTP $totp, string $previousOtp): string + { + do { + sleep(1); + $otp = $totp->now(); + } while ($otp === $previousOtp); + + return $otp; + } + /** * Helper to set up a basic account */ @@ -4164,21 +4174,8 @@ class AccountCustomClientTest extends Scope $this->assertEquals(401, $regenerateWithoutChallenge['headers']['status-code']); $this->assertEquals('user_challenge_required', $regenerateWithoutChallenge['body']['type']); - $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); - - $this->assertEquals(200, $authenticator['headers']['status-code']); - $this->assertNotEmpty($authenticator['body']['secret']); - - $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); - - $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ - 'otp' => $totp->now(), - ]); - - $this->assertEquals(200, $verification['headers']['status-code']); - $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ - 'factor' => 'totp', + 'factor' => 'recoveryCode', ]); $this->assertEquals(201, $challenge['headers']['status-code']); @@ -4186,7 +4183,7 @@ class AccountCustomClientTest extends Scope $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ 'challengeId' => $challenge['body']['$id'], - 'otp' => $totp->now(), + 'otp' => $recoveryCodes['body']['recoveryCodes'][0], ]); $this->assertEquals(200, $challengeVerification['headers']['status-code']); @@ -4216,10 +4213,16 @@ class AccountCustomClientTest extends Scope $this->assertEquals(200, $authenticator['headers']['status-code']); $this->assertNotEmpty($authenticator['body']['secret']); + $recoveryCodes = $this->client->call(Client::METHOD_POST, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(201, $recoveryCodes['headers']['status-code']); + $this->assertNotEmpty($recoveryCodes['body']['recoveryCodes']); + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + $enrollmentOtp = $totp->now(); $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ - 'otp' => $totp->now(), + 'otp' => $enrollmentOtp, ]); $this->assertEquals(200, $verification['headers']['status-code']); @@ -4230,7 +4233,7 @@ class AccountCustomClientTest extends Scope $this->assertEquals('user_challenge_required', $deleteWithoutChallenge['body']['type']); $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ - 'factor' => 'totp', + 'factor' => 'recoveryCode', ]); $this->assertEquals(201, $challenge['headers']['status-code']); @@ -4238,7 +4241,7 @@ class AccountCustomClientTest extends Scope $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ 'challengeId' => $challenge['body']['$id'], - 'otp' => $totp->now(), + 'otp' => $recoveryCodes['body']['recoveryCodes'][0], ]); $this->assertEquals(200, $challengeVerification['headers']['status-code']); @@ -4288,8 +4291,10 @@ class AccountCustomClientTest extends Scope $this->assertEquals(401, $invalidVerification['headers']['status-code']); $this->assertEquals('user_invalid_token', $invalidVerification['body']['type']); + $enrollmentOtp = $totp->now(); + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ - 'otp' => $totp->now(), + 'otp' => $enrollmentOtp, ]); $this->assertEquals(200, $verification['headers']['status-code']); @@ -4321,7 +4326,7 @@ class AccountCustomClientTest extends Scope $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ 'challengeId' => $challenge['body']['$id'], - 'otp' => $totp->now(), + 'otp' => $this->getNextTOTP($totp, $enrollmentOtp), ]); $this->assertEquals(200, $challengeVerification['headers']['status-code']); @@ -4356,9 +4361,10 @@ class AccountCustomClientTest extends Scope $this->assertNotEmpty($authenticator['body']['secret']); $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + $enrollmentOtp = $totp->now(); $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ - 'otp' => $totp->now(), + 'otp' => $enrollmentOtp, ]); $this->assertEquals(200, $verification['headers']['status-code']); @@ -4404,7 +4410,7 @@ class AccountCustomClientTest extends Scope $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $newSessionHeaders, [ 'challengeId' => $challenge['body']['$id'], - 'otp' => $totp->now(), + 'otp' => $this->getNextTOTP($totp, $enrollmentOtp), ]); $this->assertEquals(200, $challengeVerification['headers']['status-code']); From 27bfb8d4207d6abb32cfc9f95da6d9306729f5fa Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 29 May 2026 11:47:40 +0530 Subject: [PATCH 026/151] feat: embed impersonateUserId in location-type SDK method URLs - Swagger2 format class now adds ImpersonateUserId to x-appwrite.auth for location-type methods on platforms that support it (console), bypassing the authCount slice since this is a URL-embedding concern not an auth count. - Backend accepts both ?impersonateuserid (lowercase, emitted by the SDK template's caseLower filter) and ?impersonateUserId (camelCase, backwards compat) in request.php and realtime/connection.php. --- app/init/realtime/connection.php | 6 +++--- app/init/resources/request.php | 6 +++--- src/Appwrite/SDK/Specification/Format/Swagger2.php | 9 +++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index a090635bb5..87f7c78ab0 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -329,9 +329,9 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateuseremail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonateuserphone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 416c294140..ccc5ebf648 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -491,9 +491,9 @@ return function (Container $context): void { // Impersonation: if current user has impersonator capability and headers/params are set, act as another user // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateuseremail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonateuserphone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 20b1fb9b94..40aa1bf830 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -374,6 +374,15 @@ class Swagger2 extends Format } $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); + + // For location-type methods, embed ImpersonateUserId in the URL auth so the SDK + // automatically appends ?impersonateuserid= to generated URLs. Browsers cannot + // carry custom headers on resource requests (img src, href), so impersonation + // must fall back to a query parameter for file view/preview/download. + if ($sdk->getType() === MethodType::LOCATION && \array_key_exists('ImpersonateUserId', $this->keys)) { + $temp['x-appwrite']['auth']['ImpersonateUserId'] = []; + } + $temp['security'][] = $securities; } From 337d03e86167629543a4f6dc59b02fa0c2debc9f Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 13:29:33 +0530 Subject: [PATCH 027/151] test: add E2E coverage for impersonateUserId query param variants Tests header-based impersonation (unchanged), lowercase ?impersonateuserid= (SDK caseLower output), camelCase ?impersonateUserId= (backward compat), and that header takes priority when both are present. --- .../Services/Users/UsersConsoleClientTest.php | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/tests/e2e/Services/Users/UsersConsoleClientTest.php b/tests/e2e/Services/Users/UsersConsoleClientTest.php index 24e0f6868b..6f848390c5 100644 --- a/tests/e2e/Services/Users/UsersConsoleClientTest.php +++ b/tests/e2e/Services/Users/UsersConsoleClientTest.php @@ -81,4 +81,107 @@ class UsersConsoleClientTest extends Scope $this->assertEquals($userId, $set['body']['$id']); $this->assertNotEmpty($set['body']['password']); } + + /** + * Test that impersonation works via: + * - X-Appwrite-Impersonate-User-Id header (existing behavior, unchanged) + * - ?impersonateuserid= query param (lowercase, emitted by the SDK caseLower filter) + * - ?impersonateUserId= query param (camelCase, backward compat) + * + * The query param variants are the key addition of this PR — they allow Console + * to embed impersonation in file/image URLs where browsers cannot set custom headers. + */ + public function testImpersonateUserIdQueryParam(): void + { + $projectId = $this->getProject()['$id']; + $headers = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + // Create actor (impersonator) + $actorId = ID::unique(); + $actor = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $actorId, + 'email' => 'impersonator-queryparam-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Impersonator', + ]); + $this->assertEquals(201, $actor['headers']['status-code']); + + // Create target + $targetId = ID::unique(); + $target = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $targetId, + 'email' => 'target-queryparam-' . $targetId . '@example.com', + 'password' => 'password123', + 'name' => 'Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + // Grant impersonator capability + $grant = $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ + 'impersonator' => true, + ]); + $this->assertEquals(200, $grant['headers']['status-code']); + + // Create server-side session for actor + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $headers); + $this->assertEquals(201, $session['headers']['status-code']); + $sessionSecret = $session['body']['secret']; + + $sessionHeaders = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $sessionSecret, + ]; + + // Header-based impersonation — existing behavior, must still work + $byHeader = $this->client->call(Client::METHOD_GET, '/account', array_merge($sessionHeaders, [ + 'x-appwrite-impersonate-user-id' => $targetId, + ])); + $this->assertEquals(200, $byHeader['headers']['status-code']); + $this->assertEquals($targetId, $byHeader['body']['$id']); + $this->assertEquals($actorId, $byHeader['body']['impersonatorUserId']); + + // ?impersonateuserid= (lowercase) — emitted by SDK caseLower filter on LOCATION methods + $byLowerParam = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $byLowerParam['headers']['status-code']); + $this->assertEquals($targetId, $byLowerParam['body']['$id']); + $this->assertEquals($actorId, $byLowerParam['body']['impersonatorUserId']); + + // ?impersonateUserId= (camelCase) — backward compat + $byCamelParam = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateUserId' => $targetId, + ]); + $this->assertEquals(200, $byCamelParam['headers']['status-code']); + $this->assertEquals($targetId, $byCamelParam['body']['$id']); + $this->assertEquals($actorId, $byCamelParam['body']['impersonatorUserId']); + + // Header takes priority over query param when both are present + $actorId2 = ID::unique(); + $actor2 = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $actorId2, + 'email' => 'impersonator2-' . $actorId2 . '@example.com', + 'password' => 'password123', + 'name' => 'Impersonator2', + ]); + $this->assertEquals(201, $actor2['headers']['status-code']); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ + 'impersonator' => true, + ]); + + $priority = $this->client->call( + Client::METHOD_GET, + '/account', + array_merge($sessionHeaders, ['x-appwrite-impersonate-user-id' => $targetId]), + ['impersonateuserid' => $actorId2] + ); + $this->assertEquals(200, $priority['headers']['status-code']); + $this->assertEquals($targetId, $priority['body']['$id'], 'header must take priority over query param'); + } } From 11ee2c3ea209c52a40d83bed40259c248e44cb7a Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 13:31:01 +0530 Subject: [PATCH 028/151] refactor: simplify priority test, remove redundant user and PATCH call --- .../Services/Users/UsersConsoleClientTest.php | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/tests/e2e/Services/Users/UsersConsoleClientTest.php b/tests/e2e/Services/Users/UsersConsoleClientTest.php index 6f848390c5..67846c49dd 100644 --- a/tests/e2e/Services/Users/UsersConsoleClientTest.php +++ b/tests/e2e/Services/Users/UsersConsoleClientTest.php @@ -161,25 +161,14 @@ class UsersConsoleClientTest extends Scope $this->assertEquals($targetId, $byCamelParam['body']['$id']); $this->assertEquals($actorId, $byCamelParam['body']['impersonatorUserId']); - // Header takes priority over query param when both are present - $actorId2 = ID::unique(); - $actor2 = $this->client->call(Client::METHOD_POST, '/users', $headers, [ - 'userId' => $actorId2, - 'email' => 'impersonator2-' . $actorId2 . '@example.com', - 'password' => 'password123', - 'name' => 'Impersonator2', - ]); - $this->assertEquals(201, $actor2['headers']['status-code']); - - $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ - 'impersonator' => true, - ]); - + // Header takes priority over query param when both are present. + // Pass actorId as the decoy in ?impersonateuserid= and targetId in the header — + // the response must be targetId, not actorId. $priority = $this->client->call( Client::METHOD_GET, '/account', array_merge($sessionHeaders, ['x-appwrite-impersonate-user-id' => $targetId]), - ['impersonateuserid' => $actorId2] + ['impersonateuserid' => $actorId] ); $this->assertEquals(200, $priority['headers']['status-code']); $this->assertEquals($targetId, $priority['body']['$id'], 'header must take priority over query param'); From c6e79ad0dc83f08986ca879e58519d202ef66223 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 13:38:14 +0530 Subject: [PATCH 029/151] fix: remove dead lowercase email/phone params, align Swagger security array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Drop impersonateuseremail/impersonateuserphone lowercase fallbacks — only impersonateuserid has a spec entry for LOCATION methods so the others were dead code expanding the accepted query surface - Add ImpersonateUserId to $securities so the standard Swagger security array matches x-appwrite.auth for LOCATION methods --- app/init/realtime/connection.php | 4 ++-- app/init/resources/request.php | 4 ++-- src/Appwrite/SDK/Specification/Format/Swagger2.php | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index 87f7c78ab0..db0b209a4e 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -330,8 +330,8 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateuseremail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonateuserphone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index ccc5ebf648..59f6a90c13 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -492,8 +492,8 @@ return function (Container $context): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateuseremail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonateuserphone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 40aa1bf830..5774185332 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -375,11 +375,12 @@ class Swagger2 extends Format $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); - // For location-type methods, embed ImpersonateUserId in the URL auth so the SDK - // automatically appends ?impersonateuserid= to generated URLs. Browsers cannot - // carry custom headers on resource requests (img src, href), so impersonation - // must fall back to a query parameter for file view/preview/download. + // For location-type methods, embed ImpersonateUserId in both x-appwrite.auth + // and the standard Swagger security array so the SDK appends ?impersonateuserid= + // to generated URLs. Browsers cannot carry custom headers on resource requests + // (img src, href), so impersonation must fall back to a query param. if ($sdk->getType() === MethodType::LOCATION && \array_key_exists('ImpersonateUserId', $this->keys)) { + $securities['ImpersonateUserId'] = []; $temp['x-appwrite']['auth']['ImpersonateUserId'] = []; } From 67d3cf442ed0ec222ae954c60abda3e6f4a7c358 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 14:53:53 +0530 Subject: [PATCH 030/151] feat: support impersonation via URL query params for all three variants - Accept ?impersonateuserid=, ?impersonateemail=, ?impersonatephone= (lowercase) and their camelCase equivalents as query param fallbacks for the impersonation headers, mirroring the ?project= / ?devKey= pattern - Swagger2 spec injects all three impersonation keys into x-appwrite.auth and the standard security array for LOCATION-type methods - Remove unused ApiVectorsDB trait left behind after VectorsDB test deletion - Add E2E tests: query param variants (userId/email/phone), header priority, and storage file preview/view via ?impersonateuserid= --- app/init/realtime/connection.php | 4 +- app/init/resources/request.php | 4 +- .../SDK/Specification/Format/Swagger2.php | 18 +-- tests/e2e/Scopes/ApiVectorsDB.php | 110 ------------------ .../Storage/StorageConsoleClientTest.php | 80 +++++++++++++ .../Services/Users/UsersConsoleClientTest.php | 61 +++++----- 6 files changed, 121 insertions(+), 156 deletions(-) delete mode 100644 tests/e2e/Scopes/ApiVectorsDB.php diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index db0b209a4e..ea00b7f356 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -330,8 +330,8 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 59f6a90c13..f7a98e0f8f 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -492,8 +492,8 @@ return function (Container $context): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 5774185332..53156eb976 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -375,13 +375,17 @@ class Swagger2 extends Format $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); - // For location-type methods, embed ImpersonateUserId in both x-appwrite.auth - // and the standard Swagger security array so the SDK appends ?impersonateuserid= - // to generated URLs. Browsers cannot carry custom headers on resource requests - // (img src, href), so impersonation must fall back to a query param. - if ($sdk->getType() === MethodType::LOCATION && \array_key_exists('ImpersonateUserId', $this->keys)) { - $securities['ImpersonateUserId'] = []; - $temp['x-appwrite']['auth']['ImpersonateUserId'] = []; + // For location-type methods, embed all impersonation keys in both x-appwrite.auth + // and the standard Swagger security array so the SDK appends the corresponding + // query params to generated URLs. Browsers cannot carry custom headers on resource + // requests (img src, href), so impersonation must fall back to query params. + if ($sdk->getType() === MethodType::LOCATION) { + foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) { + if (\array_key_exists($key, $this->keys)) { + $securities[$key] = []; + $temp['x-appwrite']['auth'][$key] = []; + } + } } $temp['security'][] = $securities; diff --git a/tests/e2e/Scopes/ApiVectorsDB.php b/tests/e2e/Scopes/ApiVectorsDB.php deleted file mode 100644 index 09494d3c10..0000000000 --- a/tests/e2e/Scopes/ApiVectorsDB.php +++ /dev/null @@ -1,110 +0,0 @@ -getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); } + + public function testFilePreviewWithImpersonation(): void + { + $projectId = $this->getProject()['$id']; + $adminHeaders = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + $targetId = ID::unique(); + $target = $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $targetId, + 'email' => 'impersonation-storage-target-' . $targetId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + $actorId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $actorId, + 'email' => 'impersonation-storage-actor-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Actor', + ]); + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $adminHeaders, [ + 'impersonator' => true, + ]); + + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', $adminHeaders, [ + 'bucketId' => ID::unique(), + 'name' => 'Impersonation Test Bucket', + 'fileSecurity' => true, + 'permissions' => [ + Permission::read(Role::any()), + Permission::create(Role::any()), + ], + ]); + $this->assertEquals(201, $bucket['headers']['status-code']); + $bucketId = $bucket['body']['$id']; + + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge( + $adminHeaders, + ['content-type' => 'multipart/form-data'] + ), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::user($targetId)), + ], + ]); + $this->assertEquals(201, $file['headers']['status-code']); + $fileId = $file['body']['$id']; + + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $adminHeaders); + $this->assertEquals(201, $session['headers']['status-code']); + + $sessionHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $session['body']['secret'], + ]; + + $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); + $this->assertEquals(401, $denied['headers']['status-code']); + + $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $preview['headers']['status-code']); + $this->assertEquals('image/png', $preview['headers']['content-type']); + $this->assertNotEmpty($preview['body']); + + $view = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $view['headers']['status-code']); + } } diff --git a/tests/e2e/Services/Users/UsersConsoleClientTest.php b/tests/e2e/Services/Users/UsersConsoleClientTest.php index 67846c49dd..042ca6f124 100644 --- a/tests/e2e/Services/Users/UsersConsoleClientTest.php +++ b/tests/e2e/Services/Users/UsersConsoleClientTest.php @@ -82,16 +82,7 @@ class UsersConsoleClientTest extends Scope $this->assertNotEmpty($set['body']['password']); } - /** - * Test that impersonation works via: - * - X-Appwrite-Impersonate-User-Id header (existing behavior, unchanged) - * - ?impersonateuserid= query param (lowercase, emitted by the SDK caseLower filter) - * - ?impersonateUserId= query param (camelCase, backward compat) - * - * The query param variants are the key addition of this PR — they allow Console - * to embed impersonation in file/image URLs where browsers cannot set custom headers. - */ - public function testImpersonateUserIdQueryParam(): void + public function testImpersonateQueryParams(): void { $projectId = $this->getProject()['$id']; $headers = array_merge([ @@ -99,7 +90,6 @@ class UsersConsoleClientTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()); - // Create actor (impersonator) $actorId = ID::unique(); $actor = $this->client->call(Client::METHOD_POST, '/users', $headers, [ 'userId' => $actorId, @@ -109,35 +99,36 @@ class UsersConsoleClientTest extends Scope ]); $this->assertEquals(201, $actor['headers']['status-code']); - // Create target $targetId = ID::unique(); + $targetEmail = 'target-queryparam-' . $targetId . '@example.com'; + $targetPhone = '+1' . rand(2000000000, 2999999999); + $target = $this->client->call(Client::METHOD_POST, '/users', $headers, [ 'userId' => $targetId, - 'email' => 'target-queryparam-' . $targetId . '@example.com', + 'email' => $targetEmail, 'password' => 'password123', 'name' => 'Target', ]); $this->assertEquals(201, $target['headers']['status-code']); - // Grant impersonator capability - $grant = $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ + $this->client->call(Client::METHOD_PATCH, '/users/' . $targetId . '/phone', $headers, [ + 'number' => $targetPhone, + ]); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ 'impersonator' => true, ]); - $this->assertEquals(200, $grant['headers']['status-code']); - // Create server-side session for actor $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $headers); $this->assertEquals(201, $session['headers']['status-code']); - $sessionSecret = $session['body']['secret']; $sessionHeaders = [ 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, - 'x-appwrite-session' => $sessionSecret, + 'x-appwrite-session' => $session['body']['secret'], ]; - // Header-based impersonation — existing behavior, must still work $byHeader = $this->client->call(Client::METHOD_GET, '/account', array_merge($sessionHeaders, [ 'x-appwrite-impersonate-user-id' => $targetId, ])); @@ -145,25 +136,25 @@ class UsersConsoleClientTest extends Scope $this->assertEquals($targetId, $byHeader['body']['$id']); $this->assertEquals($actorId, $byHeader['body']['impersonatorUserId']); - // ?impersonateuserid= (lowercase) — emitted by SDK caseLower filter on LOCATION methods - $byLowerParam = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + $byUserId = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ 'impersonateuserid' => $targetId, ]); - $this->assertEquals(200, $byLowerParam['headers']['status-code']); - $this->assertEquals($targetId, $byLowerParam['body']['$id']); - $this->assertEquals($actorId, $byLowerParam['body']['impersonatorUserId']); + $this->assertEquals(200, $byUserId['headers']['status-code']); + $this->assertEquals($targetId, $byUserId['body']['$id']); - // ?impersonateUserId= (camelCase) — backward compat - $byCamelParam = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ - 'impersonateUserId' => $targetId, + $byEmail = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateemail' => $targetEmail, ]); - $this->assertEquals(200, $byCamelParam['headers']['status-code']); - $this->assertEquals($targetId, $byCamelParam['body']['$id']); - $this->assertEquals($actorId, $byCamelParam['body']['impersonatorUserId']); + $this->assertEquals(200, $byEmail['headers']['status-code']); + $this->assertEquals($targetId, $byEmail['body']['$id']); - // Header takes priority over query param when both are present. - // Pass actorId as the decoy in ?impersonateuserid= and targetId in the header — - // the response must be targetId, not actorId. + $byPhone = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonatephone' => $targetPhone, + ]); + $this->assertEquals(200, $byPhone['headers']['status-code']); + $this->assertEquals($targetId, $byPhone['body']['$id']); + + // header takes priority over query param $priority = $this->client->call( Client::METHOD_GET, '/account', @@ -171,6 +162,6 @@ class UsersConsoleClientTest extends Scope ['impersonateuserid' => $actorId] ); $this->assertEquals(200, $priority['headers']['status-code']); - $this->assertEquals($targetId, $priority['body']['$id'], 'header must take priority over query param'); + $this->assertEquals($targetId, $priority['body']['$id']); } } From bc20e41e8339fc605d8ceb4890c5a913bead1dc4 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 17:16:09 +0530 Subject: [PATCH 031/151] fix: remove bucket read permission so file-level 401 fires correctly --- tests/e2e/Services/Storage/StorageConsoleClientTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 8b20ce5c24..a0e6c84a97 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -232,7 +232,6 @@ class StorageConsoleClientTest extends Scope 'name' => 'Impersonation Test Bucket', 'fileSecurity' => true, 'permissions' => [ - Permission::read(Role::any()), Permission::create(Role::any()), ], ]); From 390c1e6a4e8d60f5a3b22aeea92dacfd5b117d8c Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 17:19:02 +0530 Subject: [PATCH 032/151] revert: restore ApiVectorsDB trait present on 1.9.x --- tests/e2e/Scopes/ApiVectorsDB.php | 110 ++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 tests/e2e/Scopes/ApiVectorsDB.php diff --git a/tests/e2e/Scopes/ApiVectorsDB.php b/tests/e2e/Scopes/ApiVectorsDB.php new file mode 100644 index 0000000000..09494d3c10 --- /dev/null +++ b/tests/e2e/Scopes/ApiVectorsDB.php @@ -0,0 +1,110 @@ + Date: Thu, 4 Jun 2026 17:26:22 +0530 Subject: [PATCH 033/151] fix: accept 401 or 404 for denied file access without impersonation --- tests/e2e/Services/Storage/StorageConsoleClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index a0e6c84a97..0f5d763425 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -261,7 +261,7 @@ class StorageConsoleClientTest extends Scope ]; $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); - $this->assertEquals(401, $denied['headers']['status-code']); + $this->assertContains($denied['headers']['status-code'], [401, 404]); $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ 'impersonateuserid' => $targetId, From bfc8f82e37e73d089c06134e6cef0c03850cf5d9 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 17:27:28 +0530 Subject: [PATCH 034/151] fix: restore bucket read permission for consistent 401 on file access --- tests/e2e/Services/Storage/StorageConsoleClientTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 0f5d763425..8b20ce5c24 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -232,6 +232,7 @@ class StorageConsoleClientTest extends Scope 'name' => 'Impersonation Test Bucket', 'fileSecurity' => true, 'permissions' => [ + Permission::read(Role::any()), Permission::create(Role::any()), ], ]); @@ -261,7 +262,7 @@ class StorageConsoleClientTest extends Scope ]; $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); - $this->assertContains($denied['headers']['status-code'], [401, 404]); + $this->assertEquals(401, $denied['headers']['status-code']); $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ 'impersonateuserid' => $targetId, From d32139bfd9f32b961d0948c4fb32d2be4b2611b0 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 17:42:41 +0530 Subject: [PATCH 035/151] fix: restrict bucket read to target user so actor gets 401 without impersonation --- tests/e2e/Services/Storage/StorageConsoleClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 8b20ce5c24..ee9d43923e 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -232,7 +232,7 @@ class StorageConsoleClientTest extends Scope 'name' => 'Impersonation Test Bucket', 'fileSecurity' => true, 'permissions' => [ - Permission::read(Role::any()), + Permission::read(Role::user($targetId)), Permission::create(Role::any()), ], ]); From 0f0e27f39b7eb89040fa47920573a53e9a327685 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Thu, 4 Jun 2026 17:50:04 +0530 Subject: [PATCH 036/151] fix: expect 404 for actor without bucket access --- tests/e2e/Services/Storage/StorageConsoleClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index ee9d43923e..6f9b9e9085 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -262,7 +262,7 @@ class StorageConsoleClientTest extends Scope ]; $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); - $this->assertEquals(401, $denied['headers']['status-code']); + $this->assertEquals(404, $denied['headers']['status-code']); $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ 'impersonateuserid' => $targetId, From 9aef57f3594bb54ac55e37ffa0fa240497449e19 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 13:43:05 +0530 Subject: [PATCH 037/151] feat: add impersonation keys to LOCATION methods in OpenAPI3 spec --- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index dfa38b0bf5..8e8d5e6301 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -384,6 +384,16 @@ class OpenAPI3 extends Format } $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); + + if ($sdk->getType() === MethodType::LOCATION) { + foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) { + if (\array_key_exists($key, $this->keys)) { + $securities[$key] = []; + $temp['x-appwrite']['auth'][$key] = []; + } + } + } + $temp['security'][] = $securities; } From d2fe065de8f10ac67d2a0f2e9f46f00f299a6cdd Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 14:50:05 +0530 Subject: [PATCH 038/151] style: remove comment from LOCATION impersonation block --- src/Appwrite/SDK/Specification/Format/Swagger2.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 53156eb976..7fc23b0d99 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -375,10 +375,6 @@ class Swagger2 extends Format $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); - // For location-type methods, embed all impersonation keys in both x-appwrite.auth - // and the standard Swagger security array so the SDK appends the corresponding - // query params to generated URLs. Browsers cannot carry custom headers on resource - // requests (img src, href), so impersonation must fall back to query params. if ($sdk->getType() === MethodType::LOCATION) { foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) { if (\array_key_exists($key, $this->keys)) { From 55d3af2f598e62097a568e11fe1fb4b01780a76b Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 14:50:54 +0530 Subject: [PATCH 039/151] style: add brief comment to LOCATION impersonation block --- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 1 + src/Appwrite/SDK/Specification/Format/Swagger2.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 8e8d5e6301..b852a72658 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -385,6 +385,7 @@ class OpenAPI3 extends Format $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); + // Impersonation falls back to query params for location-type methods (browsers can't set headers on resource URLs) if ($sdk->getType() === MethodType::LOCATION) { foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) { if (\array_key_exists($key, $this->keys)) { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 7fc23b0d99..31e5e5de07 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -375,6 +375,7 @@ class Swagger2 extends Format $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); + // Impersonation falls back to query params for location-type methods (browsers can't set headers on resource URLs) if ($sdk->getType() === MethodType::LOCATION) { foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) { if (\array_key_exists($key, $this->keys)) { From 18dfaedc376553c7ee702ad41917e4782f597314 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 15:01:45 +0530 Subject: [PATCH 040/151] refactor: use Query security scheme variants for impersonation on LOCATION methods --- src/Appwrite/Platform/Tasks/Specs.php | 54 +++++++++++++++++++ .../SDK/Specification/Format/OpenAPI3.php | 3 +- .../SDK/Specification/Format/Swagger2.php | 3 +- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 8717ae742e..ffe8757a78 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -181,18 +181,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserIdQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], APP_SDK_PLATFORM_SERVER => [ 'Project' => [ @@ -255,18 +273,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserIdQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], APP_SDK_PLATFORM_CONSOLE => [ 'Project' => [ @@ -329,18 +365,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserIdQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], ]; } diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index b852a72658..c40c44b85e 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -385,9 +385,8 @@ class OpenAPI3 extends Format $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); - // Impersonation falls back to query params for location-type methods (browsers can't set headers on resource URLs) if ($sdk->getType() === MethodType::LOCATION) { - foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) { + foreach (['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] as $key) { if (\array_key_exists($key, $this->keys)) { $securities[$key] = []; $temp['x-appwrite']['auth'][$key] = []; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 31e5e5de07..ca2643222a 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -375,9 +375,8 @@ class Swagger2 extends Format $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); - // Impersonation falls back to query params for location-type methods (browsers can't set headers on resource URLs) if ($sdk->getType() === MethodType::LOCATION) { - foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) { + foreach (['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] as $key) { if (\array_key_exists($key, $this->keys)) { $securities[$key] = []; $temp['x-appwrite']['auth'][$key] = []; From 529847df95d950afc58da5f7bd75186bb804f703 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 18:02:18 +0530 Subject: [PATCH 041/151] refactor: add locationAuth to Method.php, use getLocationAuth() in spec formatters --- src/Appwrite/SDK/Method.php | 9 ++++++++- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 2 +- src/Appwrite/SDK/Specification/Format/Swagger2.php | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index 5f6ccf9a0f..97283dfb4a 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -33,6 +33,7 @@ class Method * @param string $desc * @param bool $public Whether this method should be rendered on the website/documentation * @param string $projectAuth Project authentication security scheme to use in specs + * @param array $locationAuth Additional security scheme keys injected for location-type methods */ public function __construct( protected string $namespace, @@ -51,7 +52,8 @@ class Method protected array $additionalParameters = [], protected string $desc = '', protected bool $public = true, - protected string $projectAuth = 'Project' + protected string $projectAuth = 'Project', + protected array $locationAuth = ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); @@ -234,6 +236,11 @@ class Method return $this->projectAuth; } + public function getLocationAuth(): array + { + return $this->locationAuth; + } + public function setNamespace(string $namespace): self { $this->namespace = $namespace; diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index c40c44b85e..cf83c3ea96 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -386,7 +386,7 @@ class OpenAPI3 extends Format $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); if ($sdk->getType() === MethodType::LOCATION) { - foreach (['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] as $key) { + foreach ($sdk->getLocationAuth() as $key) { if (\array_key_exists($key, $this->keys)) { $securities[$key] = []; $temp['x-appwrite']['auth'][$key] = []; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index ca2643222a..0c4c423de1 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -376,7 +376,7 @@ class Swagger2 extends Format $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); if ($sdk->getType() === MethodType::LOCATION) { - foreach (['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] as $key) { + foreach ($sdk->getLocationAuth() as $key) { if (\array_key_exists($key, $this->keys)) { $securities[$key] = []; $temp['x-appwrite']['auth'][$key] = []; From ead39142cd79a150eafd10c96178faaab7c2ee04 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 18:14:28 +0530 Subject: [PATCH 042/151] refactor: explicitly set locationAuth on all LOCATION methods, remove default --- src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php | 1 + .../Modules/Functions/Http/Deployments/Download/Get.php | 3 ++- .../Platform/Modules/Sites/Http/Deployments/Download/Get.php | 1 + .../Modules/Storage/Http/Buckets/Files/Download/Get.php | 3 ++- .../Modules/Storage/Http/Buckets/Files/Preview/Get.php | 1 + .../Platform/Modules/Storage/Http/Buckets/Files/View/Get.php | 3 ++- src/Appwrite/SDK/Method.php | 2 +- 14 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index cc30f014bc..70f8a40e2c 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 3bae32c862..4cedbb42b1 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 6faa0fe223..2dcb797f7a 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,6 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index ef9f8c0e47..6b2b76bc2f 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 315202d4d5..9b7bee8be0 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,6 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index c73d20fb0c..0b6df2353f 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,6 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index f3448f5264..86315c7101 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 51d4df2a49..33ebcd73ab 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,6 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index c92e3c1406..b246ccb0dc 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -52,7 +52,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 0ab998292d..13aa754d12 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,6 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 7e5d7d6879..22dcb3e3aa 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -57,7 +57,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 9c316a3b57..bee4798b9e 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,6 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index b78d582c47..ea228e2ebd 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -58,7 +58,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index 97283dfb4a..ce793ee113 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -53,7 +53,7 @@ class Method protected string $desc = '', protected bool $public = true, protected string $projectAuth = 'Project', - protected array $locationAuth = ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] + protected array $locationAuth = [] ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); From dfbba81e91760cf674fbdbdbcb69ebaf66167ae0 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Sat, 6 Jun 2026 12:19:42 +0530 Subject: [PATCH 043/151] refactor: fold projectAuth into locationAuth array, single property per method --- .../Platform/Modules/Avatars/Http/Browsers/Get.php | 2 +- .../Platform/Modules/Avatars/Http/CreditCards/Get.php | 2 +- .../Platform/Modules/Avatars/Http/Favicon/Get.php | 2 +- .../Platform/Modules/Avatars/Http/Flags/Get.php | 2 +- .../Platform/Modules/Avatars/Http/Image/Get.php | 2 +- .../Platform/Modules/Avatars/Http/Initials/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php | 2 +- .../Platform/Modules/Avatars/Http/Screenshots/Get.php | 2 +- .../Functions/Http/Deployments/Download/Get.php | 2 +- .../Modules/Sites/Http/Deployments/Download/Get.php | 2 +- .../Storage/Http/Buckets/Files/Download/Get.php | 2 +- .../Modules/Storage/Http/Buckets/Files/Preview/Get.php | 2 +- .../Modules/Storage/Http/Buckets/Files/View/Get.php | 2 +- src/Appwrite/SDK/Method.php | 10 ++-------- 14 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index 70f8a40e2c..6bb6731c04 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 4cedbb42b1..304c47583b 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 2dcb797f7a..89e9c73ab8 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,7 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index 6b2b76bc2f..11d3b50a99 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 9b7bee8be0..64ced4cc68 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,7 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index 0b6df2353f..93ca892f6c 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,7 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index 86315c7101..67565220fc 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 33ebcd73ab..cf6b5e2b0a 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,7 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index b246ccb0dc..eb7d51921e 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -53,7 +53,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 13aa754d12..26987d145f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,7 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 22dcb3e3aa..e24b6819fa 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -58,7 +58,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index bee4798b9e..9c7c7ea1d1 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,7 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index ea228e2ebd..a0f2d3a0bc 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -59,7 +59,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index ce793ee113..e364c96163 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -32,8 +32,7 @@ class Method * @param array $additionalParameters * @param string $desc * @param bool $public Whether this method should be rendered on the website/documentation - * @param string $projectAuth Project authentication security scheme to use in specs - * @param array $locationAuth Additional security scheme keys injected for location-type methods + * @param array $locationAuth Security scheme keys injected for location-type methods (includes project auth) */ public function __construct( protected string $namespace, @@ -52,17 +51,12 @@ class Method protected array $additionalParameters = [], protected string $desc = '', protected bool $public = true, - protected string $projectAuth = 'Project', protected array $locationAuth = [] ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); $this->validateDesc($description); - if (!\in_array($projectAuth, ['Project', 'ProjectQuery'], true)) { - self::$errors[] = "Error with {$this->getRouteName()} method: Invalid project auth scheme"; - } - foreach ($responses as $response) { $this->validateResponseModel($response->getModel()); $this->validateNoContent($response); @@ -233,7 +227,7 @@ class Method public function getProjectAuth(): string { - return $this->projectAuth; + return $this->locationAuth[0] ?? 'Project'; } public function getLocationAuth(): array From c3c8fb5b9f9f213e919b7f1d23decc8e2de6e679 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Sat, 6 Jun 2026 19:36:54 +0530 Subject: [PATCH 044/151] refactor: rename ImpersonateUserIdQuery to ImpersonateUserQuery per ProjectQuery pattern --- src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php | 2 +- .../Platform/Modules/Avatars/Http/CreditCards/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php | 2 +- .../Platform/Modules/Avatars/Http/Screenshots/Get.php | 2 +- .../Modules/Functions/Http/Deployments/Download/Get.php | 2 +- .../Modules/Sites/Http/Deployments/Download/Get.php | 2 +- .../Modules/Storage/Http/Buckets/Files/Download/Get.php | 2 +- .../Modules/Storage/Http/Buckets/Files/Preview/Get.php | 2 +- .../Modules/Storage/Http/Buckets/Files/View/Get.php | 2 +- src/Appwrite/Platform/Tasks/Specs.php | 6 +++--- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index 6bb6731c04..2d66b5b21b 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 304c47583b..710c7cd61d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 89e9c73ab8..244f426c4d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,7 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index 11d3b50a99..dfeaff0f8a 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 64ced4cc68..3c791aa128 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,7 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index 93ca892f6c..792026577b 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,7 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index 67565220fc..b8f3d0247d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index cf6b5e2b0a..63d7d3f85e 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,7 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index eb7d51921e..8adff12784 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -53,7 +53,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 26987d145f..088bf6c499 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,7 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index e24b6819fa..a11560cd5a 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -58,7 +58,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 9c7c7ea1d1..dcc033260f 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,7 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index a0f2d3a0bc..a88b41b3bc 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -59,7 +59,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index ffe8757a78..fa3889125d 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -181,7 +181,7 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserIdQuery' => [ + 'ImpersonateUserQuery' => [ 'type' => 'apiKey', 'name' => 'impersonateUserId', 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', @@ -273,7 +273,7 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserIdQuery' => [ + 'ImpersonateUserQuery' => [ 'type' => 'apiKey', 'name' => 'impersonateUserId', 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', @@ -365,7 +365,7 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserIdQuery' => [ + 'ImpersonateUserQuery' => [ 'type' => 'apiKey', 'name' => 'impersonateUserId', 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', From 1d7ed046cbfe5b3be34faea02dd4df7ba6366c9f Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Sun, 7 Jun 2026 12:50:03 +0530 Subject: [PATCH 045/151] refactor: remove getProjectAuth(), use getLocationAuth()[0] directly in spec formatters --- src/Appwrite/SDK/Method.php | 5 ----- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 4 ++-- src/Appwrite/SDK/Specification/Format/Swagger2.php | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index e364c96163..f1b327513f 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -225,11 +225,6 @@ class Method return $this->additionalParameters; } - public function getProjectAuth(): string - { - return $this->locationAuth[0] ?? 'Project'; - } - public function getLocationAuth(): array { return $this->locationAuth; diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index cf83c3ea96..d9c2bf301e 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -188,7 +188,7 @@ class OpenAPI3 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { $methodSecurities[$security->value] = []; @@ -374,7 +374,7 @@ class OpenAPI3 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { /** @var AuthType $security */ diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 0c4c423de1..b1541d5ddb 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -188,7 +188,7 @@ class Swagger2 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { /** @var AuthType $security */ if (\array_key_exists($security->value, $this->keys)) { @@ -365,7 +365,7 @@ class Swagger2 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { From d96804c9cf35a454a08d914f87739a1bf648e962 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 7 Jun 2026 10:53:44 +0300 Subject: [PATCH 046/151] Clean orphan data --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 1213f78924..7cb03e0c73 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -280,6 +280,9 @@ abstract class ScheduleBase extends Action if ($resource->isEmpty()) { Console::error("Resource not found: projectId::{$schedule['projectId']} resourceId::{$schedule['resourceId']}"); unset($this->schedules[$sequence]); + + $dbForPlatform->deleteDocument('schedules', $schedule['$id']); + continue; } From 28cce233683a5a1916051366452602196a3da3b0 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 7 Jun 2026 10:55:43 +0300 Subject: [PATCH 047/151] Clean orphan data --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 7cb03e0c73..0d499f931e 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -279,10 +279,10 @@ abstract class ScheduleBase extends Action if ($resource->isEmpty()) { Console::error("Resource not found: projectId::{$schedule['projectId']} resourceId::{$schedule['resourceId']}"); - unset($this->schedules[$sequence]); - $dbForPlatform->deleteDocument('schedules', $schedule['$id']); + unset($this->schedules[$sequence]); + continue; } From 21bd4ef770262b02efcb1a3351c60429b3f66257 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 7 Jun 2026 10:56:01 +0300 Subject: [PATCH 048/151] line --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 0d499f931e..c1bde979e8 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -282,7 +282,6 @@ abstract class ScheduleBase extends Action $dbForPlatform->deleteDocument('schedules', $schedule['$id']); unset($this->schedules[$sequence]); - continue; } From 93d46fe1b0ae365b1a41999123eb5486d5166fef Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 7 Jun 2026 11:17:28 +0300 Subject: [PATCH 049/151] Use bulk --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index c1bde979e8..b09f806e73 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -244,6 +244,7 @@ abstract class ScheduleBase extends Action } // Only process updated/new schedules, not all schedules + $scheduleIdsToDelete = []; foreach ($updatedSequences as $sequence) { $schedule = $this->schedules[$sequence] ?? null; if ($schedule === null) { @@ -279,8 +280,7 @@ abstract class ScheduleBase extends Action if ($resource->isEmpty()) { Console::error("Resource not found: projectId::{$schedule['projectId']} resourceId::{$schedule['resourceId']}"); - $dbForPlatform->deleteDocument('schedules', $schedule['$id']); - + $scheduleIdsToDelete[] = $schedule['$id']; unset($this->schedules[$sequence]); continue; } @@ -288,6 +288,12 @@ abstract class ScheduleBase extends Action $this->schedules[$sequence]['resource'] = $resource; } + if (!empty($scheduleIdsToDelete)) { + $dbForPlatform->deleteDocuments('schedules', [ + Query::equal('$id', $scheduleIdsToDelete), + ]); + } + $lastSyncUpdate = $time; $duration = microtime(true) - $loadStart; $this->collectSchedulesTelemetryDuration->record($duration, ['initial' => $initialLoad, 'resourceType' => static::getSupportedResource()]); From d7fb42aa3d99ba3e94e14cce53689206f7484738 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 8 Jun 2026 00:19:51 +1200 Subject: [PATCH 050/151] refactor(databases): extract createMetadataCollection helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract the per-database metadata collection (`database_{internalId}`) creation from the database create action into a protected `createMetadataCollection` helper. Lets product overrides that provision a backend asynchronously (documentsdb, vectorsdb) initialise the metadata exactly like a standard create, instead of leaving it uninitialised — which makes the first collection create fail with "Missing collection attribute $collection". No behaviour change for the standard create path. Co-Authored-By: Claude Opus 4.8 --- .../Databases/Http/Databases/Create.php | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php index 294a6712a9..870ee4116e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php @@ -199,6 +199,24 @@ class Create extends Action $database = $dbForProject->getDocument('databases', $databaseId); + $this->createMetadataCollection($dbForProject, $database); + + $queueForEvents->setParam('databaseId', $database->getId()); + + $response + ->setStatusCode(SwooleResponse::STATUS_CODE_CREATED) + ->dynamic($database, UtopiaResponse::MODEL_DATABASE); + } + + /** + * Create the per-database metadata collection (`database_{internalId}`) that holds + * the database's collection definitions. Extracted so product overrides that + * provision a backend asynchronously (e.g. documentsdb, vectorsdb) can initialise + * the metadata exactly like a standard database create instead of leaving it + * uninitialised, which makes the first collection create fail. + */ + protected function createMetadataCollection(Database $dbForProject, Document $database): void + { $collections = $this->getDatabaseCollection(); if (empty($collections)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'The "collections" collection is not configured.'); @@ -217,19 +235,11 @@ class Create extends Action try { $dbForProject->createCollection('database_' . $database->getSequence(), $attributes, $indexes); } catch (DuplicateException) { - throw new Exception(Exception::DATABASE_ALREADY_EXISTS, params: [$databaseId]); + throw new Exception(Exception::DATABASE_ALREADY_EXISTS, params: [$database->getId()]); } catch (IndexException $e) { throw new Exception(Exception::INDEX_INVALID); } catch (LimitException) { - // TODO: @Jake, how do we handle this collection/table? - // there's no context awareness at this level on what the api is. - throw new Exception(Exception::COLLECTION_LIMIT_EXCEEDED, params: [$databaseId]); + throw new Exception(Exception::COLLECTION_LIMIT_EXCEEDED, params: [$database->getId()]); } - - $queueForEvents->setParam('databaseId', $database->getId()); - - $response - ->setStatusCode(SwooleResponse::STATUS_CODE_CREATED) - ->dynamic($database, UtopiaResponse::MODEL_DATABASE); } } From cd87b9942a3a6736163ec0603c90f0b86757e913 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sun, 7 Jun 2026 16:59:26 +0100 Subject: [PATCH 051/151] chore(span): upgrade utopia-php/span to 3.0 Span 3.0 removes `Span::addExporter()` and the static `Span::error()`, and lets `finish()` take the triggering error directly. - composer: span 1.1.* -> 3.0.* (pulls dns 1.7.3, the first dns release that allows span 3.0; it was the only package pinning span to 1.1.*) - app/init/span.php: addExporter(exporter, sampler) -> setExporters with the sampler passed as the exporter's constructor argument - replace removed static Span::error($e) with Span::current()?->setError($e) - in the self-contained request handlers (http onRequest, realtime onOpen and onMessage, interval task) pass the error to finish(error: ...) rather than setError; setError stays where finish() runs in a separate harness callback (worker error handler, http error handler) or where cleanup work runs between the error and finish (realtime onClose) - AGENTS.md: update tracing note (Span::error -> setError) Co-Authored-By: Claude Opus 4.8 (1M context) --- AGENTS.md | 2 +- app/controllers/general.php | 2 +- app/http.php | 5 +++-- app/init/span.php | 4 ++-- app/realtime.php | 18 ++++++++------- app/worker.php | 2 +- composer.json | 2 +- composer.lock | 28 ++++++++++++------------ src/Appwrite/Platform/Tasks/Interval.php | 5 +++-- 9 files changed, 36 insertions(+), 32 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b84bc89c3b..edaeff9ea5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -117,7 +117,7 @@ Common injections: `$response`, `$request`, `$dbForProject`, `$dbForPlatform`, ` ## Tracing with Utopia Span -In handlers, only call `Span::add($key, $value)`. **Never** call `Span::init`, `Span::error`, or `Span::finish` -- lifecycle is owned by the entry-point harness (`app/http.php`, `app/worker.php`, `app/realtime.php`, `Bus::dispatch`). For selective export, filter in the sampler in `app/init/span.php`. +In handlers, only call `Span::add($key, $value)`. **Never** call `Span::init`, `setError`, or `Span::finish` -- lifecycle is owned by the entry-point harness (`app/http.php`, `app/worker.php`, `app/realtime.php`, `Bus::dispatch`). For selective export, filter in the sampler in `app/init/span.php`. Keys are `snake_case` with dots only for child relationships: `project.id` (id of project), `storage.bucket.id`. No dot otherwise: `inbound_bytes`, not `inbound.bytes`. No camelCase, no bare top-level keys (`function.id`, not `functionId`). diff --git a/app/controllers/general.php b/app/controllers/general.php index 219c14774f..cb25803b4c 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1198,7 +1198,7 @@ Http::error() $line = $error->getLine(); $trace = $error->getTrace(); - Span::error($error); + Span::current()?->setError($error); switch ($class) { case Utopia\Http\Exception::class: diff --git a/app/http.php b/app/http.php index 6226026a16..a6fc6df13b 100644 --- a/app/http.php +++ b/app/http.php @@ -529,6 +529,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $app->setCompression(System::getEnv('_APP_COMPRESSION_ENABLED', 'enabled') === 'enabled'); $app->setCompressionMinSize(intval(System::getEnv('_APP_COMPRESSION_MIN_SIZE_BYTES', '1024'))); // 1KB + $error = null; try { $authorization = $app->context()->get('authorization'); @@ -542,7 +543,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $route = $app->match($request)?->route; Span::add('http.path', $route?->getPath() ?? 'unknown'); } catch (\Throwable $th) { - Span::error($th); + $error = $th; $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); @@ -631,7 +632,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $swooleResponse->end(\json_encode($output)); } finally { Span::add('http.response.code', $response->getStatusCode()); - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); diff --git a/app/init/span.php b/app/init/span.php index f6871badfa..4249daa2ac 100644 --- a/app/init/span.php +++ b/app/init/span.php @@ -12,7 +12,7 @@ $traceProjectId = System::getEnv('_APP_TRACE_PROJECT_ID', ''); $traceFunctionId = System::getEnv('_APP_TRACE_FUNCTION_ID', ''); $traceEnabled = $traceProjectId !== '' || $traceFunctionId !== ''; -Span::addExporter(new Exporter\Pretty(), function (Span $span) use ($traceEnabled, $traceProjectId, $traceFunctionId): bool { +Span::setExporters(new Exporter\Pretty(sampler: function (Span $span) use ($traceEnabled, $traceProjectId, $traceFunctionId): bool { if (\str_starts_with($span->getAction(), 'listener.')) { return $span->getError() !== null; } @@ -29,4 +29,4 @@ Span::addExporter(new Exporter\Pretty(), function (Span $span) use ($traceEnable } return true; -}); +})); diff --git a/app/realtime.php b/app/realtime.php index c99e4c0857..4d638818f5 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -845,6 +845,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, Span::add('realtime.origin', $request->getOrigin()); } + $error = null; try { /** @var Document $project */ $project = $connectionContainer->get('project'); @@ -1009,7 +1010,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $success = true; } catch (Throwable $th) { - Span::error($th); + $error = $th; // Convert known Utopia DB exceptions to AppwriteException so isPublishable() // suppresses expected client errors (permission denied, query timeout) from Sentry. @@ -1067,7 +1068,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, if (!empty($logUser?->getId())) { Span::add('user.id', $logUser->getId()); } - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); @@ -1086,6 +1087,7 @@ $server->onMessage(function (int $connection, string $message) use ($container, Span::add('realtime.inbound_bytes', $rawSize); Span::add('realtime.container.id', $containerId); + $error = null; try { $response = new Response(new SwooleResponse()); @@ -1213,7 +1215,7 @@ $server->onMessage(function (int $connection, string $message) use ($container, $success = true; } catch (Throwable $th) { - Span::error($th); + $error = $th; // Convert known Utopia DB exceptions to AppwriteException so isPublishable() // suppresses expected client errors (permission denied, query timeout) from Sentry. @@ -1259,7 +1261,7 @@ $server->onMessage(function (int $connection, string $message) use ($container, Span::add('project.id', $project?->getId() ?? $projectId); Span::add('user.id', $realtime->connections[$connection]['userId'] ?? null); Span::add('realtime.message_type', $messageType); - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); @@ -1346,7 +1348,7 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ ); $presenceState->triggerUsage($publisherForUsage, $project, -$deletionCount); } catch (Throwable $th) { - Span::error($th); + Span::current()?->setError($th); logError($th, 'realtimeOnClosePresenceDeletion', tags: [ 'projectId' => $projectId, 'presences' => \count($presences) @@ -1373,7 +1375,7 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ } } } catch (Throwable $th) { - Span::error($th); + Span::current()?->setError($th); logError($th, 'realtimeOnClosePresenceCleanup', tags: [ 'projectId' => $projectId, ]); @@ -1392,13 +1394,13 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ // Log only; do not rethrow. If we let this bubble, Swoole dumps full coroutine // backtraces and unsubscribe() below would never run (connection cleanup would fail). Console::error('Realtime onClose error: ' . $th->getMessage()); - Span::error($th); + Span::current()?->setError($th); } finally { try { $realtime->unsubscribe($connection); } catch (\Throwable $th) { Console::error('Realtime onClose unsubscribe error: ' . $th->getMessage()); - Span::error($th); + Span::current()?->setError($th); } Span::add('realtime.success', $success); diff --git a/app/worker.php b/app/worker.php index a7a1f7633d..999bcbc9c6 100644 --- a/app/worker.php +++ b/app/worker.php @@ -118,7 +118,7 @@ $worker ->action(function (Throwable $error, ?Logger $logger, Log $log, Document $project, Authorization $authorization) use ($queueName) { $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); - Span::error($error); + Span::current()?->setError($error); if ($logger) { $log->setNamespace('appwrite-worker'); diff --git a/composer.json b/composer.json index 431a175515..e1ab3c62ab 100644 --- a/composer.json +++ b/composer.json @@ -80,7 +80,7 @@ "utopia-php/migration": "1.*", "utopia-php/platform": "1.0.0-rc5", "utopia-php/pools": "1.*", - "utopia-php/span": "1.1.*", + "utopia-php/span": "3.0.*", "utopia-php/preloader": "0.2.*", "utopia-php/queue": "0.20.*", "utopia-php/servers": "0.4.*", diff --git a/composer.lock b/composer.lock index 1c01b85ed8..af1527d3cd 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": "182aa10ce3b77b8cf38eefc25944e939", + "content-hash": "e922d0ba4d0c7d12cc24cff52b552803", "packages": [ { "name": "adhocore/jwt", @@ -3839,22 +3839,22 @@ }, { "name": "utopia-php/dns", - "version": "1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/utopia-php/dns.git", - "reference": "5225f52a82d4128e69ad17c2a81fcfea6aa00ae1" + "reference": "5ee1c165b381c05fea1ad9dd62263a5a854786f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/dns/zipball/5225f52a82d4128e69ad17c2a81fcfea6aa00ae1", - "reference": "5225f52a82d4128e69ad17c2a81fcfea6aa00ae1", + "url": "https://api.github.com/repos/utopia-php/dns/zipball/5ee1c165b381c05fea1ad9dd62263a5a854786f8", + "reference": "5ee1c165b381c05fea1ad9dd62263a5a854786f8", "shasum": "" }, "require": { "php": ">=8.3", "utopia-php/domains": "^2.0", - "utopia-php/span": "1.1.*", + "utopia-php/span": "3.0.*", "utopia-php/telemetry": "*", "utopia-php/validators": "0.*" }, @@ -3890,9 +3890,9 @@ ], "support": { "issues": "https://github.com/utopia-php/dns/issues", - "source": "https://github.com/utopia-php/dns/tree/1.7.2" + "source": "https://github.com/utopia-php/dns/tree/1.7.3" }, - "time": "2026-05-20T04:49:11+00:00" + "time": "2026-06-07T14:02:16+00:00" }, { "name": "utopia-php/domains", @@ -4908,16 +4908,16 @@ }, { "name": "utopia-php/span", - "version": "1.1.5", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/utopia-php/span.git", - "reference": "028406940ca92bdc88099f0b1a123a3b2cbdd4e5" + "reference": "97f0ab6e9125c000262f8b5b007423d11fd1a9b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/span/zipball/028406940ca92bdc88099f0b1a123a3b2cbdd4e5", - "reference": "028406940ca92bdc88099f0b1a123a3b2cbdd4e5", + "url": "https://api.github.com/repos/utopia-php/span/zipball/97f0ab6e9125c000262f8b5b007423d11fd1a9b3", + "reference": "97f0ab6e9125c000262f8b5b007423d11fd1a9b3", "shasum": "" }, "require": { @@ -4946,9 +4946,9 @@ "description": "Simple span tracing library for PHP with coroutine support", "support": { "issues": "https://github.com/utopia-php/span/issues", - "source": "https://github.com/utopia-php/span/tree/1.1.5" + "source": "https://github.com/utopia-php/span/tree/3.0.1" }, - "time": "2026-02-13T18:00:11+00:00" + "time": "2026-05-13T11:53:06+00:00" }, { "name": "utopia-php/storage", diff --git a/src/Appwrite/Platform/Tasks/Interval.php b/src/Appwrite/Platform/Tasks/Interval.php index 836508c73d..aaf09c494e 100644 --- a/src/Appwrite/Platform/Tasks/Interval.php +++ b/src/Appwrite/Platform/Tasks/Interval.php @@ -60,12 +60,13 @@ class Interval extends Action $timers[] = Timer::tick($task['interval'], function () use ($task, $dbForPlatform, $getProjectDB, $publisherForCertificates) { $taskName = $task['name']; Span::init("interval.{$taskName}"); + $error = null; try { $task['callback']($dbForPlatform, $getProjectDB, $publisherForCertificates); } catch (\Exception $e) { - Span::error($e); + $error = $e; } finally { - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); } From 08a34b4c21df1c25355fb8fcf61bfc0fd640a3a2 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sun, 7 Jun 2026 17:42:09 +0100 Subject: [PATCH 052/151] ci: drive e2e_service matrix from generated service config Move the per-service E2E test config (runner size, paratest --functional flag, process count, timeout) out of the e2e_service job's hardcoded matrix list and scattered include/case blocks into the matrix job's generated `services` output. The e2e_service job now consumes that output, so each service is defined in one place. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 145 ++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 77 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5537f9ab5b..78e1ea5255 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -229,44 +229,74 @@ jobs: outputs: databases: ${{ steps.generate.outputs.databases }} modes: ${{ steps.generate.outputs.modes }} + services: ${{ steps.generate.outputs.services }} steps: - name: Generate matrix id: generate uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | - const allDatabases = ['MariaDB', 'PostgreSQL', 'MongoDB']; - const allModes = ['dedicated', 'shared']; + const runner4 = `runs-on=${context.runId}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel`; + const runner8 = `runs-on=${context.runId}/runner=8cpu-linux-x64/volume=120g/spot=false/extras=otel`; - const defaultDatabases = ['MongoDB']; - const defaultModes = ['dedicated']; + const services = [ + { name: 'Account', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Avatars', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Console', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Databases', runner: runner8, functional: false, processes: 3, timeout: 30 }, + { name: 'TablesDB', runner: runner8, functional: false, processes: 3, timeout: 30 }, + { name: 'Functions', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'FunctionsSchedule', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'GraphQL', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'Health', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Advisor', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Locale', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Projects', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Realtime', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'Sites', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Proxy', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Storage', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Tokens', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Teams', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Users', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'ProjectWebhooks', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'Webhooks', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'VCS', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Messaging', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Migrations', runner: runner4, functional: true, processes: 1, timeout: 20 }, + { name: 'Project', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Presences', runner: runner4, functional: true, processes: null, timeout: 20 }, + ]; + core.setOutput('services', JSON.stringify(services)); const pr = context.payload.pull_request; - if (!pr) { - core.setOutput('databases', JSON.stringify(allDatabases)); - core.setOutput('modes', JSON.stringify(allModes)); + + const isDatabaseVersionChanged = async () => { + const getContent = (ref) => github.rest.repos.getContent({ + owner: context.repo.owner, + repo: context.repo.repo, + path: 'composer.lock', + ref, + }); + + const getDbVersion = (lock) => lock.packages?.find(p => p.name === 'utopia-php/database')?.version; + const [{ data: base }, { data: head }] = await Promise.all([ + getContent(pr.base.sha), + getContent(pr.head.sha), + ]); + + const decode = (content) => JSON.parse(Buffer.from(content, 'base64').toString()); + return getDbVersion(decode(base.content)) !== getDbVersion(decode(head.content)); + }; + + if (!pr || await isDatabaseVersionChanged()) { + core.setOutput('databases', JSON.stringify(['MariaDB', 'PostgreSQL', 'MongoDB'])); + core.setOutput('modes', JSON.stringify(['dedicated', 'shared'])); return; } - const getContent = (ref) => github.rest.repos.getContent({ - owner: context.repo.owner, - repo: context.repo.repo, - path: 'composer.lock', - ref, - }); - - const getDbVersion = (lock) => lock.packages?.find(p => p.name === 'utopia-php/database')?.version; - - const [{ data: base }, { data: head }] = await Promise.all([ - getContent(pr.base.sha), - getContent(pr.head.sha), - ]); - - const decode = (content) => JSON.parse(Buffer.from(content, 'base64').toString()); - const databaseChanged = getDbVersion(decode(base.content)) !== getDbVersion(decode(head.content)); - - core.setOutput('databases', JSON.stringify(databaseChanged ? allDatabases : defaultDatabases)); - core.setOutput('modes', JSON.stringify(databaseChanged ? allModes : defaultModes)); + core.setOutput('databases', JSON.stringify(['MongoDB'])); + core.setOutput('modes', JSON.stringify(['dedicated'])); build: name: Build @@ -425,8 +455,8 @@ jobs: docker compose logs e2e_service: - name: Tests / E2E / ${{ matrix.database }} (${{ matrix.mode }}) / ${{ matrix.service }} - runs-on: ${{ matrix.runner || format('runs-on={0}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel', github.run_id) }} + name: Tests / E2E / ${{ matrix.database }} (${{ matrix.mode }}) / ${{ matrix.service.name }} + runs-on: ${{ matrix.service.runner }} needs: [build, matrix] permissions: contents: read @@ -437,45 +467,7 @@ jobs: matrix: database: ${{ fromJSON(needs.matrix.outputs.databases) }} mode: ${{ fromJSON(needs.matrix.outputs.modes) }} - service: [ - Account, - Avatars, - Console, - Databases, - TablesDB, - Functions, - FunctionsSchedule, - GraphQL, - Health, - Advisor, - Locale, - Projects, - Realtime, - Sites, - Proxy, - Storage, - Tokens, - Teams, - Users, - ProjectWebhooks, - Webhooks, - VCS, - Messaging, - Migrations, - Project, - Presences - ] - include: - - service: Databases - runner: runs-on=${{ github.run_id }}/runner=8cpu-linux-x64/volume=120g/spot=false/extras=otel - paratest_processes: 3 - timeout_minutes: 30 - - service: TablesDB - runner: runs-on=${{ github.run_id }}/runner=8cpu-linux-x64/volume=120g/spot=false/extras=otel - paratest_processes: 3 - timeout_minutes: 30 - - service: Migrations - paratest_processes: 1 + service: ${{ fromJSON(needs.matrix.outputs.services) }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -543,20 +535,19 @@ jobs: with: max_attempts: 2 retry_wait_seconds: 60 - timeout_minutes: ${{ matrix.timeout_minutes || 20 }} + timeout_minutes: ${{ matrix.service.timeout }} job_id: ${{ job.check_run_id }} github_token: ${{ secrets.GITHUB_TOKEN }} - test_dir: tests/e2e/Services/${{ matrix.service }} + test_dir: tests/e2e/Services/${{ matrix.service.name }} command: | - SERVICE_PATH="/usr/src/code/tests/e2e/Services/${{ matrix.service }}" + SERVICE_PATH="/usr/src/code/tests/e2e/Services/${{ matrix.service.name }}" - # Services that rely on sequential test method execution (shared static state) - FUNCTIONAL_FLAG="--functional" - case "${{ matrix.service }}" in - Databases|TablesDB|Functions|Realtime|GraphQL|ProjectWebhooks) FUNCTIONAL_FLAG="" ;; - esac + FUNCTIONAL_FLAG="" + if [ "${{ matrix.service.functional }}" = "true" ]; then + FUNCTIONAL_FLAG="--functional" + fi - PARATEST_PROCESSES="${{ matrix.paratest_processes }}" + PARATEST_PROCESSES="${{ matrix.service.processes }}" if [ -z "$PARATEST_PROCESSES" ]; then PARATEST_PROCESSES="$(nproc)" fi @@ -565,7 +556,7 @@ jobs: -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ -e _TESTS_OAUTH2_GITHUB_CLIENT_ID="${{ secrets.TESTS_OAUTH2_GITHUB_CLIENT_ID }}" \ -e _TESTS_OAUTH2_GITHUB_CLIENT_SECRET="${{ secrets.TESTS_OAUTH2_GITHUB_CLIENT_SECRET }}" \ - appwrite vendor/bin/paratest --processes "$PARATEST_PROCESSES" $FUNCTIONAL_FLAG "$SERVICE_PATH" --exclude-group abuseEnabled --exclude-group screenshots --log-junit tests/e2e/Services/${{ matrix.service }}/junit.xml + appwrite vendor/bin/paratest --processes "$PARATEST_PROCESSES" $FUNCTIONAL_FLAG "$SERVICE_PATH" --exclude-group abuseEnabled --exclude-group screenshots --log-junit tests/e2e/Services/${{ matrix.service.name }}/junit.xml - name: Failure Logs if: failure() From 44574d0f41dd8dd05c59f8f18fbf705a236786a3 Mon Sep 17 00:00:00 2001 From: "Luke B. Silver" <22452787+loks0n@users.noreply.github.com> Date: Sun, 7 Jun 2026 17:54:51 +0100 Subject: [PATCH 053/151] Bump appwrite/base to 1.4.2 Patches curl/libxml2/xz/nghttp2 CVEs via appwrite/docker-base#72. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9a61635415..7e91ed6163 100755 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \ --no-plugins --no-scripts --prefer-dist \ `if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi` -FROM appwrite/base:1.4.1 AS base +FROM appwrite/base:1.4.2 AS base LABEL maintainer="team@appwrite.io" From ac00aa34f171efad142f8919def0a55827b5085b Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Mon, 8 Jun 2026 10:18:01 +0530 Subject: [PATCH 054/151] Revert "feat: embed impersonateUserId in location-type SDK method URLs" (#12521) --- app/init/realtime/connection.php | 6 +- app/init/resources/request.php | 6 +- .../Modules/Avatars/Http/Browsers/Get.php | 1 - .../Modules/Avatars/Http/CreditCards/Get.php | 1 - .../Modules/Avatars/Http/Favicon/Get.php | 1 - .../Modules/Avatars/Http/Flags/Get.php | 1 - .../Modules/Avatars/Http/Image/Get.php | 1 - .../Modules/Avatars/Http/Initials/Get.php | 1 - .../Platform/Modules/Avatars/Http/QR/Get.php | 1 - .../Modules/Avatars/Http/Screenshots/Get.php | 1 - .../Http/Deployments/Download/Get.php | 3 +- .../Sites/Http/Deployments/Download/Get.php | 1 - .../Http/Buckets/Files/Download/Get.php | 3 +- .../Http/Buckets/Files/Preview/Get.php | 1 - .../Storage/Http/Buckets/Files/View/Get.php | 3 +- src/Appwrite/Platform/Tasks/Specs.php | 54 ------------ src/Appwrite/SDK/Method.php | 12 ++- .../SDK/Specification/Format/OpenAPI3.php | 14 +--- .../SDK/Specification/Format/Swagger2.php | 14 +--- .../Storage/StorageConsoleClientTest.php | 80 ------------------ .../Services/Users/UsersConsoleClientTest.php | 83 ------------------- 21 files changed, 21 insertions(+), 267 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index ea00b7f356..a090635bb5 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -329,9 +329,9 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index f7a98e0f8f..416c294140 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -491,9 +491,9 @@ return function (Container $context): void { // Impersonation: if current user has impersonator capability and headers/params are set, act as another user // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index 2d66b5b21b..cc30f014bc 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,7 +42,6 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 710c7cd61d..3bae32c862 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,7 +42,6 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 244f426c4d..6faa0fe223 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,7 +54,6 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index dfeaff0f8a..ef9f8c0e47 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,7 +42,6 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 3c791aa128..315202d4d5 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,7 +45,6 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index 792026577b..c73d20fb0c 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,7 +44,6 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index b8f3d0247d..f3448f5264 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,7 +42,6 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 63d7d3f85e..51d4df2a49 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,7 +57,6 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index 8adff12784..c92e3c1406 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -52,8 +52,7 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + type: MethodType::LOCATION )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 088bf6c499..0ab998292d 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,7 +51,6 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index a11560cd5a..7e5d7d6879 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -57,8 +57,7 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + type: MethodType::LOCATION )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index dcc033260f..9c316a3b57 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,7 +71,6 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index a88b41b3bc..b78d582c47 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -58,8 +58,7 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + type: MethodType::LOCATION )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index fa3889125d..8717ae742e 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -181,36 +181,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], APP_SDK_PLATFORM_SERVER => [ 'Project' => [ @@ -273,36 +255,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], APP_SDK_PLATFORM_CONSOLE => [ 'Project' => [ @@ -365,36 +329,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], ]; } diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index f1b327513f..5f6ccf9a0f 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -32,7 +32,7 @@ class Method * @param array $additionalParameters * @param string $desc * @param bool $public Whether this method should be rendered on the website/documentation - * @param array $locationAuth Security scheme keys injected for location-type methods (includes project auth) + * @param string $projectAuth Project authentication security scheme to use in specs */ public function __construct( protected string $namespace, @@ -51,12 +51,16 @@ class Method protected array $additionalParameters = [], protected string $desc = '', protected bool $public = true, - protected array $locationAuth = [] + protected string $projectAuth = 'Project' ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); $this->validateDesc($description); + if (!\in_array($projectAuth, ['Project', 'ProjectQuery'], true)) { + self::$errors[] = "Error with {$this->getRouteName()} method: Invalid project auth scheme"; + } + foreach ($responses as $response) { $this->validateResponseModel($response->getModel()); $this->validateNoContent($response); @@ -225,9 +229,9 @@ class Method return $this->additionalParameters; } - public function getLocationAuth(): array + public function getProjectAuth(): string { - return $this->locationAuth; + return $this->projectAuth; } public function setNamespace(string $namespace): self diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index d9c2bf301e..dfa38b0bf5 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -188,7 +188,7 @@ class OpenAPI3 extends Format continue; } - $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; + $methodSecurities = [$methodObj->getProjectAuth() => []]; foreach ($methodObj->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { $methodSecurities[$security->value] = []; @@ -374,7 +374,7 @@ class OpenAPI3 extends Format } if (!empty($scope)) { - $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; + $securities = [$sdk->getProjectAuth() => []]; foreach ($sdk->getAuth() as $security) { /** @var AuthType $security */ @@ -384,16 +384,6 @@ class OpenAPI3 extends Format } $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); - - if ($sdk->getType() === MethodType::LOCATION) { - foreach ($sdk->getLocationAuth() as $key) { - if (\array_key_exists($key, $this->keys)) { - $securities[$key] = []; - $temp['x-appwrite']['auth'][$key] = []; - } - } - } - $temp['security'][] = $securities; } diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index b1541d5ddb..20b1fb9b94 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -188,7 +188,7 @@ class Swagger2 extends Format continue; } - $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; + $methodSecurities = [$methodObj->getProjectAuth() => []]; foreach ($methodObj->getAuth() as $security) { /** @var AuthType $security */ if (\array_key_exists($security->value, $this->keys)) { @@ -365,7 +365,7 @@ class Swagger2 extends Format } if (!empty($scope)) { - $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; + $securities = [$sdk->getProjectAuth() => []]; foreach ($sdk->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { @@ -374,16 +374,6 @@ class Swagger2 extends Format } $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); - - if ($sdk->getType() === MethodType::LOCATION) { - foreach ($sdk->getLocationAuth() as $key) { - if (\array_key_exists($key, $this->keys)) { - $securities[$key] = []; - $temp['x-appwrite']['auth'][$key] = []; - } - } - } - $temp['security'][] = $securities; } diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index aca2717170..9d2a639631 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -10,8 +10,6 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideConsole; use Utopia\Database\Helpers\ID; -use Utopia\Database\Helpers\Permission; -use Utopia\Database\Helpers\Role; final class StorageConsoleClientTest extends Scope { @@ -200,82 +198,4 @@ final class StorageConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); } - - public function testFilePreviewWithImpersonation(): void - { - $projectId = $this->getProject()['$id']; - $adminHeaders = array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()); - - $targetId = ID::unique(); - $target = $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ - 'userId' => $targetId, - 'email' => 'impersonation-storage-target-' . $targetId . '@example.com', - 'password' => 'password123', - 'name' => 'Storage Target', - ]); - $this->assertEquals(201, $target['headers']['status-code']); - - $actorId = ID::unique(); - $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ - 'userId' => $actorId, - 'email' => 'impersonation-storage-actor-' . $actorId . '@example.com', - 'password' => 'password123', - 'name' => 'Storage Actor', - ]); - $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $adminHeaders, [ - 'impersonator' => true, - ]); - - $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', $adminHeaders, [ - 'bucketId' => ID::unique(), - 'name' => 'Impersonation Test Bucket', - 'fileSecurity' => true, - 'permissions' => [ - Permission::read(Role::user($targetId)), - Permission::create(Role::any()), - ], - ]); - $this->assertEquals(201, $bucket['headers']['status-code']); - $bucketId = $bucket['body']['$id']; - - $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge( - $adminHeaders, - ['content-type' => 'multipart/form-data'] - ), [ - 'fileId' => ID::unique(), - 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), - 'permissions' => [ - Permission::read(Role::user($targetId)), - ], - ]); - $this->assertEquals(201, $file['headers']['status-code']); - $fileId = $file['body']['$id']; - - $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $adminHeaders); - $this->assertEquals(201, $session['headers']['status-code']); - - $sessionHeaders = [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-session' => $session['body']['secret'], - ]; - - $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); - $this->assertEquals(404, $denied['headers']['status-code']); - - $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ - 'impersonateuserid' => $targetId, - ]); - $this->assertEquals(200, $preview['headers']['status-code']); - $this->assertEquals('image/png', $preview['headers']['content-type']); - $this->assertNotEmpty($preview['body']); - - $view = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', $sessionHeaders, [ - 'impersonateuserid' => $targetId, - ]); - $this->assertEquals(200, $view['headers']['status-code']); - } } diff --git a/tests/e2e/Services/Users/UsersConsoleClientTest.php b/tests/e2e/Services/Users/UsersConsoleClientTest.php index 373b941fb4..1ac901bf58 100644 --- a/tests/e2e/Services/Users/UsersConsoleClientTest.php +++ b/tests/e2e/Services/Users/UsersConsoleClientTest.php @@ -83,87 +83,4 @@ final class UsersConsoleClientTest extends Scope $this->assertEquals($userId, $set['body']['$id']); $this->assertNotEmpty($set['body']['password']); } - - public function testImpersonateQueryParams(): void - { - $projectId = $this->getProject()['$id']; - $headers = array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()); - - $actorId = ID::unique(); - $actor = $this->client->call(Client::METHOD_POST, '/users', $headers, [ - 'userId' => $actorId, - 'email' => 'impersonator-queryparam-' . $actorId . '@example.com', - 'password' => 'password123', - 'name' => 'Impersonator', - ]); - $this->assertEquals(201, $actor['headers']['status-code']); - - $targetId = ID::unique(); - $targetEmail = 'target-queryparam-' . $targetId . '@example.com'; - $targetPhone = '+1' . rand(2000000000, 2999999999); - - $target = $this->client->call(Client::METHOD_POST, '/users', $headers, [ - 'userId' => $targetId, - 'email' => $targetEmail, - 'password' => 'password123', - 'name' => 'Target', - ]); - $this->assertEquals(201, $target['headers']['status-code']); - - $this->client->call(Client::METHOD_PATCH, '/users/' . $targetId . '/phone', $headers, [ - 'number' => $targetPhone, - ]); - - $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ - 'impersonator' => true, - ]); - - $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $headers); - $this->assertEquals(201, $session['headers']['status-code']); - - $sessionHeaders = [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-session' => $session['body']['secret'], - ]; - - $byHeader = $this->client->call(Client::METHOD_GET, '/account', array_merge($sessionHeaders, [ - 'x-appwrite-impersonate-user-id' => $targetId, - ])); - $this->assertEquals(200, $byHeader['headers']['status-code']); - $this->assertEquals($targetId, $byHeader['body']['$id']); - $this->assertEquals($actorId, $byHeader['body']['impersonatorUserId']); - - $byUserId = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ - 'impersonateuserid' => $targetId, - ]); - $this->assertEquals(200, $byUserId['headers']['status-code']); - $this->assertEquals($targetId, $byUserId['body']['$id']); - - $byEmail = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ - 'impersonateemail' => $targetEmail, - ]); - $this->assertEquals(200, $byEmail['headers']['status-code']); - $this->assertEquals($targetId, $byEmail['body']['$id']); - - $byPhone = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ - 'impersonatephone' => $targetPhone, - ]); - $this->assertEquals(200, $byPhone['headers']['status-code']); - $this->assertEquals($targetId, $byPhone['body']['$id']); - - // header takes priority over query param - $priority = $this->client->call( - Client::METHOD_GET, - '/account', - array_merge($sessionHeaders, ['x-appwrite-impersonate-user-id' => $targetId]), - ['impersonateuserid' => $actorId] - ); - $this->assertEquals(200, $priority['headers']['status-code']); - $this->assertEquals($targetId, $priority['body']['$id']); - } } From 42f90777386362fa6d583c29a49bd3e1f5590132 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 8 Jun 2026 11:15:58 +0530 Subject: [PATCH 055/151] Refactor Projects permission test coverage (#12530) --- .codex/skills/appwrite-testing/SKILL.md | 74 +++++++++++++++++++ .../appwrite-testing/agents/openai.yaml | 4 + .../Projects/ProjectsConsoleClientTest.php | 61 --------------- tests/unit/Platform/PermissionTest.php | 49 ++++++++++++ 4 files changed, 127 insertions(+), 61 deletions(-) create mode 100644 .codex/skills/appwrite-testing/SKILL.md create mode 100644 .codex/skills/appwrite-testing/agents/openai.yaml create mode 100644 tests/unit/Platform/PermissionTest.php diff --git a/.codex/skills/appwrite-testing/SKILL.md b/.codex/skills/appwrite-testing/SKILL.md new file mode 100644 index 0000000000..da191be824 --- /dev/null +++ b/.codex/skills/appwrite-testing/SKILL.md @@ -0,0 +1,74 @@ +--- +name: appwrite-testing +description: Choose, write, and review tests in the Appwrite server repository using a pragmatic test pyramid. Use when adding or changing PHPUnit tests, deciding between unit and e2e coverage, moving duplicated high-level coverage lower, testing API endpoints, workers, queues, permissions, auth/scopes, persistence, serialization, retry logic, validators, security regressions, or Swoole-sensitive behavior. +--- + +# Appwrite Testing + +## Core Rule + +Keep the test suite pyramid-shaped: many fast unit tests, fewer service/API e2e tests, and very few broad workflow tests. Push each assertion to the lowest level that still proves the behavior. + +Prefer fast feedback over formal labels. A narrow integration-style unit test with deterministic fakes is better than a slow e2e test when it proves the same behavior. + +## Choose The Test Level + +Use `tests/unit/...` for: + +- Pure validators, helpers, mappers, parsers, filters, retry classifiers, event builders, URL/security checks, and branching logic. +- Worker building blocks that can be called with fake adapters, in-memory collaborators, or scripted test doubles. +- Regression cases where inputs and observable outputs can be asserted without HTTP, Docker services, queues, Swoole coroutines, or real network calls. +- Boundary serialization/deserialization when the external side can be represented with a deterministic fake response or document. + +Use `tests/e2e/Services/{Service}` for: + +- HTTP route behavior, status codes, headers, cookies, response shape, SDK-visible contracts, and request validation through the real API path. +- Auth, scope, permission, project mode, platform, and side-specific behavior that depends on Appwrite's request lifecycle. +- Persistence, queue-visible behavior, worker integration, database adapter behavior, and DI/wiring that unit tests cannot prove. +- A small number of high-value service workflows that represent user-visible behavior across multiple Appwrite subsystems. + +Avoid broad e2e coverage for every edge case. Cover edge cases in unit tests and keep e2e focused on the integration contract that lower layers cannot exercise. + +## Appwrite Patterns + +Structure tests as Arrange, Act, Assert. Test observable behavior, not the order of private calls or internal implementation details. + +Write unit tests with `PHPUnit\Framework\TestCase` under the matching namespace in `tests/unit`. Use data providers for matrices. Prefer named fake classes over anonymous mocks when PHPStan clarity matters. + +Write service e2e tests with `Tests\E2E\Client` and the existing scope traits such as `Scope`, `ProjectCustom`, `SideClient`, `SideServer`, or `ProjectConsole`. Reuse local service base traits when they exist. + +Use deterministic test doubles for network, queue, mail, storage, database, and third-party boundaries whenever the point of the test is local behavior. Never call production third-party services from automated tests. + +Generate unique IDs, emails, and names for e2e data to survive parallel runs. Cache setup data only when the test does not require precise counts or fresh state. + +Keep assertions precise: status code, body fields, error type/message, permission outcome, retry count, adapter call count, or persisted value. Avoid asserting incidental full documents when a sparse behavior assertion is enough. + +## Duplication Policy + +If a higher-level test finds a bug and no lower-level test fails, add a lower-level regression test where practical. + +Do not repeat all conditional branches at e2e level once unit tests cover them. The e2e test should prove routing, auth, serialization, persistence, or wiring only. + +Delete or avoid high-level tests that no longer add confidence beyond lower-level coverage. Keep tests readable even if that means some local duplication in setup. + +## Swoole And Workers + +Be careful with Swoole coroutines in unit tests. Do not run coroutine integrations inside the shared unit process unless existing nearby tests prove the pattern is safe. + +For workers, unit-test pure pieces such as batching, classification, cursor construction, retry/backoff decisions, and adapter interaction with fakes. Cover coroutine scheduling, queues, and full worker lifecycle through e2e or existing integration patterns. + +Avoid sleeps and timing-sensitive assertions. If timing is unavoidable, isolate it, make it generous, and prefer polling helpers already used in the suite. + +## Commands + +Run focused checks first: + +```bash +docker compose exec appwrite test tests/unit/ +docker compose exec appwrite test tests/e2e/Services/[Service] +docker compose exec appwrite test tests/e2e/Services/[Service] --filter=[Method] +composer lint +composer analyze +``` + +Use the narrowest command that validates the change, then broaden only when the touched behavior crosses module, API, worker, or shared-helper boundaries. diff --git a/.codex/skills/appwrite-testing/agents/openai.yaml b/.codex/skills/appwrite-testing/agents/openai.yaml new file mode 100644 index 0000000000..1f9d0c12ac --- /dev/null +++ b/.codex/skills/appwrite-testing/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Appwrite Testing" + short_description: "Choose and write Appwrite tests using a pragmatic test pyramid." + default_prompt: "Use the Appwrite testing skill to choose the right test level and add focused PHPUnit coverage for this change." diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index caae66b6e5..696fce63cc 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -7406,29 +7406,13 @@ final class ProjectsConsoleClientTest extends Scope 'roles' => ["owner"], 'successProjectIds' => [$projectIdA, $projectIdB], ], - [ - 'roles' => ["developer"], - 'successProjectIds' => [$projectIdA, $projectIdB], - ], [ 'roles' => ["project-$projectIdA-owner"], 'successProjectIds' => [$projectIdA], ], - [ - 'roles' => ["project-$projectIdB-owner"], - 'successProjectIds' => [$projectIdB], - ], - [ - 'roles' => ["project-$projectIdA-developer"], - 'successProjectIds' => [$projectIdA], - ], [ 'roles' => ["project-$projectIdB-developer"], 'successProjectIds' => [$projectIdB], - ], - [ - 'roles' => ["developer", "project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA, $projectIdB], ] ]; @@ -7494,35 +7478,15 @@ final class ProjectsConsoleClientTest extends Scope 'successProjectIds' => [$projectIdA, $projectIdB], 'failureProjectIds' => [], ], - [ - 'roles' => ["developer"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], - ], [ 'roles' => ["project-$projectIdA-owner"], 'successProjectIds' => [$projectIdA], 'failureProjectIds' => [$projectIdB], ], - [ - 'roles' => ["project-$projectIdB-owner"], - 'successProjectIds' => [$projectIdB], - 'failureProjectIds' => [$projectIdA], - ], - [ - 'roles' => ["project-$projectIdA-developer"], - 'successProjectIds' => [$projectIdA], - 'failureProjectIds' => [$projectIdB], - ], [ 'roles' => ["project-$projectIdB-developer"], 'successProjectIds' => [$projectIdB], 'failureProjectIds' => [$projectIdA], - ], - [ - 'roles' => ["developer", "project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], ] ]; @@ -7625,11 +7589,6 @@ final class ProjectsConsoleClientTest extends Scope 'successProjectIds' => [$projectIdD], 'failureProjectIds' => [$projectIdE], ], - [ - 'roles' => ["project-$projectIdE-owner"], - 'successProjectIds' => [$projectIdE], - 'failureProjectIds' => [], - ], ]; // Setup session @@ -7702,21 +7661,6 @@ final class ProjectsConsoleClientTest extends Scope 'successProjectIds' => [$projectIdA, $projectIdB], 'failureProjectIds' => [], ], - [ - 'roles' => ["developer"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], - ], - [ - 'roles' => ["project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA], - 'failureProjectIds' => [$projectIdB], - ], - [ - 'roles' => ["project-$projectIdB-owner"], - 'successProjectIds' => [$projectIdB], - 'failureProjectIds' => [$projectIdA], - ], [ 'roles' => ["project-$projectIdA-developer"], 'successProjectIds' => [$projectIdA], @@ -7726,11 +7670,6 @@ final class ProjectsConsoleClientTest extends Scope 'roles' => ["project-$projectIdB-developer"], 'successProjectIds' => [$projectIdB], 'failureProjectIds' => [$projectIdA], - ], - [ - 'roles' => ["developer", "project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], ] ]; diff --git a/tests/unit/Platform/PermissionTest.php b/tests/unit/Platform/PermissionTest.php new file mode 100644 index 0000000000..8e52488d5c --- /dev/null +++ b/tests/unit/Platform/PermissionTest.php @@ -0,0 +1,49 @@ +subject()->getPermissions('team1', 'project1'); + + $this->assertSame([ + DbPermission::read(Role::team('team1', 'owner')), + DbPermission::read(Role::team('team1', 'developer')), + DbPermission::update(Role::team('team1', 'owner')), + DbPermission::update(Role::team('team1', 'developer')), + DbPermission::delete(Role::team('team1', 'owner')), + DbPermission::delete(Role::team('team1', 'developer')), + DbPermission::read(Role::team('team1', 'project-project1-owner')), + DbPermission::read(Role::team('team1', 'project-project1-developer')), + DbPermission::update(Role::team('team1', 'project-project1-owner')), + DbPermission::update(Role::team('team1', 'project-project1-developer')), + DbPermission::delete(Role::team('team1', 'project-project1-owner')), + DbPermission::delete(Role::team('team1', 'project-project1-developer')), + ], $permissions); + } + + public function testGetPermissionsDoesNotGrantUnrelatedProjectRoles(): void + { + $permissions = $this->subject()->getPermissions('team1', 'project1'); + + $this->assertNotContains(DbPermission::read(Role::team('team1', 'project-project2-owner')), $permissions); + $this->assertNotContains(DbPermission::update(Role::team('team1', 'project-project2-developer')), $permissions); + $this->assertNotContains(DbPermission::delete(Role::team('team2', 'project-project1-owner')), $permissions); + } + + private function subject(): object + { + return new class () { + use Permission; + }; + } +} From f9e7e0e54933d5d4c435a85a4fea91651a657b2d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 8 Jun 2026 11:33:19 +0530 Subject: [PATCH 056/151] Refactor Sites deployment test coverage (#12531) * Refactor Sites deployment test coverage * fix refactor --- .../Modules/Functions/Workers/Builds.php | 98 +- tests/e2e/Services/Sites/SitesBase.php | 44 +- .../Services/Sites/SitesCustomServerTest.php | 925 ------------------ tests/unit/Functions/BuildsTest.php | 94 ++ 4 files changed, 183 insertions(+), 978 deletions(-) create mode 100644 tests/unit/Functions/BuildsTest.php diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 53d615d3b6..07a7b1f89c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -690,25 +690,7 @@ class Builds extends Action } else { $outputDirectory = $deployment->getAttribute('buildOutput') ?? $resource->getAttribute('outputDirectory'); if ($resource->getCollection() === 'sites') { - $listFilesCommand = ''; - - // Start separation, enter build folder - $listFilesCommand .= 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build'; - - // Enter output directory, if set - if (! empty($outputDirectory)) { - $listFilesCommand .= ' && cd ' . \escapeshellarg($outputDirectory); - } - - // Print files, and end separation - $listFilesCommand .= ' && find . -name \'node_modules\' -prune -o -type f -print && echo "{APPWRITE_DETECTION_SEPARATOR_END}"'; - - // Use SSR file listing - if (empty($command)) { - $command = $listFilesCommand; - } else { - $command .= ' && ' . $listFilesCommand; - } + $command = $this->prepareSiteBuildCommand($command, $outputDirectory ?? ''); } $command = 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh ' . \trim(\escapeshellarg($command)); @@ -875,31 +857,13 @@ class Builds extends Action $logs .= $log['content']; } - // Separate logs for SSR detection - $detectionLogs = ''; - if (\str_contains($logs, '{APPWRITE_DETECTION_SEPARATOR_START}')) { - [$logsBefore, $detectionLogsStart] = \explode('{APPWRITE_DETECTION_SEPARATOR_START}', $logs, 2); - [$detectionLogs, $logsAfter] = \explode('{APPWRITE_DETECTION_SEPARATOR_END}', $detectionLogsStart, 2); - $logs = $logsBefore . $logsAfter; - } + ['logs' => $logs, 'detectionLogs' => $detectionLogs] = $this->splitSiteDetectionLogs($logs); $deployment->setAttribute('buildLogs', $logs); $adapter = null; if ($resource->getCollection() === 'sites' && ! empty($detectionLogs)) { - $files = \explode("\n", $detectionLogs); // Parse output - $files = \array_filter($files); // Remove empty - $files = \array_map(fn ($file) => \trim($file), $files); // Remove whitepsaces - $files = \array_map(fn ($file) => \str_starts_with($file, './') ? \substr($file, 2) : $file, $files); // Remove beginning ./ - - $detector = new Rendering($resource->getAttribute('framework', '')); - foreach ($files as $file) { - $detector->addInput($file); - } - $detector - ->addOption(new SSR()) - ->addOption(new XStatic()); - $detection = $detector->detect(); + $detection = $this->detectSiteRendering($resource->getAttribute('framework', ''), $detectionLogs); $adapter = $resource->getAttribute('adapter', ''); if (empty($adapter)) { @@ -1337,6 +1301,62 @@ class Builds extends Action return ''; } + protected function prepareSiteBuildCommand(string $command, string $outputDirectory): string + { + $listFilesCommand = 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build'; + + if (! empty($outputDirectory)) { + $listFilesCommand .= ' && cd ' . \escapeshellarg($outputDirectory); + } + + $listFilesCommand .= ' && find . -name \'node_modules\' -prune -o -type f -print && echo "{APPWRITE_DETECTION_SEPARATOR_END}"'; + + if (empty($command)) { + return $listFilesCommand; + } + + return "{$command} && {$listFilesCommand}"; + } + + /** + * @return array{logs: string, detectionLogs: string} + */ + protected function splitSiteDetectionLogs(string $logs): array + { + if (! \str_contains($logs, '{APPWRITE_DETECTION_SEPARATOR_START}')) { + return [ + 'logs' => $logs, + 'detectionLogs' => '', + ]; + } + + [$logsBefore, $detectionLogsStart] = \explode('{APPWRITE_DETECTION_SEPARATOR_START}', $logs, 2); + [$detectionLogs, $logsAfter] = \explode('{APPWRITE_DETECTION_SEPARATOR_END}', $detectionLogsStart, 2); + + return [ + 'logs' => "{$logsBefore}{$logsAfter}", + 'detectionLogs' => $detectionLogs, + ]; + } + + protected function detectSiteRendering(string $framework, string $detectionLogs): object + { + $files = \explode("\n", $detectionLogs); + $files = \array_filter($files); + $files = \array_map(\trim(...), $files); + $files = \array_map(fn ($file) => \str_starts_with($file, './') ? \substr($file, 2) : $file, $files); + + $detector = new Rendering($framework); + foreach ($files as $file) { + $detector->addInput($file); + } + + return $detector + ->addOption(new SSR()) + ->addOption(new XStatic()) + ->detect(); + } + /** * @throws Structure * @throws \Utopia\Database\Exception diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 7b9c5e86b0..7ce6772c90 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -34,6 +34,20 @@ trait SitesBase } protected function setupDeployment(string $siteId, mixed $params): string + { + $deploymentId = $this->createDeploymentAccepted($siteId, $params); + + $this->waitDeploymentReady($siteId, $deploymentId); + + // Not === so multipart/form-data works fine too + if (($params['activate'] ?? false) == true) { + $this->waitDeploymentActivated($siteId, $deploymentId); + } + + return $deploymentId; + } + + protected function createDeploymentAccepted(string $siteId, mixed $params): string { $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments', array_merge([ 'content-type' => 'multipart/form-data', @@ -41,8 +55,12 @@ trait SitesBase 'x-appwrite-key' => $this->getProject()['apiKey'], ]), $params); $this->assertEquals($deployment['headers']['status-code'], 202, 'Setup deployment failed with status code: ' . $deployment['headers']['status-code'] . ' and response: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - $deploymentId = $deployment['body']['$id'] ?? ''; + return $deployment['body']['$id'] ?? ''; + } + + protected function waitDeploymentReady(string $siteId, string $deploymentId): void + { $this->assertEventually(function () use ($siteId, $deploymentId) { $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, array_merge([ 'content-type' => 'application/json', @@ -66,20 +84,18 @@ trait SitesBase $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); }, 120000, 500); + } - // Not === so multipart/form-data works fine too - if (($params['activate'] ?? false) == true) { - $this->assertEventually(function () use ($siteId, $deploymentId) { - $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'], - ])); - $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); - }, 120000, 500); - } - - return $deploymentId; + protected function waitDeploymentActivated(string $siteId, string $deploymentId): void + { + $this->assertEventually(function () use ($siteId, $deploymentId) { + $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); + }, 120000, 500); } protected function cleanupSite(string $siteId): void diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 2a58a1c17b..1df10da690 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -714,253 +714,6 @@ final class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testAdapterDetectionAstroSSR(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro SSR site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertEmpty($site['body']['adapter']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $this->assertEventually(function () use ($siteId, &$site) { - $site = $this->getSite($siteId); - $this->assertEquals('ssr', $site['body']['adapter']); - }); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - - $this->cleanupSite($siteId); - } - - #[Retry(count: 3)] - public function testAdapterDetectionAstroStatic(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro static site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertEmpty($site['body']['adapter']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro-static'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - - $this->cleanupSite($siteId); - } - - public function testAdapterDetectionStatic(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Static site', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => '', - 'buildCommand' => '', - 'installCommand' => '', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertEmpty($site['body']['adapter']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - - $this->cleanupSite($siteId); - } - - public function testAdapterDetectionStaticSPA(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Static site', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => '', - 'buildCommand' => '', - 'installCommand' => '', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertArrayHasKey('fallbackFile', $site['body']); - $this->assertEmpty($site['body']['adapter']); - $this->assertEmpty($site['body']['fallbackFile']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - $this->assertEquals('main.html', $site['body']['fallbackFile']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Main page', (string) $response['body']); - $response = $proxyClient->call(Client::METHOD_GET, '/something'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Main page', (string) $response['body']); - - $this->cleanupSite($siteId); - } - - public function testSettingsForRollback(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Static site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEmpty($site['body']['adapter']); - $this->assertEmpty($site['body']['fallbackFile']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId1 = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro-static'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId1); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - $this->assertEquals('index.html', $site['body']['fallbackFile']); - - $site = $this->updateSite([ - 'name' => 'SSR site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'adapter' => 'ssr', - 'fallbackFile' => '', - '$id' => $siteId, - ]); - - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('ssr', $site['body']['adapter']); - $this->assertEmpty($site['body']['fallbackFile']); - - $deploymentId2 = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId2); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('ssr', $site['body']['adapter']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro SSR", (string) $response['body']); - $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); - $this->assertEquals(404, $response['headers']['status-code']); - - $response = $this->updateSiteDeployment($siteId, $deploymentId1); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']['$id']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro static", (string) $response['body']); - $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro static", (string) $response['body']); - - $this->cleanupSite($siteId); - } - public function testListSites(): void { /** @@ -2195,62 +1948,6 @@ final class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testSiteStaticSPA(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'SPA site', - 'framework' => 'other', - 'adapter' => 'static', - 'buildRuntime' => 'static-1', - 'outputDirectory' => './', - 'buildCommand' => '', - 'installCommand' => '', - 'fallbackFile' => '404.html', - ]); - - $this->assertNotEmpty($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-spa'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->setupSiteDomain($siteId); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Index page", (string) $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/contact', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Contact page", (string) $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/non-existing', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Customized 404 page", (string) $response['body']); - $this->assertStringNotContainsString("Powered by", (string) $response['body']); //brand - - $this->cleanupSite($siteId); - } - #[Retry(count: 3)] public function testSiteTemplate(): void { @@ -2322,154 +2019,9 @@ final class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testCreateSiteFromTemplateBranch() - { - $template = $this->getTemplate('playground-for-astro'); - $this->assertEquals(200, $template['headers']['status-code']); - $template = $template['body']; - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro Blog - Branch Test', - 'framework' => $template['frameworks'][0]['key'], - 'adapter' => $template['frameworks'][0]['adapter'], - 'buildRuntime' => $template['frameworks'][0]['buildRuntime'], - 'outputDirectory' => $template['frameworks'][0]['outputDirectory'], - 'buildCommand' => $template['frameworks'][0]['buildCommand'], - 'installCommand' => $template['frameworks'][0]['installCommand'], - 'fallbackFile' => $template['frameworks'][0]['fallbackFile'], - ]); - $this->assertNotEmpty($siteId); - - // Deploy using branch - $deployment = $this->createTemplateDeployment($siteId, [ - 'repository' => $template['providerRepositoryId'], - 'owner' => $template['providerOwner'], - 'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'], - 'type' => 'branch', - 'reference' => 'main', - 'activate' => true - ]); - - $this->assertEquals(202, $deployment['headers']['status-code']); - $this->assertNotEmpty($deployment['body']['$id']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertEquals(0, $deployment['body']['sourceSize']); - $this->assertEquals(0, $deployment['body']['buildSize']); - $this->assertEquals(0, $deployment['body']['totalSize']); - - $this->assertEventually(function () use ($siteId) { - $site = $this->getSite($siteId); - $this->assertNotEmpty($site['body']['deploymentId']); - }, 120000, 500); - - $domain = $this->setupSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", (string) $response['body']); - $this->assertStringContainsString("Hello, Astronaut!", (string) $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/about'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", (string) $response['body']); - $this->assertStringContainsString("About Me", (string) $response['body']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertGreaterThan(0, $deployment['body']['sourceSize']); - $this->assertGreaterThan(0, $deployment['body']['buildSize']); - $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; - $this->assertEquals($totalSize, $deployment['body']['totalSize']); - - $this->cleanupSite($siteId); - } - - public function testCreateSiteFromTemplateCommit() - { - $template = $this->getTemplate('playground-for-astro'); - $this->assertEquals(200, $template['headers']['status-code']); - - // Get latest commit using helper function - $latestCommit = $this->helperGetLatestCommit( - $template['body']['providerOwner'], - $template['body']['providerRepositoryId'] - ); - $this->assertNotNull($latestCommit); - - $template = $template['body']; - - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro Blog - Commit Test', - 'framework' => $template['frameworks'][0]['key'], - 'adapter' => $template['frameworks'][0]['adapter'], - 'buildRuntime' => $template['frameworks'][0]['buildRuntime'], - 'outputDirectory' => $template['frameworks'][0]['outputDirectory'], - 'buildCommand' => $template['frameworks'][0]['buildCommand'], - 'installCommand' => $template['frameworks'][0]['installCommand'], - 'fallbackFile' => $template['frameworks'][0]['fallbackFile'], - ]); - - $this->assertNotEmpty($siteId); - - // Deploy using commit - $deployment = $this->createTemplateDeployment($siteId, [ - 'repository' => $template['providerRepositoryId'], - 'owner' => $template['providerOwner'], - 'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'], - 'type' => 'commit', - 'reference' => $latestCommit, - 'activate' => true - ]); - - $this->assertEquals(202, $deployment['headers']['status-code']); - $this->assertNotEmpty($deployment['body']['$id']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertEquals(0, $deployment['body']['sourceSize']); - $this->assertEquals(0, $deployment['body']['buildSize']); - $this->assertEquals(0, $deployment['body']['totalSize']); - - $this->assertEventually(function () use ($siteId) { - $site = $this->getSite($siteId); - $this->assertNotEmpty($site['body']['deploymentId']); - }, 120000, 500); - - $domain = $this->setupSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", (string) $response['body']); - $this->assertStringContainsString("Hello, Astronaut!", (string) $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/about'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", (string) $response['body']); - $this->assertStringContainsString("About Me", (string) $response['body']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertGreaterThan(0, $deployment['body']['sourceSize']); - $this->assertGreaterThan(0, $deployment['body']['buildSize']); - $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; - $this->assertEquals($totalSize, $deployment['body']['totalSize']); - - $this->cleanupSite($siteId); - } public function testSiteDomainReclaiming(): void { @@ -2739,201 +2291,7 @@ final class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testSSRLogs(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'SSR site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - ]); - $this->assertNotEmpty($siteId); - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->getSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/logs-inline'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Inline logs printed.", (string) $response['body']); - - // Poll for execution logs to be written (async) - // Filter by requestPath to avoid picking up screenshot worker executions - // Wait for both the execution entry AND its logs field to be populated - $logs = null; - $timeout = 120; - $start = \time(); - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-inline'])->toString(), - Query::limit(1)->toString(), - ]); - if (!empty($logs['body']['executions']) && !empty($logs['body']['executions'][0]['logs'])) { - break; - } - \usleep(500000); - } - $this->assertNotEmpty($logs['body']['executions'], 'Execution logs were not available within timeout'); - $this->assertNotNull($logs['body']['executions'][0]['logs'], 'Execution logs content was not populated within timeout'); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertStringContainsString($deploymentId, (string) $logs['body']['executions'][0]['deploymentId']); - $this->assertStringContainsString("GET", (string) $logs['body']['executions'][0]['requestMethod']); - $this->assertStringContainsString("/logs-inline", (string) $logs['body']['executions'][0]['requestPath']); - $this->assertStringContainsString("Log1", (string) $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Log2", (string) $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Error1", (string) $logs['body']['executions'][0]['errors']); - $this->assertStringContainsString("Error2", (string) $logs['body']['executions'][0]['errors']); - $log1Id = $logs['body']['executions'][0]['$id']; - $this->assertNotEmpty($log1Id); - - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::limit(1)->toString(), - Query::equal('deploymentId', [$deploymentId])->toString() - ]); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertGreaterThanOrEqual(1, $logs['body']['total']); - $this->assertCount(1, $logs['body']['executions']); - - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::limit(1)->toString(), - Query::equal('deploymentId', ['some-random-id'])->toString() - ]); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertEquals(0, $logs['body']['total']); - $this->assertCount(0, $logs['body']['executions']); - - $response = $proxyClient->call(Client::METHOD_GET, '/logs-action'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Action logs printed.", (string) $response['body']); - - $logs = null; - $start = \time(); - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-action'])->toString(), - Query::limit(1)->toString(), - ]); - if (!empty($logs['body']['executions']) && !empty($logs['body']['executions'][0]['logs'])) { - break; - } - \usleep(500000); - } - $this->assertNotEmpty($logs['body']['executions'], 'Action execution logs were not available within timeout'); - $this->assertNotNull($logs['body']['executions'][0]['logs'], 'Action execution logs content was not populated within timeout'); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertStringContainsString($deploymentId, (string) $logs['body']['executions'][0]['deploymentId']); - $this->assertStringContainsString("GET", (string) $logs['body']['executions'][0]['requestMethod']); - $this->assertStringContainsString("/logs-action", (string) $logs['body']['executions'][0]['requestPath']); - $this->assertStringContainsString("Log1", (string) $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Log2", (string) $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Error1", (string) $logs['body']['executions'][0]['errors']); - $this->assertStringContainsString("Error2", (string) $logs['body']['executions'][0]['errors']); - $log2Id = $logs['body']['executions'][0]['$id']; - $this->assertNotEmpty($log2Id); - - $this->assertNotEquals($log1Id, $log2Id); - - $site = $this->updateSite( - [ - '$id' => $siteId, - 'name' => 'SSR site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - 'logging' => false // set logging to false - ] - ); - $this->assertEquals(200, $site['headers']['status-code']); - - // Wait for the logging config change to propagate to the site runtime - $this->assertEventually(function () use ($proxyClient) { - $response = $proxyClient->call(Client::METHOD_GET, '/logs-inline'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Inline logs printed.", (string) $response['body']); - }, 15_000, 500); - - // Poll for the NEW log entry (after logging was disabled) to appear - $timeout = 30; - $start = \time(); - $newLog = null; - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-inline'])->toString(), - Query::limit(1)->toString(), - ]); - if ( - !empty($logs['body']['executions']) && - $logs['body']['executions'][0]['$id'] !== $log1Id - ) { - $newLog = $logs['body']['executions'][0]; - break; - } - \usleep(500000); - } - $this->assertNotNull($newLog, 'New log entry should appear after logging-disabled request'); - $this->assertEquals("GET", $newLog['requestMethod']); - $this->assertEquals("/logs-inline", $newLog['requestPath']); - $this->assertEmpty($newLog['logs']); - $this->assertEmpty($newLog['errors']); - $log1Id = $newLog['$id']; - $this->assertNotEmpty($log1Id); - - $response = $proxyClient->call(Client::METHOD_GET, '/logs-action'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Action logs printed.", (string) $response['body']); - - // Poll for the NEW log entry for /logs-action - $start = \time(); - $newLog = null; - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-action'])->toString(), - Query::limit(1)->toString(), - ]); - if ( - !empty($logs['body']['executions']) && - $logs['body']['executions'][0]['$id'] !== $log2Id - ) { - $newLog = $logs['body']['executions'][0]; - break; - } - \usleep(500000); - } - $this->assertNotNull($newLog, 'New log entry should appear after logging-disabled /logs-action request'); - $this->assertEquals("GET", $newLog['requestMethod']); - $this->assertEquals("/logs-action", $newLog['requestPath']); - $this->assertEmpty($newLog['logs']); - $this->assertEmpty($newLog['errors']); - $log2Id = $logs['body']['executions'][0]['$id']; - $this->assertNotEmpty($log2Id); - - $this->cleanupSite($siteId); - } public function testDuplicateDeployment(): void { @@ -3395,37 +2753,6 @@ final class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testDeploymentCommandEscaping(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'A site', - 'framework' => 'other', - 'adapter' => 'static', - 'buildRuntime' => 'static-1', - 'outputDirectory' => './', - 'buildCommand' => "echo 'Hello two'", - 'installCommand' => 'echo "Hello one"', - 'fallbackFile' => '', - ]); - - $this->assertNotEmpty($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('Hello one', (string) $deployment['body']['buildLogs']); - $this->assertStringContainsString('Hello two', (string) $deployment['body']['buildLogs']); - - $this->cleanupSite($siteId); - } - #[Retry(count: 3)] public function testErrorPages(): void { @@ -3582,258 +2909,6 @@ final class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testOutputDirectoryEmpty(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Empty output directory', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './empty-directory', - 'buildCommand' => 'mkdir -p ./empty-directory' - ]); - $this->assertNotEmpty($siteId); - - $deployment = $this->createDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => true - ]); - $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('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - $this->assertStringContainsString('Error:', (string) $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - $this->cleanupSite($siteId); - } - - public function testOutputDirectoryMissing(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Missing output directory', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './non-existing-directory', - ]); - $this->assertNotEmpty($siteId); - - $deployment = $this->createDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => true - ]); - $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('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - $this->assertStringContainsString('No such file or directory', (string) $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - $this->cleanupSite($siteId); - } - - public function testBuildErrorLogs(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro SSR site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'echo "custom error" && npm ci', - 'adapter' => 'ssr', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deployment = $this->createDeployment($siteId, [ - 'code' => $this->packageSite('astro-static'), - 'activate' => true - ]); - $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('failed', $deployment['body']['status'], 'Deployment status is failed, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('custom error', (string) $deployment['body']['buildLogs']); - $this->assertStringContainsString('Adapter mismatch', (string) $deployment['body']['buildLogs']); - - $this->cleanupSite($siteId); - } - - public function testCookieHeader() - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - ]); - - $this->assertNotEmpty($siteId); - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->getSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/cookies', [ - 'cookie' => 'custom-session-id=abcd123; custom-user-id=efgh456' - ]); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals("abcd123;efgh456", $response['body']); - $this->assertEquals("value-one", $response['cookies']['my-cookie-one']); - $this->assertEquals("value-two", $response['cookies']['my-cookie-two']); - - $this->cleanupSite($siteId); - } - - public function testSiteCustomStartCommand(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'startCommand' => 'node custom-server.js', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - ]); - - $this->assertNotEmpty($siteId); - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro-custom-start-command'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->getSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Homepage OK", (string) $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/ssr'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("SSR OK", (string) $response['body']); - $originalBody = $response['body']; - $response = $proxyClient->call(Client::METHOD_GET, '/ssr'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("SSR OK", (string) $response['body']); - $this->assertNotEquals($originalBody, $response['body']); // Includes Date.now() - - $response = $proxyClient->call(Client::METHOD_GET, '/ssr-custom'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Custom SSR OK", (string) $response['body']); - $originalBody = $response['body']; - $response = $proxyClient->call(Client::METHOD_GET, '/ssr-custom'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Custom SSR OK", (string) $response['body']); - $this->assertNotEquals($originalBody, $response['body']); // Includes Date.now() - - $response = $proxyClient->call(Client::METHOD_GET, '/non-existing'); - $this->assertEquals(500, $response['headers']['status-code']); - $this->assertStringContainsString("Custom error", (string) $response['body']); - - $this->cleanupSite($siteId); - } - - public function testSiteSpecifications() - { - // Check if the site specifications are correctly set in builds - $site = $this->createSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build && echo $APPWRITE_SITE_MEMORY:$APPWRITE_SITE_CPUS', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - 'buildSpecification' => Specification::S_1VCPU_1GB, - 'runtimeSpecification' => Specification::S_05VCPU_512MB, - ]); - - $this->assertEquals(201, $site['headers']['status-code']); - $this->assertEquals(Specification::S_1VCPU_1GB, $site['body']['buildSpecification']); - $this->assertEquals(Specification::S_05VCPU_512MB, $site['body']['runtimeSpecification']); - $this->assertNotEmpty($site['body']['$id']); - - $siteId = $site['body']['$id'] ?? ''; - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => true - ]); - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $deployment = $this->getDeployment($siteId, $deploymentId); - // TODO: This assertion is not testing what we set in create function, because build worker currently overrides to minimal build specs - $this->assertStringContainsString('2048:1', (string) $deployment['body']['buildLogs']); - }, 10000, 500); - - // Check if the sites specifications are correctly set in executions - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/specs'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']); - $this->assertEquals('512', $response['body']['APPWRITE_SITE_MEMORY']); - $this->assertEquals('0.5', $response['body']['APPWRITE_SITE_CPUS']); - - $this->cleanupSite($siteId); - } - public function testSiteDeploymentRetention(): void { $siteIds = []; diff --git a/tests/unit/Functions/BuildsTest.php b/tests/unit/Functions/BuildsTest.php new file mode 100644 index 0000000000..b757856c83 --- /dev/null +++ b/tests/unit/Functions/BuildsTest.php @@ -0,0 +1,94 @@ +builds = new Builds(); + } + + public function testSiteCommandIncludesFrameworkAndDeploymentCommands(): void + { + Config::setParam('frameworks', [ + 'astro' => [ + 'envCommand' => 'cp .env.example .env', + 'bundleCommand' => 'npm run bundle', + ], + ]); + + $resource = new Document([ + '$collection' => 'sites', + 'framework' => 'astro', + ]); + $deployment = new Document([ + 'buildCommands' => 'npm run build', + ]); + + $this->assertSame( + 'cp .env.example .env && npm run build && npm run bundle', + $this->callBuilds('getCommand', $resource, $deployment) + ); + } + + public function testSiteBuildCommandAppendsDetectionFileListing(): void + { + $command = $this->callBuilds('prepareSiteBuildCommand', 'npm run build', './dist folder'); + + $this->assertStringStartsWith('npm run build && echo "{APPWRITE_DETECTION_SEPARATOR_START}"', $command); + $this->assertStringContainsString('cd /usr/local/build && cd \'./dist folder\'', (string) $command); + $this->assertStringContainsString('find . -name \'node_modules\' -prune -o -type f -print', (string) $command); + $this->assertStringEndsWith('echo "{APPWRITE_DETECTION_SEPARATOR_END}"', $command); + } + + public function testSiteBuildCommandCanBeOnlyDetectionFileListing(): void + { + $command = $this->callBuilds('prepareSiteBuildCommand', '', ''); + + $this->assertStringStartsWith('echo "{APPWRITE_DETECTION_SEPARATOR_START}"', $command); + $this->assertStringContainsString('cd /usr/local/build && find .', (string) $command); + } + + public function testSplitSiteDetectionLogsRemovesDetectionBlock(): void + { + $result = $this->callBuilds( + 'splitSiteDetectionLogs', + "before\n{APPWRITE_DETECTION_SEPARATOR_START}\n./index.html\n./server/entry.mjs\n{APPWRITE_DETECTION_SEPARATOR_END}\nafter\n" + ); + + $this->assertSame("before\n\nafter\n", $result['logs']); + $this->assertSame("\n./index.html\n./server/entry.mjs\n", $result['detectionLogs']); + } + + public function testDetectSiteRenderingFindsStaticFallbackFile(): void + { + $detection = $this->callBuilds('detectSiteRendering', 'other', "./main.html\n"); + + $this->assertSame('static', $detection->getName()); + $this->assertSame('main.html', $detection->getFallbackFile()); + } + + public function testDetectSiteRenderingFindsAstroSSR(): void + { + $detection = $this->callBuilds('detectSiteRendering', 'astro', "./client/index.html\n./server/entry.mjs\n"); + + $this->assertSame('ssr', $detection->getName()); + $this->assertNull($detection->getFallbackFile()); + } + + private function callBuilds(string $method, mixed ...$arguments): mixed + { + return (new ReflectionMethod($this->builds, $method))->invoke($this->builds, ...$arguments); + } +} From 81c33855fe60223d450261102889c2cec080dd6d Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Mon, 8 Jun 2026 11:34:55 +0530 Subject: [PATCH 057/151] =?UTF-8?q?Revert=20"Revert=20"feat:=20embed=20imp?= =?UTF-8?q?ersonateUserId=20in=20location-type=20SDK=20method=20URL?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ac00aa34f171efad142f8919def0a55827b5085b. --- app/init/realtime/connection.php | 6 +- app/init/resources/request.php | 6 +- .../Modules/Avatars/Http/Browsers/Get.php | 1 + .../Modules/Avatars/Http/CreditCards/Get.php | 1 + .../Modules/Avatars/Http/Favicon/Get.php | 1 + .../Modules/Avatars/Http/Flags/Get.php | 1 + .../Modules/Avatars/Http/Image/Get.php | 1 + .../Modules/Avatars/Http/Initials/Get.php | 1 + .../Platform/Modules/Avatars/Http/QR/Get.php | 1 + .../Modules/Avatars/Http/Screenshots/Get.php | 1 + .../Http/Deployments/Download/Get.php | 3 +- .../Sites/Http/Deployments/Download/Get.php | 1 + .../Http/Buckets/Files/Download/Get.php | 3 +- .../Http/Buckets/Files/Preview/Get.php | 1 + .../Storage/Http/Buckets/Files/View/Get.php | 3 +- src/Appwrite/Platform/Tasks/Specs.php | 54 ++++++++++++ src/Appwrite/SDK/Method.php | 12 +-- .../SDK/Specification/Format/OpenAPI3.php | 14 +++- .../SDK/Specification/Format/Swagger2.php | 14 +++- .../Storage/StorageConsoleClientTest.php | 80 ++++++++++++++++++ .../Services/Users/UsersConsoleClientTest.php | 83 +++++++++++++++++++ 21 files changed, 267 insertions(+), 21 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index a090635bb5..ea00b7f356 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -329,9 +329,9 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 416c294140..f7a98e0f8f 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -491,9 +491,9 @@ return function (Container $context): void { // Impersonation: if current user has impersonator capability and headers/params are set, act as another user // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index cc30f014bc..2d66b5b21b 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 3bae32c862..710c7cd61d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 6faa0fe223..244f426c4d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,6 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index ef9f8c0e47..dfeaff0f8a 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 315202d4d5..3c791aa128 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,6 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index c73d20fb0c..792026577b 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,6 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index f3448f5264..b8f3d0247d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 51d4df2a49..63d7d3f85e 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,6 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index c92e3c1406..8adff12784 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -52,7 +52,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 0ab998292d..088bf6c499 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,6 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 7e5d7d6879..a11560cd5a 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -57,7 +57,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 9c316a3b57..dcc033260f 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,6 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index b78d582c47..a88b41b3bc 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -58,7 +58,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 8717ae742e..fa3889125d 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -181,18 +181,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], APP_SDK_PLATFORM_SERVER => [ 'Project' => [ @@ -255,18 +273,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], APP_SDK_PLATFORM_CONSOLE => [ 'Project' => [ @@ -329,18 +365,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], ]; } diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index 5f6ccf9a0f..f1b327513f 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -32,7 +32,7 @@ class Method * @param array $additionalParameters * @param string $desc * @param bool $public Whether this method should be rendered on the website/documentation - * @param string $projectAuth Project authentication security scheme to use in specs + * @param array $locationAuth Security scheme keys injected for location-type methods (includes project auth) */ public function __construct( protected string $namespace, @@ -51,16 +51,12 @@ class Method protected array $additionalParameters = [], protected string $desc = '', protected bool $public = true, - protected string $projectAuth = 'Project' + protected array $locationAuth = [] ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); $this->validateDesc($description); - if (!\in_array($projectAuth, ['Project', 'ProjectQuery'], true)) { - self::$errors[] = "Error with {$this->getRouteName()} method: Invalid project auth scheme"; - } - foreach ($responses as $response) { $this->validateResponseModel($response->getModel()); $this->validateNoContent($response); @@ -229,9 +225,9 @@ class Method return $this->additionalParameters; } - public function getProjectAuth(): string + public function getLocationAuth(): array { - return $this->projectAuth; + return $this->locationAuth; } public function setNamespace(string $namespace): self diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index dfa38b0bf5..d9c2bf301e 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -188,7 +188,7 @@ class OpenAPI3 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { $methodSecurities[$security->value] = []; @@ -374,7 +374,7 @@ class OpenAPI3 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { /** @var AuthType $security */ @@ -384,6 +384,16 @@ class OpenAPI3 extends Format } $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); + + if ($sdk->getType() === MethodType::LOCATION) { + foreach ($sdk->getLocationAuth() as $key) { + if (\array_key_exists($key, $this->keys)) { + $securities[$key] = []; + $temp['x-appwrite']['auth'][$key] = []; + } + } + } + $temp['security'][] = $securities; } diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 20b1fb9b94..b1541d5ddb 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -188,7 +188,7 @@ class Swagger2 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { /** @var AuthType $security */ if (\array_key_exists($security->value, $this->keys)) { @@ -365,7 +365,7 @@ class Swagger2 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { @@ -374,6 +374,16 @@ class Swagger2 extends Format } $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); + + if ($sdk->getType() === MethodType::LOCATION) { + foreach ($sdk->getLocationAuth() as $key) { + if (\array_key_exists($key, $this->keys)) { + $securities[$key] = []; + $temp['x-appwrite']['auth'][$key] = []; + } + } + } + $temp['security'][] = $securities; } diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 9d2a639631..aca2717170 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -10,6 +10,8 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideConsole; use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; final class StorageConsoleClientTest extends Scope { @@ -198,4 +200,82 @@ final class StorageConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); } + + public function testFilePreviewWithImpersonation(): void + { + $projectId = $this->getProject()['$id']; + $adminHeaders = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + $targetId = ID::unique(); + $target = $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $targetId, + 'email' => 'impersonation-storage-target-' . $targetId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + $actorId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $actorId, + 'email' => 'impersonation-storage-actor-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Actor', + ]); + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $adminHeaders, [ + 'impersonator' => true, + ]); + + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', $adminHeaders, [ + 'bucketId' => ID::unique(), + 'name' => 'Impersonation Test Bucket', + 'fileSecurity' => true, + 'permissions' => [ + Permission::read(Role::user($targetId)), + Permission::create(Role::any()), + ], + ]); + $this->assertEquals(201, $bucket['headers']['status-code']); + $bucketId = $bucket['body']['$id']; + + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge( + $adminHeaders, + ['content-type' => 'multipart/form-data'] + ), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::user($targetId)), + ], + ]); + $this->assertEquals(201, $file['headers']['status-code']); + $fileId = $file['body']['$id']; + + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $adminHeaders); + $this->assertEquals(201, $session['headers']['status-code']); + + $sessionHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $session['body']['secret'], + ]; + + $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); + $this->assertEquals(404, $denied['headers']['status-code']); + + $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $preview['headers']['status-code']); + $this->assertEquals('image/png', $preview['headers']['content-type']); + $this->assertNotEmpty($preview['body']); + + $view = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $view['headers']['status-code']); + } } diff --git a/tests/e2e/Services/Users/UsersConsoleClientTest.php b/tests/e2e/Services/Users/UsersConsoleClientTest.php index 1ac901bf58..373b941fb4 100644 --- a/tests/e2e/Services/Users/UsersConsoleClientTest.php +++ b/tests/e2e/Services/Users/UsersConsoleClientTest.php @@ -83,4 +83,87 @@ final class UsersConsoleClientTest extends Scope $this->assertEquals($userId, $set['body']['$id']); $this->assertNotEmpty($set['body']['password']); } + + public function testImpersonateQueryParams(): void + { + $projectId = $this->getProject()['$id']; + $headers = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + $actorId = ID::unique(); + $actor = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $actorId, + 'email' => 'impersonator-queryparam-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Impersonator', + ]); + $this->assertEquals(201, $actor['headers']['status-code']); + + $targetId = ID::unique(); + $targetEmail = 'target-queryparam-' . $targetId . '@example.com'; + $targetPhone = '+1' . rand(2000000000, 2999999999); + + $target = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $targetId, + 'email' => $targetEmail, + 'password' => 'password123', + 'name' => 'Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $targetId . '/phone', $headers, [ + 'number' => $targetPhone, + ]); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ + 'impersonator' => true, + ]); + + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $headers); + $this->assertEquals(201, $session['headers']['status-code']); + + $sessionHeaders = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $session['body']['secret'], + ]; + + $byHeader = $this->client->call(Client::METHOD_GET, '/account', array_merge($sessionHeaders, [ + 'x-appwrite-impersonate-user-id' => $targetId, + ])); + $this->assertEquals(200, $byHeader['headers']['status-code']); + $this->assertEquals($targetId, $byHeader['body']['$id']); + $this->assertEquals($actorId, $byHeader['body']['impersonatorUserId']); + + $byUserId = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $byUserId['headers']['status-code']); + $this->assertEquals($targetId, $byUserId['body']['$id']); + + $byEmail = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateemail' => $targetEmail, + ]); + $this->assertEquals(200, $byEmail['headers']['status-code']); + $this->assertEquals($targetId, $byEmail['body']['$id']); + + $byPhone = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonatephone' => $targetPhone, + ]); + $this->assertEquals(200, $byPhone['headers']['status-code']); + $this->assertEquals($targetId, $byPhone['body']['$id']); + + // header takes priority over query param + $priority = $this->client->call( + Client::METHOD_GET, + '/account', + array_merge($sessionHeaders, ['x-appwrite-impersonate-user-id' => $targetId]), + ['impersonateuserid' => $actorId] + ); + $this->assertEquals(200, $priority['headers']['status-code']); + $this->assertEquals($targetId, $priority['body']['$id']); + } } From 29272b7186cda0d66888206c049655d2ad75c0bb Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Mon, 8 Jun 2026 11:38:23 +0530 Subject: [PATCH 058/151] fix: use header scheme keys in locationAuth, add impersonateUserEmail/Phone param aliases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use ImpersonateUserId/Email/Phone directly in locationAuth — their caseLower maps to existing config keys set by the corresponding setters. Add impersonateUserEmail and impersonateUserPhone as backend param fallbacks to match caseCamel output of those keys in LOCATION method URLs. --- app/init/realtime/connection.php | 4 +- app/init/resources/request.php | 4 +- .../Modules/Avatars/Http/Browsers/Get.php | 2 +- .../Modules/Avatars/Http/CreditCards/Get.php | 2 +- .../Modules/Avatars/Http/Favicon/Get.php | 2 +- .../Modules/Avatars/Http/Flags/Get.php | 2 +- .../Modules/Avatars/Http/Image/Get.php | 2 +- .../Modules/Avatars/Http/Initials/Get.php | 2 +- .../Platform/Modules/Avatars/Http/QR/Get.php | 2 +- .../Modules/Avatars/Http/Screenshots/Get.php | 2 +- .../Http/Deployments/Download/Get.php | 2 +- .../Sites/Http/Deployments/Download/Get.php | 2 +- .../Http/Buckets/Files/Download/Get.php | 2 +- .../Http/Buckets/Files/Preview/Get.php | 2 +- .../Storage/Http/Buckets/Files/View/Get.php | 2 +- src/Appwrite/Platform/Tasks/Specs.php | 54 ------------------- 16 files changed, 17 insertions(+), 71 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index ea00b7f356..63ecf2ca52 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -330,8 +330,8 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index f7a98e0f8f..b505077c9b 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -492,8 +492,8 @@ return function (Container $context): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index 2d66b5b21b..d5ff7257fe 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 710c7cd61d..15e558e345 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 244f426c4d..a284ff8ef3 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,7 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index dfeaff0f8a..e0834726da 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 3c791aa128..f8a2c90b89 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,7 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index 792026577b..a10bed6bd8 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,7 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index b8f3d0247d..c135678489 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 63d7d3f85e..13b120d9f9 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,7 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index 8adff12784..d0e3195e9d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -53,7 +53,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 088bf6c499..c13c67427f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,7 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index a11560cd5a..35e3b580fd 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -58,7 +58,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index dcc033260f..0474630b40 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,7 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index a88b41b3bc..c12b6d1aff 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -59,7 +59,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index fa3889125d..8717ae742e 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -181,36 +181,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], APP_SDK_PLATFORM_SERVER => [ 'Project' => [ @@ -273,36 +255,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], APP_SDK_PLATFORM_CONSOLE => [ 'Project' => [ @@ -365,36 +329,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], ]; } From ebbb7737190f4da057ecc1de631e54e707528241 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Mon, 8 Jun 2026 11:44:33 +0530 Subject: [PATCH 059/151] fix: remove unnecessary impersonateUserEmail/Phone param aliases --- app/init/realtime/connection.php | 4 ++-- app/init/resources/request.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index 63ecf2ca52..ea00b7f356 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -330,8 +330,8 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index b505077c9b..f7a98e0f8f 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -492,8 +492,8 @@ return function (Container $context): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; From b940b6744c46b4500c3b20579ea9a551fc5107b0 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 8 Jun 2026 11:48:43 +0530 Subject: [PATCH 060/151] Fix create execution request content type (#12533) --- .../Platform/Modules/Functions/Http/Executions/Create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index ba36b47884..7326d13791 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -81,7 +81,7 @@ class Create extends Base model: Response::MODEL_EXECUTION, ) ], - contentType: ContentType::MULTIPART, + requestType: ContentType::MULTIPART, )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('body', '', new Text(10485760, 0), 'HTTP body of execution. Default value is empty string.', true) From c6d4cdfa127506cdef5ed6a60b8c6e1eef752307 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 8 Jun 2026 12:49:19 +0530 Subject: [PATCH 061/151] Fix create execution request type metadata (#12534) --- .../Platform/Modules/Functions/Http/Executions/Create.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 7326d13791..5f55755cc2 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -81,7 +81,6 @@ class Create extends Base model: Response::MODEL_EXECUTION, ) ], - requestType: ContentType::MULTIPART, )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('body', '', new Text(10485760, 0), 'HTTP body of execution. Default value is empty string.', true) From 4301bd8e89d15a2fbe2f941c18290de6dfc81f00 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Mon, 8 Jun 2026 13:28:41 +0530 Subject: [PATCH 062/151] fix: remove ImpersonateUserEmail/Phone from locationAuth to avoid empty params in URLs --- src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php | 2 +- .../Modules/Functions/Http/Deployments/Download/Get.php | 2 +- .../Platform/Modules/Sites/Http/Deployments/Download/Get.php | 2 +- .../Modules/Storage/Http/Buckets/Files/Download/Get.php | 2 +- .../Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php | 2 +- .../Platform/Modules/Storage/Http/Buckets/Files/View/Get.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index d5ff7257fe..24529759d9 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 15e558e345..28149b3945 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index a284ff8ef3..de02f59873 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,7 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index e0834726da..7f32cdaa45 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index f8a2c90b89..ad4ed2ff37 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,7 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index a10bed6bd8..4808cb7267 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,7 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index c135678489..ac08e060f2 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 13b120d9f9..15b9408616 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,7 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index d0e3195e9d..d6475b4914 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -53,7 +53,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index c13c67427f..6fbafd908b 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,7 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 35e3b580fd..160fd30c37 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -58,7 +58,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 0474630b40..2a2686b544 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,7 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index c12b6d1aff..4ff3360eab 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -59,7 +59,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') From f090e990f3f83af0f7810576dd1af5fd01b25526 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 8 Jun 2026 14:03:49 +0530 Subject: [PATCH 063/151] Fix function execution lint (#12536) --- .../Platform/Modules/Functions/Http/Executions/Create.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 5f55755cc2..98c9c6e345 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -13,7 +13,6 @@ use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Functions\Validator\Headers; use Appwrite\Platform\Modules\Compute\Base; use Appwrite\SDK\AuthType; -use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Usage\Context; From 60d434f53c10e70fcd73f48703144b5a14901868 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 19:46:33 +0530 Subject: [PATCH 064/151] feat: add corporateEmails policy to block non-corporate sign-ups --- app/config/console.php | 1 + app/controllers/api/account.php | 8 ++++++++ app/controllers/api/users.php | 8 ++++++++ src/Appwrite/Extend/Exception.php | 1 + .../Modules/Organization/Http/Projects/Create.php | 1 + .../Platform/Modules/Projects/Http/Projects/Create.php | 1 + .../Platform/Modules/Teams/Http/Memberships/Create.php | 4 ++++ src/Appwrite/Utopia/Response/Filters/V26.php | 1 + 8 files changed, 25 insertions(+) diff --git a/app/config/console.php b/app/config/console.php index 9a5df31866..bf1850182a 100644 --- a/app/config/console.php +++ b/app/config/console.php @@ -49,6 +49,7 @@ $console = [ 'disposableEmails' => false, 'canonicalEmails' => false, 'freeEmails' => false, + 'corporateEmails' => false, 'invalidateSessions' => true ], 'authWhitelistEmails' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [], diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 74501671ad..4a984af8f1 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -350,6 +350,10 @@ Http::post('/v1/account') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + try { $userId = $userId == 'unique()' ? ID::unique() : $userId; $user->setAttributes([ @@ -3438,6 +3442,10 @@ Http::patch('/v1/account/email') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user ->setAttribute('email', $email) ->setAttribute('emailVerification', false) // After this user needs to confirm mail again diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index d2db2fc69e..380f9b4cf6 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -148,6 +148,10 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $hashedPassword = null; $isHashed = !$hash instanceof Plaintext; @@ -1612,6 +1616,10 @@ Http::patch('/v1/users/:userId/email') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user ->setAttribute('email', $email) ->setAttribute('emailVerification', false) diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 6506127c59..ca114550b7 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -84,6 +84,7 @@ class Exception extends \Exception public const string USER_EMAIL_ALREADY_EXISTS = 'user_email_already_exists'; public const string USER_EMAIL_DISPOSABLE = 'user_email_disposable'; public const string USER_EMAIL_FREE = 'user_email_free'; + public const string USER_EMAIL_NOT_CORPORATE = 'user_email_not_corporate'; public const string USER_EMAIL_NOT_CANONICAL = 'user_email_not_canonical'; public const string USER_PASSWORD_MISMATCH = 'user_password_mismatch'; public const string USER_SESSION_NOT_FOUND = 'user_session_not_found'; diff --git a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php index 785fddf233..90c3781701 100644 --- a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php @@ -94,6 +94,7 @@ class Create extends Action 'disposableEmails' => false, 'canonicalEmails' => false, 'freeEmails' => false, + 'corporateEmails' => false, 'mockNumbers' => [], 'sessionAlerts' => false, 'membershipsUserName' => false, diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php index 1560788d09..28405fe1da 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php @@ -97,6 +97,7 @@ class Create extends Action 'disposableEmails' => false, 'canonicalEmails' => false, 'freeEmails' => false, + 'corporateEmails' => false, 'mockNumbers' => [], 'sessionAlerts' => false, 'membershipsUserName' => false, diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php index 3bffb091ba..19d9237ff1 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php @@ -204,6 +204,10 @@ class Create extends Action throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $hash = $proofForPassword->hash($proofForPassword->generate()); $userId = ID::unique(); diff --git a/src/Appwrite/Utopia/Response/Filters/V26.php b/src/Appwrite/Utopia/Response/Filters/V26.php index 30b4e7dacb..0f53290749 100644 --- a/src/Appwrite/Utopia/Response/Filters/V26.php +++ b/src/Appwrite/Utopia/Response/Filters/V26.php @@ -51,6 +51,7 @@ class V26 extends Filter $content['authDisposableEmails'] = $auths->getAttribute('disposableEmails', false); $content['authCanonicalEmails'] = $auths->getAttribute('canonicalEmails', false); $content['authFreeEmails'] = $auths->getAttribute('freeEmails', false); + $content['authCorporateEmails'] = $auths->getAttribute('corporateEmails', false); $content['authMockNumbers'] = $auths->getAttribute('mockNumbers', []); $content['authSessionAlerts'] = $auths->getAttribute('sessionAlerts', false); $content['authMembershipsUserName'] = $auths->getAttribute('membershipsUserName', false); From ddf5d17f4130d7025b9997f0c7e74305f9dccd1a Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 20:25:54 +0530 Subject: [PATCH 065/151] fix: add missing corporateEmails enforcement to all email update paths in account.php --- app/controllers/api/account.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 4a984af8f1..f944474a22 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1702,6 +1702,10 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') $failureRedirect(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + $failureRedirect(Exception::USER_EMAIL_NOT_CORPORATE); + } + try { $userId = ID::unique(); $user->setAttributes([ @@ -1843,6 +1847,10 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') $failureRedirect(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + $failureRedirect(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user->setAttribute('email', $email); $user->setAttribute('emailCanonical', $emailMetadata['emailCanonical']); $user->setAttribute('emailIsCanonical', $emailMetadata['emailIsCanonical']); @@ -2201,6 +2209,10 @@ Http::post('/v1/account/tokens/magic-url') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user->setAttributes([ '$id' => $userId, '$permissions' => [ @@ -2521,6 +2533,10 @@ Http::post('/v1/account/tokens/email') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user->setAttributes([ '$id' => $userId, '$permissions' => [ From fbd025d8df316248253d7e30fe0016570a3e9b2a Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 20:26:30 +0530 Subject: [PATCH 066/151] fix: add USER_EMAIL_NOT_CORPORATE entry to errors.php --- app/config/errors.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/config/errors.php b/app/config/errors.php index 4a6f08d432..a548d75179 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -241,6 +241,11 @@ return [ 'description' => 'This email address must already be in its canonical form. Please remove aliases, tags, or provider-specific variations and try again.', 'code' => 400, ], + Exception::USER_EMAIL_NOT_CORPORATE => [ + 'name' => Exception::USER_EMAIL_NOT_CORPORATE, + 'description' => 'Only corporate email addresses are allowed. Please use a work email address and try again.', + 'code' => 400, + ], Exception::USER_PASSWORD_MISMATCH => [ 'name' => Exception::USER_PASSWORD_MISMATCH, 'description' => 'Passwords do not match. Please check the password and confirm password.', From 8f8d531ec2e4970f1e448c75ec3af33731a237de Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Sat, 6 Jun 2026 12:22:52 +0530 Subject: [PATCH 067/151] fix: remove redundant null coalescing on emailIsCorporate check --- app/controllers/api/account.php | 12 ++++++------ app/controllers/api/users.php | 4 ++-- .../Modules/Teams/Http/Memberships/Create.php | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index f944474a22..6041d03a7b 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -350,7 +350,7 @@ Http::post('/v1/account') throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } @@ -1702,7 +1702,7 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') $failureRedirect(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { $failureRedirect(Exception::USER_EMAIL_NOT_CORPORATE); } @@ -1847,7 +1847,7 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') $failureRedirect(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { $failureRedirect(Exception::USER_EMAIL_NOT_CORPORATE); } @@ -2209,7 +2209,7 @@ Http::post('/v1/account/tokens/magic-url') throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } @@ -2533,7 +2533,7 @@ Http::post('/v1/account/tokens/email') throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } @@ -3458,7 +3458,7 @@ Http::patch('/v1/account/email') throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 380f9b4cf6..773776b7f4 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -148,7 +148,7 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } @@ -1616,7 +1616,7 @@ Http::patch('/v1/users/:userId/email') throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php index 19d9237ff1..ff0ebaada2 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php @@ -204,7 +204,7 @@ class Create extends Action throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } From 8a63bfadbb48701997cba945dd9ed653f27c0da6 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 8 Jun 2026 17:13:30 +0530 Subject: [PATCH 068/151] Clean up expired OAuth2 grants (#12538) --- app/config/collections/common.php | 7 +++++++ src/Appwrite/Migration/Version/V24.php | 9 +++++++++ src/Appwrite/Platform/Workers/Deletes.php | 22 ++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/app/config/collections/common.php b/app/config/collections/common.php index 9c33d6e554..70b0730077 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -603,6 +603,13 @@ return [ 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => ID::custom('_key_type_expire'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['type', 'expire'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC, Database::ORDER_ASC], + ], ], ], diff --git a/src/Appwrite/Migration/Version/V24.php b/src/Appwrite/Migration/Version/V24.php index 0aa67cb74e..65da1bd20d 100644 --- a/src/Appwrite/Migration/Version/V24.php +++ b/src/Appwrite/Migration/Version/V24.php @@ -213,6 +213,15 @@ class V24 extends Migration $this->dbForProject->purgeCachedCollection($id); break; + case 'tokens': + try { + $this->createIndexFromCollection($this->dbForProject, $id, '_key_type_expire'); + } catch (Throwable $th) { + Console::warning("Failed to create index \"_key_type_expire\" from {$id}: {$th->getMessage()}"); + } + $this->dbForProject->purgeCachedCollection($id); + break; + case 'databases': if ($collectionType === 'projects') { try { diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 0a066570d3..9eda3dbd52 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -221,6 +221,7 @@ class Deletes extends Action $this->deleteAuditLogs($project, $getAudit, $auditRetention); $this->deleteUsageStats($project, $getProjectDB, $getLogsDB, $hourlyUsageRetentionDatetime); $this->deleteExpiredSessions($project, $getProjectDB); + $this->deleteExpiredOAuth2Grants($project, $getProjectDB); $this->deleteExpiredTransactions($project, $getProjectDB); $this->deleteExpiredPresences($project, $getProjectDB, $publisherForUsage); $this->deleteOldDeployments($publisherForDeletes, $project, $getProjectDB); @@ -1147,6 +1148,27 @@ class Deletes extends Action ], $dbForProject); } + /** + * @param Document $project + * @param callable $getProjectDB + * @return void + * @throws Exception|Throwable + */ + private function deleteExpiredOAuth2Grants(Document $project, callable $getProjectDB): void + { + Console::info('Delete expired OAuth2 grants'); + + $dbForProject = $getProjectDB($project); + + $this->deleteByGroup('tokens', [ + Query::select([...$this->selects, 'expire']), + Query::equal('type', [TOKEN_TYPE_OAUTH2]), + Query::lessThan('expire', DateTime::format(new \DateTime())), + Query::orderAsc('expire'), + Query::orderAsc(), + ], $dbForProject); + } + /** * @param Database $dbForPlatform * @param Device $deviceForFiles From 0fa4a23c4a1e632458a64b183327474bd5f9f304 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Mon, 8 Jun 2026 17:13:40 +0530 Subject: [PATCH 069/151] fix: add null-coalesce on emailIsCorporate in users.php and Memberships --- app/controllers/api/users.php | 4 ++-- .../Platform/Modules/Teams/Http/Memberships/Create.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 773776b7f4..380f9b4cf6 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -148,7 +148,7 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } @@ -1616,7 +1616,7 @@ Http::patch('/v1/users/:userId/email') throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php index ff0ebaada2..19d9237ff1 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php @@ -204,7 +204,7 @@ class Create extends Action throw new Exception(Exception::USER_EMAIL_FREE); } - if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); } From ce48d15919cba399ad6b3a63226ad35166a16b8e Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k <83803257+ArnabChatterjee20k@users.noreply.github.com> Date: Tue, 9 Jun 2026 08:30:00 +0530 Subject: [PATCH 070/151] =?UTF-8?q?Fix=20flaky=20realtime=20tests=20by=20a?= =?UTF-8?q?djusting=20websocket=20connection=20parameters=E2=80=A6=20(#125?= =?UTF-8?q?40)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix flaky realtime tests by adjusting websocket connection parameters and refreshing user cache * updated --- .../Realtime/RealtimeConsoleClientTest.php | 8 ++--- .../Realtime/RealtimeCustomClientTest.php | 32 ++++++++++++++++--- .../Services/Realtime/RealtimeQueryBase.php | 22 ++++++------- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index b9066c0272..2e1819c615 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -611,7 +611,7 @@ final class RealtimeConsoleClientTest extends Scope $client = $this->getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], $projectId); + ], $projectId, null, 10); $response = json_decode($client->receive(), true); @@ -915,7 +915,7 @@ final class RealtimeConsoleClientTest extends Scope $client = $this->getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], $projectId); + ], $projectId, null, 10); $response = json_decode($client->receive(), true); @@ -983,7 +983,7 @@ final class RealtimeConsoleClientTest extends Scope $client = $this->getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], 'console'); + ], 'console', null, 10); $response = json_decode($client->receive(), true); @@ -1044,7 +1044,7 @@ final class RealtimeConsoleClientTest extends Scope $client = $this->getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], $projectId); + ], $projectId, null, 30); $response = json_decode($client->receive(), true); diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index 788c008777..c623bdfd90 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -743,6 +743,30 @@ final class RealtimeCustomClientTest extends Scope $this->assertNotEmpty($response['data']['payload']); $client->close(); + + /** + * The password change and password-recovery completion above invalidate + * every existing session of this user, including the one cached in + * self::$user. Re-authenticate the SAME account (its email is now + * torsten@appwrite.io and its password 'test-recovery' after the flow + * above) and refresh only the cached session, so later tests in this + * process keep the same user $id but connect with a valid session + * instead of falling back to a guest connection. + */ + $refreshedSession = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => 'torsten@appwrite.io', + 'password' => 'test-recovery', + ]); + + $this->assertEquals(201, $refreshedSession['headers']['status-code']); + + self::$user[$projectId]['email'] = 'torsten@appwrite.io'; + self::$user[$projectId]['session'] = $refreshedSession['cookies']['a_session_' . $projectId]; + self::$user[$projectId]['sessionId'] = $refreshedSession['body']['$id']; } public function testChannelDatabase() @@ -3141,7 +3165,7 @@ final class RealtimeCustomClientTest extends Scope $client = $this->getWebsocket(['documents'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session - ]); + ], null, null, 10); $response = json_decode($client->receive(), true); @@ -3408,7 +3432,7 @@ final class RealtimeCustomClientTest extends Scope ], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session, - ]); + ], null, null, 10); $connected = json_decode($legacyClient->receive(), true); $this->assertEquals('connected', $connected['type']); @@ -3502,7 +3526,7 @@ final class RealtimeCustomClientTest extends Scope ], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session, - ]); + ], null, null, 10); $connected = json_decode($tablesClient->receive(), true); $this->assertEquals('connected', $connected['type']); @@ -3576,7 +3600,7 @@ final class RealtimeCustomClientTest extends Scope ], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session, - ]); + ], null, null, 10); $connected = json_decode($documentsClient->receive(), true); $this->assertEquals('connected', $connected['type']); diff --git a/tests/e2e/Services/Realtime/RealtimeQueryBase.php b/tests/e2e/Services/Realtime/RealtimeQueryBase.php index 5ab5c26253..233103b963 100644 --- a/tests/e2e/Services/Realtime/RealtimeQueryBase.php +++ b/tests/e2e/Services/Realtime/RealtimeQueryBase.php @@ -165,7 +165,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::equal('$id', [$targetDocumentId])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -263,7 +263,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::notEqual('$id', [$excludedDocumentId])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -358,7 +358,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::greaterThan('score', 50)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -452,7 +452,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::lessThan('age', 18)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -546,7 +546,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::greaterThanEqual('priority', 5)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -658,7 +658,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::lessThanEqual('level', 10)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -771,7 +771,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::isNull('description')->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -865,7 +865,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::isNotNull('email')->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -976,7 +976,7 @@ trait RealtimeQueryBase Query::equal('status', ['active']), Query::greaterThan('priority', 5) ])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -1099,7 +1099,7 @@ trait RealtimeQueryBase Query::equal('type', ['urgent']), Query::equal('type', ['critical']) ])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -1233,7 +1233,7 @@ trait RealtimeQueryBase ]), Query::greaterThanEqual('score', 80) ])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); From 0d3dddfe979ce810102950d6d30cb01bbc7a5575 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 9 Jun 2026 10:25:35 +0530 Subject: [PATCH 071/151] Fix API spec metadata and summaries (#12544) --- app/config/services.php | 112 ++++++++++++++++++ app/controllers/api/account.php | 9 +- app/controllers/api/messaging.php | 5 +- app/controllers/api/users.php | 5 +- .../Tables/Columns/Datetime/Update.php | 2 +- .../Http/VectorsDB/Embeddings/Text/Create.php | 2 +- .../Http/Migrations/NHost/Create.php | 3 +- .../Http/Migrations/NHost/Report/Get.php | 3 +- .../Http/Migrations/Supabase/Create.php | 3 +- .../Http/Migrations/Supabase/Report/Get.php | 3 +- .../Http/Project/SMTP/Tests/Create.php | 3 +- .../Project/Http/Project/SMTP/Update.php | 3 +- .../Proxy/Http/Rules/Redirect/Create.php | 2 +- .../Modules/Webhooks/Http/Webhooks/Create.php | 3 +- .../Modules/Webhooks/Http/Webhooks/Update.php | 3 +- .../SDK/Specification/Format/OpenAPI3.php | 10 +- .../SDK/Specification/Format/Swagger2.php | 10 +- .../Validator/PasswordFormat.php | 32 +++++ .../Utopia/Response/Model/Project.php | 3 +- .../Utopia/Response/Model/Webhook.php | 3 +- tests/unit/SDK/Specification/FormatTest.php | 79 ++++++++++++ 21 files changed, 275 insertions(+), 23 deletions(-) create mode 100644 src/Appwrite/SDK/Specification/Validator/PasswordFormat.php diff --git a/app/config/services.php b/app/config/services.php index f829937623..f7d57bd63d 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -85,6 +85,48 @@ return [ 'icon' => '/images/services/databases.png', 'platforms' => ['client', 'server', 'console'], ], + 'documentsDB' => [ + 'key' => 'documentsDB', + 'name' => 'DocumentsDB', + 'subtitle' => 'The DocumentsDB service allows you to create structured collections of documents, query and filter lists of documents.', + 'description' => '/docs/services/databases.md', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => 'https://appwrite.io/docs/references/documentsdb', + 'tests' => false, + 'optional' => true, + 'icon' => '/images/services/databases.png', + 'platforms' => ['server', 'console'], + ], + 'tablesDB' => [ + 'key' => 'tablesDB', + 'name' => 'TablesDB', + 'subtitle' => 'The TablesDB service allows you to create structured tables of columns, query and filter lists of rows.', + 'description' => '/docs/services/tablesdb.md', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => 'https://appwrite.io/docs/references/tablesdb', + 'tests' => false, + 'optional' => true, + 'icon' => '/images/services/databases.png', + 'platforms' => ['server', 'console'], + ], + 'vectorsDB' => [ + 'key' => 'vectorsDB', + 'name' => 'VectorsDB', + 'subtitle' => 'The VectorsDB service allows you to create vector collections, embeddings, indexes, and documents.', + 'description' => '/docs/services/databases.md', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => 'https://appwrite.io/docs/references/vectorsdb', + 'tests' => false, + 'optional' => true, + 'icon' => '/images/services/databases.png', + 'platforms' => ['server', 'console'], + ], 'locale' => [ 'key' => 'locale', 'name' => 'Locale', @@ -197,6 +239,48 @@ return [ 'icon' => '', 'platforms' => ['client', 'server', 'console'], ], + 'webhooks' => [ + 'key' => 'webhooks', + 'name' => 'Webhooks', + 'subtitle' => 'The Webhooks service allows you to configure event-driven HTTP callbacks for your project.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => '', + 'tests' => false, + 'optional' => true, + 'icon' => '', + 'platforms' => ['server', 'console'], + ], + 'tokens' => [ + 'key' => 'tokens', + 'name' => 'Tokens', + 'subtitle' => 'The Tokens service allows you to create and manage resource tokens for project resources.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => '', + 'tests' => false, + 'optional' => true, + 'icon' => '', + 'platforms' => ['server', 'console'], + ], + 'presences' => [ + 'key' => 'presences', + 'name' => 'Presences', + 'subtitle' => 'The Presences service allows you to create, query, and manage realtime presence state.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => 'https://appwrite.io/docs/references/presences', + 'tests' => false, + 'optional' => true, + 'icon' => '', + 'platforms' => ['client', 'server', 'console'], + ], 'sites' => [ 'key' => 'sites', 'name' => 'Sites', @@ -281,6 +365,34 @@ return [ 'icon' => '', 'platforms' => ['client', 'server', 'console'], ], + 'assistant' => [ + 'key' => 'assistant', + 'name' => 'Assistant', + 'subtitle' => 'The Assistant service allows Console users to ask assistant queries.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => 'https://appwrite.io/docs/references/assistant', + 'tests' => false, + 'optional' => false, + 'icon' => '', + 'platforms' => ['console'], + ], + 'organization' => [ + 'key' => 'organization', + 'name' => 'Organization', + 'subtitle' => 'The Organization service allows you to manage organization-level projects.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => '', + 'tests' => false, + 'optional' => false, + 'icon' => '', + 'platforms' => ['server', 'console'], + ], 'migrations' => [ 'key' => 'migrations', 'name' => 'Migrations', diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 74501671ad..7ba94abf3b 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -29,6 +29,7 @@ use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\MethodType; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Template\Template; use Appwrite\URL\URL as URLParser; use Appwrite\Usage\Context; @@ -257,7 +258,7 @@ Http::post('/v1/account') ->label('abuse-limit', 10) ->param('userId', '', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', false, ['dbForProject']) ->param('email', '', new EmailValidator(), 'User email.') - ->param('password', '', fn ($project, $passwordsDictionary) => new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) ->inject('request') ->inject('response') @@ -3273,8 +3274,8 @@ Http::patch('/v1/account/password') contentType: ContentType::JSON )) ->label('abuse-limit', 10) - ->param('password', '', fn ($project, $passwordsDictionary) => new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) - ->param('oldPassword', '', new Text(256, 0), 'Current user password. Max length: 256 chars.', true) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) + ->param('oldPassword', '', new PasswordFormat(new Text(256, 0)), 'Current user password. Max length: 256 chars.', true) ->inject('response') ->inject('user') ->inject('project') @@ -3890,7 +3891,7 @@ Http::put('/v1/account/recovery') ->label('abuse-key', 'url:{url},userId:{param-userId}') ->param('userId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'User ID.', false, ['dbForProject']) ->param('secret', '', new Text(256), 'Valid reset token.') - ->param('password', '', fn ($project, $passwordsDictionary) => new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) ->inject('response') ->inject('user') ->inject('dbForProject') diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index 8665fbf24c..13119ac2c6 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -17,6 +17,7 @@ use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CompoundUID; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Database\Validator\Queries\Messages; @@ -458,7 +459,7 @@ Http::post('/v1/messaging/providers/smtp') ->param('host', '', new Text(0), 'SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order.') ->param('port', 587, new Range(1, 65535), 'The default SMTP server port.', true) ->param('username', '', new Text(0), 'Authentication username.', true) - ->param('password', '', new Text(0), 'Authentication password.', true) + ->param('password', '', new PasswordFormat(new Text(0)), 'Authentication password.', true) ->param('encryption', '', new WhiteList(['none', 'ssl', 'tls']), 'Encryption type. Can be omitted, \'ssl\', or \'tls\'', true, enum: new Enum(name: 'SmtpEncryption')) ->param('autoTLS', true, new Boolean(), 'Enable SMTP AutoTLS feature.', true) ->param('mailer', '', new Text(0), 'The value to use for the X-Mailer header.', true) @@ -1809,7 +1810,7 @@ Http::patch('/v1/messaging/providers/smtp/:providerId') ->param('host', '', new Text(0), 'SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order.', true) ->param('port', null, new Nullable(new Range(1, 65535)), 'SMTP port.', true) ->param('username', '', new Text(0), 'Authentication username.', true) - ->param('password', '', new Text(0), 'Authentication password.', true) + ->param('password', '', new PasswordFormat(new Text(0)), 'Authentication password.', true) ->param('encryption', '', new WhiteList(['none', 'ssl', 'tls']), 'Encryption type. Can be \'ssl\' or \'tls\'', true, enum: new Enum(name: 'SmtpEncryption')) ->param('autoTLS', null, new Nullable(new Boolean()), 'Enable SMTP AutoTLS feature.', true) ->param('mailer', '', new Text(0), 'The value to use for the X-Mailer header.', true) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index d2db2fc69e..c2e0735c09 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -22,6 +22,7 @@ use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Database\Validator\Queries\Identities; use Appwrite\Utopia\Database\Validator\Queries\Memberships; @@ -283,7 +284,7 @@ Http::post('/v1/users') ->param('userId', '', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', false, ['dbForProject']) ->param('email', null, new Nullable(new EmailValidator()), 'User email.', true) ->param('phone', null, new Nullable(new Phone()), 'Phone number. Format this number with a leading \'+\' and a country code, e.g., +16175551212.', true) - ->param('password', '', fn ($project, $passwordsDictionary) => new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING), 'Plain text user password. Must be at least 8 chars.', true, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'Plain text user password. Must be at least 8 chars.', true, ['project', 'passwordsDictionary']) ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) ->inject('response') ->inject('project') @@ -1434,7 +1435,7 @@ Http::patch('/v1/users/:userId/password') ] )) ->param('userId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'User ID.', false, ['dbForProject']) - ->param('password', '', fn ($project, $passwordsDictionary) => new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? [], allowEmpty: true), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false, allowEmpty: true)], Validator::TYPE_STRING), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? [], allowEmpty: true), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false, allowEmpty: true)], Validator::TYPE_STRING)), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) ->inject('response') ->inject('project') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php index 44c1a06da8..c4ff9055fb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php @@ -33,7 +33,7 @@ class Update extends DatetimeUpdate $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PATCH) ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/columns/datetime/:key') - ->desc('Update dateTime column') + ->desc('Update datetime column') ->groups(['api', 'database', 'schema']) ->label('scope', ['tables.write', 'collections.write', 'columns.write', 'attributes.write']) ->label('resourceType', RESOURCE_TYPE_DATABASES) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php index 05512e3151..6cf2f47910 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php @@ -44,7 +44,7 @@ class Create extends CreateDocumentAction $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_POST) ->setHttpPath('/v1/vectorsdb/embeddings/text') - ->desc('Create Text Embeddings') + ->desc('Create text embeddings') ->groups(['api', 'database']) ->label('scope', 'documents.write') ->label('resourceType', RESOURCE_TYPE_EMBEDDINGS_TEXT) diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php index c3a299ccd5..8f0523a14c 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php @@ -9,6 +9,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; @@ -60,7 +61,7 @@ class Create extends Action ->param('adminSecret', '', new Text(512), 'Source\'s Admin Secret') ->param('database', '', new Text(512), 'Source\'s Database Name') ->param('username', '', new Text(512), 'Source\'s Database Username') - ->param('password', '', new Text(512), 'Source\'s Database Password') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password') ->param('port', 5432, new Integer(true), 'Source\'s Database Port', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php index a16d47f53d..4f70aca481 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Document; use Utopia\Migration\Sources\NHost; @@ -53,7 +54,7 @@ class Get extends Action ->param('adminSecret', '', new Text(512), 'Source\'s Admin Secret.') ->param('database', '', new Text(512), 'Source\'s Database Name.') ->param('username', '', new Text(512), 'Source\'s Database Username.') - ->param('password', '', new Text(512), 'Source\'s Database Password.') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password.') ->param('port', 5432, new Integer(true), 'Source\'s Database Port.', true) ->inject('response') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php index dc835158ab..1cf8849503 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php @@ -9,6 +9,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; @@ -60,7 +61,7 @@ class Create extends Action ->param('apiKey', '', new Text(512), 'Source\'s API Key') ->param('databaseHost', '', new Text(512), 'Source\'s Database Host') ->param('username', '', new Text(512), 'Source\'s Database Username') - ->param('password', '', new Text(512), 'Source\'s Database Password') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password') ->param('port', 5432, new Integer(true), 'Source\'s Database Port', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php index d88fa0e2fb..df0455455e 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Document; use Utopia\Migration\Sources\Supabase; @@ -53,7 +54,7 @@ class Get extends Action ->param('apiKey', '', new Text(512), 'Source\'s API Key.') ->param('databaseHost', '', new Text(512), 'Source\'s Database Host.') ->param('username', '', new Text(512), 'Source\'s Database Username.') - ->param('password', '', new Text(512), 'Source\'s Database Password.') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password.') ->param('port', 5432, new Integer(true), 'Source\'s Database Port.', true) ->inject('response') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php index fa35b8d6d5..df5b650d5d 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php @@ -10,6 +10,7 @@ use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Template\Template; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response as UtopiaResponse; @@ -64,7 +65,7 @@ class Create extends Action ->param('host', '', new Hostname(), 'SMTP server host name', optional: true, deprecated: true) // Backwards compatibility ->param('port', null, new Integer(), 'SMTP server port', optional: true, deprecated: true) // Backwards compatibility ->param('username', '', new Text(256), 'SMTP server username', optional: true, deprecated: true) // Backwards compatibility - ->param('password', '', new Text(256), 'SMTP server password', optional: true, deprecated: true) // Backwards compatibility + ->param('password', '', new PasswordFormat(new Text(256)), 'SMTP server password', optional: true, deprecated: true) // Backwards compatibility ->param('secure', '', new WhiteList(['tls', 'ssl'], true), 'Does SMTP server use secure connection', optional: true, deprecated: true) // Backwards compatibility ->inject('response') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index c3fe222298..bf513f5dac 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use PHPMailer\PHPMailer\PHPMailer; use Throwable; @@ -62,7 +63,7 @@ class Update extends Action ->param('host', null, new Nullable(new Hostname()), 'SMTP server hostname (domain)', optional: true) ->param('port', null, new Nullable(new Integer()), 'SMTP server port', optional: true) ->param('username', null, new Nullable(new Text(256, 0)), 'SMTP server username. Pass an empty string to clear a previously set value.', optional: true) - ->param('password', null, new Nullable(new Text(256, 0)), 'SMTP server password. Pass an empty string to clear a previously set value. This property is stored securely and cannot be read in future (write-only).', optional: true) + ->param('password', null, new Nullable(new PasswordFormat(new Text(256, 0))), 'SMTP server password. Pass an empty string to clear a previously set value. This property is stored securely and cannot be read in future (write-only).', optional: true) ->param('senderEmail', null, new Nullable(new Email(allowEmpty: true)), 'Email address shown in inbox as the sender of the email. Pass an empty string to clear a previously set value.', optional: true) ->param('senderName', null, new Nullable(new Text(256, 0)), 'Name shown in inbox as the sender of the email. Pass an empty string to clear a previously set value.', optional: true) ->param('replyToEmail', null, new Nullable(new Email(allowEmpty: true)), 'Email used when user replies to the email. Pass an empty string to clear a previously set value.', optional: true) diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index 24abbf49ba..c15bc3b1d9 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -40,7 +40,7 @@ class Create extends Action ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) ->setHttpPath('/v1/proxy/rules/redirect') ->groups(['api', 'proxy']) - ->desc('Create Redirect rule') + ->desc('Create redirect rule') ->label('scope', 'rules.write') ->label('event', 'rules.[ruleId].create') ->label('audits.event', 'rule.create') diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php index e192dff2a0..38196420be 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php @@ -8,6 +8,7 @@ use Appwrite\Extend\Exception; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Response; use Utopia\Database\Database; @@ -68,7 +69,7 @@ class Create extends Action ->param('enabled', true, new Boolean(), 'Enable or disable a webhook.', true) ->param('tls', false, new Boolean(), 'Certificate verification, false for disabled or true for enabled.', true) ->param('authUsername', '', new Text(256), 'Webhook HTTP user. Max length: 256 chars.', true) - ->param('authPassword', '', new Text(256), 'Webhook HTTP password. Max length: 256 chars.', true) + ->param('authPassword', '', new PasswordFormat(new Text(256)), 'Webhook HTTP password. Max length: 256 chars.', true) ->param('secret', null, new Nullable(new Text(256, 8)), 'Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters.', optional: true) ->inject('response') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php index e7b516449e..17b93812f3 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php @@ -8,6 +8,7 @@ use Appwrite\Extend\Exception; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; @@ -65,7 +66,7 @@ class Update extends Action ->param('enabled', true, new Boolean(), 'Enable or disable a webhook.', true) ->param('tls', false, new Boolean(), 'Certificate verification, false for disabled or true for enabled.', true) ->param('authUsername', '', new Text(256), 'Webhook HTTP user. Max length: 256 chars.', true) - ->param('authPassword', '', new Text(256), 'Webhook HTTP password. Max length: 256 chars.', true) + ->param('authPassword', '', new PasswordFormat(new Text(256)), 'Webhook HTTP password. Max length: 256 chars.', true) ->inject('response') ->inject('project') ->inject('queueForEvents') diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index d9c2bf301e..670f9f9f5f 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -492,6 +492,9 @@ class OpenAPI3 extends Format $node['schema']['x-upload-id'] = true; } $node['schema']['type'] = $validator->getType(); + $node['schema']['x-appwrite'] = [ + 'idGenerator' => 'ID.unique', + ]; $node['schema']['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; break; case \Utopia\Database\Validator\Datetime::class: @@ -597,6 +600,7 @@ class OpenAPI3 extends Format $node['schema']['x-example'] = ($param['example'] ?? '') ?: '["' . Role::any()->toString() . '"]'; break; case \Appwrite\Auth\Validator\Password::class: + case \Appwrite\SDK\Specification\Validator\PasswordFormat::class: $node['schema']['type'] = $validator->getType(); $node['schema']['format'] = 'password'; $node['schema']['x-example'] = ($param['example'] ?? '') ?: 'password'; @@ -817,6 +821,10 @@ class OpenAPI3 extends Format $body['content'][$consumes[0]]['schema']['properties'][$name]['x-upload-id'] = $node['schema']['x-upload-id']; } + if (isset($node['schema']['x-appwrite'])) { + $body['content'][$consumes[0]]['schema']['properties'][$name]['x-appwrite'] = $node['schema']['x-appwrite']; + } + if (\array_key_exists('items', $node['schema'])) { $body['content'][$consumes[0]]['schema']['properties'][$name]['items'] = $node['schema']['items']; } @@ -883,7 +891,7 @@ class OpenAPI3 extends Format } $type = ''; - $format = null; + $format = $rule['format'] ?? null; $items = null; $examples[$name] = $rule['example'] ?? null; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index b1541d5ddb..e5f240dde3 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -474,6 +474,9 @@ class Swagger2 extends Format $node['x-upload-id'] = true; } $node['type'] = $validator->getType(); + $node['x-appwrite'] = [ + 'idGenerator' => 'ID.unique', + ]; $node['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; break; case \Utopia\Database\Validator\Datetime::class: @@ -563,6 +566,7 @@ class Swagger2 extends Format $node['x-example'] = ($param['example'] ?? '') ?: '["' . Role::any()->toString() . '"]'; break; case \Appwrite\Auth\Validator\Password::class: + case \Appwrite\SDK\Specification\Validator\PasswordFormat::class: $node['type'] = $validator->getType(); $node['format'] = 'password'; $node['x-example'] = ($param['example'] ?? '') ?: 'password'; @@ -778,6 +782,10 @@ class Swagger2 extends Format $body['schema']['properties'][$name]['x-enum-keys'] = $node['x-enum-keys']; } + if (isset($node['x-appwrite'])) { + $body['schema']['properties'][$name]['x-appwrite'] = $node['x-appwrite']; + } + if ($parameter['nullable']) { $body['schema']['properties'][$name]['x-nullable'] = true; } @@ -846,7 +854,7 @@ class Swagger2 extends Format } $type = ''; - $format = null; + $format = $rule['format'] ?? null; $items = null; $examples[$name] = $rule['example'] ?? null; diff --git a/src/Appwrite/SDK/Specification/Validator/PasswordFormat.php b/src/Appwrite/SDK/Specification/Validator/PasswordFormat.php new file mode 100644 index 0000000000..5e3dc1cf8f --- /dev/null +++ b/src/Appwrite/SDK/Specification/Validator/PasswordFormat.php @@ -0,0 +1,32 @@ +validator->getDescription(); + } + + public function isArray(): bool + { + return $this->validator->isArray(); + } + + public function getType(): string + { + return $this->validator->getType(); + } + + public function isValid(mixed $value): bool + { + return $this->validator->isValid($value); + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index d475cfe5f2..3d5fd76de3 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -111,9 +111,10 @@ class Project extends Model ]) ->addRule('smtpPassword', [ 'type' => self::TYPE_STRING, + 'format' => 'password', 'description' => 'SMTP server password. This property is write-only and always returned empty.', 'default' => '', - 'example' => '', + 'example' => 'smtp-password', ]) ->addRule('smtpSecure', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Webhook.php b/src/Appwrite/Utopia/Response/Model/Webhook.php index 6a0197e4a1..c3a1c288ea 100644 --- a/src/Appwrite/Utopia/Response/Model/Webhook.php +++ b/src/Appwrite/Utopia/Response/Model/Webhook.php @@ -65,9 +65,10 @@ class Webhook extends Model ]) ->addRule('authPassword', [ 'type' => self::TYPE_STRING, + 'format' => 'password', 'description' => 'HTTP basic authentication password.', 'default' => '', - 'example' => 'password', + 'example' => 'webhook-password', ]) ->addRule('secret', [ 'type' => self::TYPE_STRING, diff --git a/tests/unit/SDK/Specification/FormatTest.php b/tests/unit/SDK/Specification/FormatTest.php index 51d99de429..962979657d 100644 --- a/tests/unit/SDK/Specification/FormatTest.php +++ b/tests/unit/SDK/Specification/FormatTest.php @@ -2,7 +2,14 @@ namespace Tests\Unit\SDK\Specification; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; use Appwrite\SDK\Specification\Format; +use Appwrite\SDK\Specification\Format\OpenAPI3; +use Appwrite\SDK\Specification\Format\Swagger2; +use Appwrite\SDK\Specification\Validator\PasswordFormat; +use Appwrite\Utopia\Database\Validator\CustomId; +use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model\HealthStatus; use Appwrite\Utopia\Response\Model\PlatformAndroid; use Appwrite\Utopia\Response\Model\PlatformApple; @@ -10,8 +17,12 @@ use Appwrite\Utopia\Response\Model\PlatformLinux; use Appwrite\Utopia\Response\Model\PlatformList; use Appwrite\Utopia\Response\Model\PlatformWeb; use Appwrite\Utopia\Response\Model\PlatformWindows; +use Appwrite\Utopia\Response\Model\Webhook; use PHPUnit\Framework\TestCase; use Utopia\DI\Container; +use Utopia\Http\Route; +use Utopia\Validator\Nullable; +use Utopia\Validator\Text; class TestFormat extends Format { @@ -76,4 +87,72 @@ final class FormatTest extends TestCase { $this->assertSame('HealthCheckStatus', (new HealthStatus())->getRules()['status']['enumSDKName']); } + + public function testOpenApiCustomIdBodyFieldIncludesIdGeneratorMetadata(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('POST', '/v1/tests')) + ->desc('Create test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'createTest', + description: 'Create test.', + auth: [], + responses: [], + )) + ->param('userId', '', new CustomId(), 'User ID.'); + + $spec = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + + $this->assertSame( + ['idGenerator' => 'ID.unique'], + $spec['paths']['/tests']['post']['requestBody']['content']['application/json']['schema']['properties']['userId']['x-appwrite'] + ); + } + + public function testPasswordFormatMarksOnlyExplicitPasswordFields(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('POST', '/v1/tests')) + ->desc('Create test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'createTest', + description: 'Create test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_WEBHOOK, + ), + ], + )) + ->param('password', '', new PasswordFormat(new Text(256)), 'Password.') + ->param('nullablePassword', null, new Nullable(new PasswordFormat(new Text(256, 0))), 'Nullable password.', true) + ->param('name', '', new Text(256), 'Name.'); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [new Webhook()], [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], [new Webhook()], [], 0, 'console'))->parse(); + + $openApiProperties = $openApi['paths']['/tests']['post']['requestBody']['content']['application/json']['schema']['properties']; + $swaggerProperties = $swagger['paths']['/tests']['post']['parameters'][0]['schema']['properties']; + + $this->assertSame('password', $openApiProperties['password']['format']); + $this->assertSame('password', $openApiProperties['nullablePassword']['format']); + $this->assertTrue($openApiProperties['nullablePassword']['x-nullable']); + $this->assertArrayNotHasKey('format', $openApiProperties['name']); + $this->assertSame('password', $openApi['components']['schemas']['webhook']['properties']['authPassword']['format']); + + $this->assertSame('password', $swaggerProperties['password']['format']); + $this->assertSame('password', $swaggerProperties['nullablePassword']['format']); + $this->assertTrue($swaggerProperties['nullablePassword']['x-nullable']); + $this->assertArrayNotHasKey('format', $swaggerProperties['name']); + $this->assertSame('password', $swagger['definitions']['webhook']['properties']['authPassword']['format']); + } } From 93c801caa670f0cdd9e5201ae927a37bcce62528 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 9 Jun 2026 09:22:05 +0300 Subject: [PATCH 072/151] wrap with go --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index b09f806e73..67ef04cce6 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -289,9 +289,11 @@ abstract class ScheduleBase extends Action } if (!empty($scheduleIdsToDelete)) { - $dbForPlatform->deleteDocuments('schedules', [ - Query::equal('$id', $scheduleIdsToDelete), - ]); + go(function () use ($dbForPlatform, $scheduleIdsToDelete) { + $dbForPlatform->deleteDocuments('schedules', [ + Query::equal('$id', $scheduleIdsToDelete), + ]); + }); } $lastSyncUpdate = $time; From f450ec0e7fa42c9d2146cc651fee2b3529350159 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 9 Jun 2026 09:34:08 +0300 Subject: [PATCH 073/151] Update message --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 67ef04cce6..dfa33fad38 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -289,6 +289,8 @@ abstract class ScheduleBase extends Action } if (!empty($scheduleIdsToDelete)) { + Console::info('Deleting ' . count($scheduleIdsToDelete) . ' orphaned schedules'); + go(function () use ($dbForPlatform, $scheduleIdsToDelete) { $dbForPlatform->deleteDocuments('schedules', [ Query::equal('$id', $scheduleIdsToDelete), From 770bf4d4264cfbd9c76041df9afdf78060c61817 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 9 Jun 2026 19:04:25 +1200 Subject: [PATCH 074/151] fix: patch npm vulnerabilities in astro site test fixtures Updates astro 5.x to 6.4.4 and @astrojs/node 9.x to 10.1.3 across the three astro Sites test fixtures, regenerating lockfiles to pull patched transitive dependencies. Clears 48 Trivy code-scanning alerts covering astro, @astrojs/node, vite, postcss, devalue, h3, defu, picomatch, and smol-toml. Verified each fixture builds (server / static / middleware) and `npm audit` reports 0 vulnerabilities. The middleware fixture still exports `handler` for its custom express server, and the SSR output the e2e suite asserts on ("Env variable is Appwrite") is unchanged. Co-Authored-By: Claude Opus 4.8 --- .../package-lock.json | 2129 ++++++----------- .../astro-custom-start-command/package.json | 4 +- .../sites/astro-static/package-lock.json | 2057 ++++++---------- .../resources/sites/astro-static/package.json | 2 +- tests/resources/sites/astro/package-lock.json | 2069 ++++++---------- tests/resources/sites/astro/package.json | 4 +- 6 files changed, 2219 insertions(+), 4046 deletions(-) diff --git a/tests/resources/sites/astro-custom-start-command/package-lock.json b/tests/resources/sites/astro-custom-start-command/package-lock.json index 3a665bca3d..fa23c5dfe9 100644 --- a/tests/resources/sites/astro-custom-start-command/package-lock.json +++ b/tests/resources/sites/astro-custom-start-command/package-lock.json @@ -8,36 +8,44 @@ "name": "astro-custom-start-command", "version": "0.0.1", "dependencies": { - "@astrojs/node": "^9.5.4", - "astro": "^5.2.5" + "@astrojs/node": "^10.1.3", + "astro": "^6.4.4" }, "devDependencies": {} }, "node_modules/@astrojs/compiler": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.13.0.tgz", - "integrity": "sha512-mqVORhUJViA28fwHYaWmsXSzLO9osbdZ5ImUfxBarqsYdMlPbqAqGJCxsNzvppp1BEzc1mJNjOVvQqeDN8Vspw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-4.0.0.tgz", + "integrity": "sha512-eouss7G8ygdZqHuke033VMcVw5HTZUu+PXd/h06DGDUg/jt5btPYPqh66ENWw/mU78rBrf/oeC4oqoBwMtDMNA==", "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.7.5.tgz", - "integrity": "sha512-vreGnYSSKhAjFJCWAwe/CNhONvoc5lokxtRoZims+0wa3KbHBdPHSSthJsKxPd8d/aic6lWKpRTYGY/hsgK6EA==", - "license": "MIT" - }, - "node_modules/@astrojs/markdown-remark": { - "version": "6.3.10", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.10.tgz", - "integrity": "sha512-kk4HeYR6AcnzC4QV8iSlOfh+N8TZ3MEStxPyenyCtemqn8IpEATBFMTJcfrNW32dgpt6MY3oCkMM/Tv3/I4G3A==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.0.tgz", + "integrity": "sha512-Ry2R3VPeIN4uPCSA4xQc+e+vsJXkalKpEbDc07hV+a/o5Bs2N/s/uDcPJH/05L19DKh9tAy7e6JM3YZ6Cxfezw==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.5", - "@astrojs/prism": "3.3.0", + "@types/hast": "^3.0.4", + "@types/mdast": "^4.0.4", + "js-yaml": "^4.1.1", + "picomatch": "^4.0.4", + "retext-smartypants": "^6.2.0", + "shiki": "^4.0.2", + "smol-toml": "^1.6.0", + "unified": "^11.0.5" + } + }, + "node_modules/@astrojs/markdown-remark": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-7.2.0.tgz", + "integrity": "sha512-+YxmVQu1Bd+MFfSzjq1rOJvD9+nIOJzz5YIIhdIH01RrxRkKbyKoEgyIqP3yv51MhzMDgd79QaPv+kCVPT8vHw==", + "license": "MIT", + "dependencies": { + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", - "import-meta-resolve": "^4.2.0", - "js-yaml": "^4.1.1", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", @@ -45,53 +53,49 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", - "shiki": "^3.19.0", - "smol-toml": "^1.5.2", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", - "unist-util-visit": "^5.0.0", + "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "node_modules/@astrojs/node": { - "version": "9.5.4", - "resolved": "https://registry.npmjs.org/@astrojs/node/-/node-9.5.4.tgz", - "integrity": "sha512-AbPSZsMGu8hXPR2XxV79RaKy8h6wijhtoqZGeUf4OXg2w1mxXlx4VnIc1D+QvtsgauSz7P5PLhmvf6w/J41GJg==", + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/@astrojs/node/-/node-10.1.3.tgz", + "integrity": "sha512-NybvdqXFwUbTkaJ8OhDmkrXK+cdpXR+KhyiaBduVVqzAopT70J9QVah8Iz2vt24+wF6PqH1oxElnQlU4OwcBLA==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.5", + "@astrojs/internal-helpers": "0.10.0", "send": "^1.2.1", "server-destroy": "^1.0.1" }, "peerDependencies": { - "astro": "^5.17.3" + "astro": "^6.3.0" } }, "node_modules/@astrojs/prism": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.3.0.tgz", - "integrity": "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz", + "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==", "license": "MIT", "dependencies": { "prismjs": "^1.30.0" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": ">=22.12.0" } }, "node_modules/@astrojs/telemetry": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.0.tgz", - "integrity": "sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.2.tgz", + "integrity": "sha512-j8DNruA8ors99Al39RYZPJK4DC1bKkoNm93mAMuBhY9TCNC4R8n1q7ovFnJ5qhGh5Lsh7pa1gpQVpYpsJPeTHQ==", "license": "MIT", "dependencies": { - "ci-info": "^4.2.0", - "debug": "^4.4.0", - "dlv": "^1.1.3", + "ci-info": "^4.4.0", "dset": "^3.1.4", - "is-docker": "^3.0.0", - "is-wsl": "^3.1.0", + "is-docker": "^4.0.0", + "is-wsl": "^3.1.1", "which-pm-runs": "^1.1.0" }, "engines": { @@ -99,30 +103,30 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", - "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "license": "MIT", "dependencies": { - "@babel/types": "^7.28.5" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -132,13 +136,13 @@ } }, "node_modules/@babel/types": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", - "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -156,10 +160,38 @@ "node": ">=18" } }, + "node_modules/@clack/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.4.1.tgz", + "integrity": "sha512-FILJa1gGKEFTGZAJE9RpVhrjKz3c3h4ar60dSv6cGuDqufQ84YEIS3GAGvZiN+H6yaLbbvTFNejjCC4tXpZEuw==", + "license": "MIT", + "dependencies": { + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, + "node_modules/@clack/prompts": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.5.1.tgz", + "integrity": "sha512-zccHj2z2oCCO4yrDiRSlFOxWerGqRiysP7a5jPK6uoI9URKAquwY42Dd/iUP8JWHxEzdRe4TlbvZCo8z1/mhrw==", + "license": "MIT", + "dependencies": { + "@clack/core": "1.4.1", + "fast-string-width": "^3.0.2", + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, "node_modules/@emnapi/runtime": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz", - "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.0.tgz", + "integrity": "sha512-55coeOFKHv1ywEcUXJtWU5f+Jr/W5tZDvZig8DLKSwUN1JpROQ4rk/SNOQiFWmaR/VKF4zuFyW1B8JduOSv6Pg==", "license": "MIT", "optional": true, "dependencies": { @@ -167,9 +199,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", "cpu": [ "ppc64" ], @@ -183,9 +215,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", "cpu": [ "arm" ], @@ -199,9 +231,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", "cpu": [ "arm64" ], @@ -215,9 +247,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", "cpu": [ "x64" ], @@ -231,9 +263,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", "cpu": [ "arm64" ], @@ -247,9 +279,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", "cpu": [ "x64" ], @@ -263,9 +295,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", "cpu": [ "arm64" ], @@ -279,9 +311,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", "cpu": [ "x64" ], @@ -295,9 +327,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", "cpu": [ "arm" ], @@ -311,9 +343,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", "cpu": [ "arm64" ], @@ -327,9 +359,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", "cpu": [ "ia32" ], @@ -343,9 +375,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", "cpu": [ "loong64" ], @@ -359,9 +391,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", "cpu": [ "mips64el" ], @@ -375,9 +407,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", "cpu": [ "ppc64" ], @@ -391,9 +423,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", "cpu": [ "riscv64" ], @@ -407,9 +439,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", "cpu": [ "s390x" ], @@ -423,9 +455,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", "cpu": [ "x64" ], @@ -439,9 +471,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", "cpu": [ "arm64" ], @@ -455,9 +487,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", "cpu": [ "x64" ], @@ -471,9 +503,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", "cpu": [ "arm64" ], @@ -487,9 +519,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", "cpu": [ "x64" ], @@ -503,9 +535,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", "cpu": [ "arm64" ], @@ -519,9 +551,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", "cpu": [ "x64" ], @@ -535,9 +567,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", "cpu": [ "arm64" ], @@ -551,9 +583,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", "cpu": [ "ia32" ], @@ -567,9 +599,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", "cpu": [ "x64" ], @@ -583,9 +615,9 @@ } }, "node_modules/@img/colour": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.0.0.tgz", - "integrity": "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", "license": "MIT", "optional": true, "engines": { @@ -675,6 +707,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -691,6 +726,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -707,6 +745,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -723,6 +764,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -739,6 +783,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -755,6 +802,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -771,6 +821,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -787,6 +840,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -803,6 +859,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -825,6 +884,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -847,6 +909,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -869,6 +934,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -891,6 +959,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -913,6 +984,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -935,6 +1009,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -957,6 +1034,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1061,9 +1141,9 @@ "license": "MIT" }, "node_modules/@rollup/pluginutils": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", - "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", + "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", @@ -1082,16 +1162,10 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1102,9 +1176,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1115,9 +1189,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1128,9 +1202,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1141,9 +1215,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1154,9 +1228,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1167,12 +1241,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1180,12 +1257,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1193,12 +1273,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1206,12 +1289,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1219,12 +1305,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1232,12 +1321,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1245,12 +1337,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1258,12 +1353,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1271,12 +1369,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1284,12 +1385,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1297,12 +1401,15 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1310,12 +1417,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1323,12 +1433,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1336,9 +1449,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1349,9 +1462,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1362,9 +1475,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1375,9 +1488,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1388,9 +1501,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1401,9 +1514,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1414,64 +1527,97 @@ ] }, "node_modules/@shikijs/core": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", - "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.2.0.tgz", + "integrity": "sha512-Hc87Ab1Ld/vEbZRCbwx344I5v+4RU8CVToUTRkqXL1+TjbuOp9U5Xa0M23V4GEWHxVn+yO5otb+HkQVm3ptWQQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/primitive": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-javascript": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.23.0.tgz", - "integrity": "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.2.0.tgz", + "integrity": "sha512-fjETeq1k5ffyXqRgS6+3hpvqseLalp1kjNfRbXpUgWR8FpZ1CmQfiNHovc5lncYjt/Vg5JK/WJEmLahjwMa0og==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.4" + "oniguruma-to-es": "^4.3.6" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.23.0.tgz", - "integrity": "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.2.0.tgz", + "integrity": "sha512-hTorK1dffPkpbMUk6Z+828PgRo7d07HbnizoP0hNPFjhxMHctj0Px/qoHeGMYafc6ju+u9iMldN4JbVzNQM++g==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/langs": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.23.0.tgz", - "integrity": "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.2.0.tgz", + "integrity": "sha512-bwrVRlJ0wUhZxAbVdvBbv2TTC9yLsh4C/IO5Ofz0T8MQntgDvyVnkbjw9vi50r1kx7RCIJdnJnjZAwmAsXFLZQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.2.0.tgz", + "integrity": "sha512-NOq+DtUkVBJtZMVXL5A0vI0Xk8nvDYaXetFHSJFlOqjDZIVhIPRYFdGkSoElDqNuegikcc3A76SNUa8dTqtAYA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.2.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/themes": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.23.0.tgz", - "integrity": "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.2.0.tgz", + "integrity": "sha512-RX8IHYeLv8Cu2W6ruc3RxUqWn0IYCqSrMBzi/uRGAmfyDNOnNO5BF/Px7o97n4XTpmFTo5GbRaazuOWj+2ak2w==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", - "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.2.0.tgz", + "integrity": "sha512-VT/MKtlpOhEPZloSH3Pb9WCZEBDoQVMa9jedp5UAwmJOar1DVc9DRODAxmYPW9M93IK4ryuqRejFfmlvlVDemw==", "license": "MIT", "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/vscode-textmate": { @@ -1481,18 +1627,18 @@ "license": "MIT" }, "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", "license": "MIT", "dependencies": { "@types/ms": "*" } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, "node_modules/@types/hast": { @@ -1535,97 +1681,11 @@ "license": "MIT" }, "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz", + "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==", "license": "ISC" }, - "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "license": "ISC", - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-align/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1640,9 +1700,9 @@ } }, "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "license": "MIT", "engines": { "node": ">=8.6" @@ -1677,80 +1737,72 @@ } }, "node_modules/astro": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.18.0.tgz", - "integrity": "sha512-CHiohwJIS4L0G6/IzE1Fx3dgWqXBCXus/od0eGUfxrZJD2um2pE7ehclMmgL/fXqbU7NfE1Ze2pq34h2QaA6iQ==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/astro/-/astro-6.4.4.tgz", + "integrity": "sha512-hVe8tq3lqt/Dr0UyB//yUmQSlHMTU8scTiF/vQddQVahLE4TTaSdH5H0nb7OvRcwo0UmlAO8DWYar4jNaS7H+A==", "license": "MIT", "dependencies": { - "@astrojs/compiler": "^2.13.0", - "@astrojs/internal-helpers": "0.7.5", - "@astrojs/markdown-remark": "6.3.10", - "@astrojs/telemetry": "3.3.0", + "@astrojs/compiler": "^4.0.0", + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/markdown-remark": "7.2.0", + "@astrojs/telemetry": "3.3.2", "@capsizecss/unpack": "^4.0.0", + "@clack/prompts": "^1.1.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.3.0", - "acorn": "^8.15.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", - "boxen": "8.0.1", - "ci-info": "^4.3.1", + "ci-info": "^4.4.0", "clsx": "^2.1.1", - "common-ancestor-path": "^1.0.1", + "common-ancestor-path": "^2.0.0", "cookie": "^1.1.1", - "cssesc": "^3.0.0", - "debug": "^4.4.3", - "deterministic-object-hash": "^2.0.2", - "devalue": "^5.6.2", + "devalue": "^5.8.1", "diff": "^8.0.3", - "dlv": "^1.1.3", "dset": "^3.1.4", - "es-module-lexer": "^1.7.0", + "es-module-lexer": "^2.0.0", "esbuild": "^0.27.3", - "estree-walker": "^3.0.3", "flattie": "^1.1.1", - "fontace": "~0.4.0", + "fontace": "~0.4.1", + "get-tsconfig": "5.0.0-beta.4", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", - "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", + "jsonc-parser": "^3.3.1", "magic-string": "^0.30.21", - "magicast": "^0.5.1", + "magicast": "^0.5.2", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", - "p-limit": "^6.2.0", - "p-queue": "^8.1.1", + "obug": "^2.1.1", + "p-limit": "^7.3.0", + "p-queue": "^9.1.0", "package-manager-detector": "^1.6.0", "piccolore": "^0.1.3", - "picomatch": "^4.0.3", - "prompts": "^2.4.2", + "picomatch": "^4.0.4", "rehype": "^13.0.2", - "semver": "^7.7.3", - "shiki": "^3.21.0", + "semver": "^7.7.4", + "shiki": "^4.0.2", "smol-toml": "^1.6.0", - "svgo": "^4.0.0", - "tinyexec": "^1.0.2", + "svgo": "^4.0.1", + "tinyclip": "^0.1.12", + "tinyexec": "^1.0.4", "tinyglobby": "^0.2.15", - "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", - "unifont": "~0.7.3", - "unist-util-visit": "^5.0.0", - "unstorage": "^1.17.4", + "unifont": "~0.7.4", + "unist-util-visit": "^5.1.0", + "unstorage": "^1.17.5", "vfile": "^6.0.3", - "vite": "^6.4.1", - "vitefu": "^1.1.1", + "vite": "^7.3.2", + "vitefu": "^1.1.2", "xxhash-wasm": "^1.1.0", - "yargs-parser": "^21.1.1", - "yocto-spinner": "^0.2.3", - "zod": "^3.25.76", - "zod-to-json-schema": "^3.25.1", - "zod-to-ts": "^1.2.0" + "yargs-parser": "^22.0.0", + "zod": "^4.3.6" }, "bin": { - "astro": "astro.js" + "astro": "bin/astro.mjs" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0", + "node": ">=22.12.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0" }, @@ -1762,463 +1814,6 @@ "sharp": "^0.34.0" } }, - "node_modules/astro/node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/win32-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/esbuild": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", - "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.3", - "@esbuild/android-arm": "0.27.3", - "@esbuild/android-arm64": "0.27.3", - "@esbuild/android-x64": "0.27.3", - "@esbuild/darwin-arm64": "0.27.3", - "@esbuild/darwin-x64": "0.27.3", - "@esbuild/freebsd-arm64": "0.27.3", - "@esbuild/freebsd-x64": "0.27.3", - "@esbuild/linux-arm": "0.27.3", - "@esbuild/linux-arm64": "0.27.3", - "@esbuild/linux-ia32": "0.27.3", - "@esbuild/linux-loong64": "0.27.3", - "@esbuild/linux-mips64el": "0.27.3", - "@esbuild/linux-ppc64": "0.27.3", - "@esbuild/linux-riscv64": "0.27.3", - "@esbuild/linux-s390x": "0.27.3", - "@esbuild/linux-x64": "0.27.3", - "@esbuild/netbsd-arm64": "0.27.3", - "@esbuild/netbsd-x64": "0.27.3", - "@esbuild/openbsd-arm64": "0.27.3", - "@esbuild/openbsd-x64": "0.27.3", - "@esbuild/openharmony-arm64": "0.27.3", - "@esbuild/sunos-x64": "0.27.3", - "@esbuild/win32-arm64": "0.27.3", - "@esbuild/win32-ia32": "0.27.3", - "@esbuild/win32-x64": "0.27.3" - } - }, "node_modules/axobject-query": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", @@ -2238,52 +1833,12 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/base-64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", - "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT" - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, - "node_modules/boxen": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", - "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", - "license": "MIT", - "dependencies": { - "ansi-align": "^3.0.1", - "camelcase": "^8.0.0", - "chalk": "^5.3.0", - "cli-boxes": "^3.0.0", - "string-width": "^7.2.0", - "type-fest": "^4.21.0", - "widest-line": "^5.0.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", - "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -2294,18 +1849,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/character-entities": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", @@ -2352,9 +1895,9 @@ } }, "node_modules/ci-info": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.1.tgz", - "integrity": "sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", + "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==", "funding": [ { "type": "github", @@ -2366,18 +1909,6 @@ "node": ">=8" } }, - "node_modules/cli-boxes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", - "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -2407,10 +1938,13 @@ } }, "node_modules/common-ancestor-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", - "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", - "license": "ISC" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", + "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">= 18" + } }, "node_modules/cookie": { "version": "1.1.1", @@ -2426,9 +1960,9 @@ } }, "node_modules/cookie-es": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", - "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz", + "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==", "license": "MIT" }, "node_modules/crossws": { @@ -2457,13 +1991,13 @@ } }, "node_modules/css-tree": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.1.0.tgz", - "integrity": "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", "license": "MIT", "dependencies": { - "mdn-data": "2.12.2", - "source-map-js": "^1.0.1" + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" @@ -2481,18 +2015,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csso": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", @@ -2544,9 +2066,9 @@ } }, "node_modules/decode-named-character-reference": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz", - "integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", "license": "MIT", "dependencies": { "character-entities": "^2.0.0" @@ -2557,9 +2079,9 @@ } }, "node_modules/defu": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", - "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", "license": "MIT" }, "node_modules/depd": { @@ -2596,22 +2118,10 @@ "node": ">=8" } }, - "node_modules/deterministic-object-hash": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", - "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", - "license": "MIT", - "dependencies": { - "base-64": "^1.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", + "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", "license": "MIT" }, "node_modules/devlop": { @@ -2628,20 +2138,14 @@ } }, "node_modules/diff": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", - "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, - "node_modules/dlv": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "license": "MIT" - }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -2724,12 +2228,6 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, - "node_modules/emoji-regex": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "license": "MIT" - }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -2752,15 +2250,15 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "license": "MIT" }, "node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -2770,32 +2268,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" } }, "node_modules/escape-html": { @@ -2817,13 +2315,10 @@ } }, "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", @@ -2835,9 +2330,9 @@ } }, "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", "license": "MIT" }, "node_modules/extend": { @@ -2846,6 +2341,30 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", + "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2916,16 +2435,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-east-asian-width": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", - "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "node_modules/get-tsconfig": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", + "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, "engines": { - "node": ">=18" + "node": ">=20.20.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, "node_modules/github-slugger": { @@ -2935,14 +2457,14 @@ "license": "ISC" }, "node_modules/h3": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.6.tgz", - "integrity": "sha512-oi15ESLW5LRthZ+qPCi5GNasY/gvynSKUQxgiovrY63bPAtG59wtM+LSrlcwvOHAXzGrXVLnI97brbkdPF9WoQ==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz", + "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==", "license": "MIT", "dependencies": { - "cookie-es": "^1.2.2", + "cookie-es": "^1.2.3", "crossws": "^0.3.5", - "defu": "^6.1.4", + "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", @@ -3170,16 +2692,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/import-meta-resolve": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", - "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -3196,29 +2708,20 @@ } }, "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz", + "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==", "license": "MIT", "bin": { "is-docker": "cli.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -3237,6 +2740,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -3250,9 +2768,9 @@ } }, "node_modules/is-wsl": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", - "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz", + "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==", "license": "MIT", "dependencies": { "is-inside-container": "^1.0.0" @@ -3265,9 +2783,19 @@ } }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -3276,14 +2804,11 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "license": "MIT", - "engines": { - "node": ">=6" - } + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "license": "MIT" }, "node_modules/longest-streak": { "version": "3.1.0", @@ -3296,9 +2821,9 @@ } }, "node_modules/lru-cache": { - "version": "11.2.6", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", - "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -3314,13 +2839,13 @@ } }, "node_modules/magicast": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.1.tgz", - "integrity": "sha512-xrHS24IxaLrvuo613F719wvOIv9xPHFWQHuvGUBmPnCA/3MQxKI3b+r7n1jAoDHmsbC5bRhTZYR77invLAxVnw==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", + "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.28.5", - "@babel/types": "^7.28.5", + "@babel/parser": "^7.29.3", + "@babel/types": "^7.29.0", "source-map-js": "^1.2.1" } }, @@ -3366,9 +2891,9 @@ } }, "node_modules/mdast-util-from-markdown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", - "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.3.tgz", + "integrity": "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==", "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", @@ -3560,9 +3085,9 @@ } }, "node_modules/mdn-data": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.12.2.tgz", - "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==", + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", "license": "CC0-1.0" }, "node_modules/micromark": { @@ -4169,9 +3694,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "funding": [ { "type": "github", @@ -4241,6 +3766,19 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/obug": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.2.tgz", + "integrity": "sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/ofetch": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz", @@ -4271,60 +3809,60 @@ } }, "node_modules/oniguruma-parser": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", - "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", + "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", "license": "MIT" }, "node_modules/oniguruma-to-es": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.4.tgz", - "integrity": "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", + "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", "license": "MIT", "dependencies": { - "oniguruma-parser": "^0.12.1", - "regex": "^6.0.1", + "oniguruma-parser": "^0.12.2", + "regex": "^6.1.0", "regex-recursion": "^6.0.2" } }, "node_modules/p-limit": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", - "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz", + "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==", "license": "MIT", "dependencies": { - "yocto-queue": "^1.1.1" + "yocto-queue": "^1.2.1" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-queue": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", - "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz", + "integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==", "license": "MIT", "dependencies": { - "eventemitter3": "^5.0.1", - "p-timeout": "^6.1.2" + "eventemitter3": "^5.0.4", + "p-timeout": "^7.0.0" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-timeout": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", - "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz", + "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==", "license": "MIT", "engines": { - "node": ">=14.16" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4379,9 +3917,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { "node": ">=12" @@ -4391,9 +3929,9 @@ } }, "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "funding": [ { "type": "opencollective", @@ -4410,7 +3948,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -4427,23 +3965,10 @@ "node": ">=6" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", "license": "MIT", "funding": { "type": "github", @@ -4644,6 +4169,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/retext": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", @@ -4706,12 +4240,12 @@ } }, "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -4721,47 +4255,47 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, "node_modules/sax": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.5.0.tgz", - "integrity": "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", + "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" } }, "node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.3.tgz", + "integrity": "sha512-wnilbGyMxzbY7dNOl7jpKbLSjcfeweJWU5j4+u5qW+6/wuGD9KzIGOyZnQVSBM9E7DtWaaH3CyHkppYrKYoxwg==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4854,19 +4388,22 @@ } }, "node_modules/shiki": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.23.0.tgz", - "integrity": "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.2.0.tgz", + "integrity": "sha512-hjNax6o/ylDy9lefQEaSDtzaT3iVNtZ3WmpQnbuQNoG4xvnSKf2kSKbihZVO4JRG1TTMejs7CmNRYlWgAL66pQ==", "license": "MIT", "dependencies": { - "@shikijs/core": "3.23.0", - "@shikijs/engine-javascript": "3.23.0", - "@shikijs/engine-oniguruma": "3.23.0", - "@shikijs/langs": "3.23.0", - "@shikijs/themes": "3.23.0", - "@shikijs/types": "3.23.0", + "@shikijs/core": "4.2.0", + "@shikijs/engine-javascript": "4.2.0", + "@shikijs/engine-oniguruma": "4.2.0", + "@shikijs/langs": "4.2.0", + "@shikijs/themes": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/sisteransi": { @@ -4876,9 +4413,9 @@ "license": "MIT" }, "node_modules/smol-toml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.0.tgz", - "integrity": "sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz", + "integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==", "license": "BSD-3-Clause", "engines": { "node": ">= 18" @@ -4915,23 +4452,6 @@ "node": ">= 0.8" } }, - "node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stringify-entities": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", @@ -4946,21 +4466,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", @@ -4992,23 +4497,32 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "license": "MIT" }, + "node_modules/tinyclip": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.14.tgz", + "integrity": "sha512-F1oWdz8tjT17qe1d5JgDK6z03WGOhYYAN0lK3/D/fzNiy93xswLLEw7pk+3g05onhAy6Bsc6PLNUGhdgVjemMQ==", + "license": "MIT", + "engines": { + "node": "^16.14.0 || >= 17.3.0" + } + }, "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -5046,26 +4560,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tsconfck": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", - "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", - "license": "MIT", - "bin": { - "tsconfck": "bin/tsconfck.js" - }, - "engines": { - "node": "^18 || >=20" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -5073,36 +4567,10 @@ "license": "0BSD", "optional": true }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "license": "MIT" }, "node_modules/ultrahtml": { @@ -5229,9 +4697,9 @@ } }, "node_modules/unist-util-visit": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", - "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", + "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", @@ -5271,16 +4739,16 @@ } }, "node_modules/unstorage": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.4.tgz", - "integrity": "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", + "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", "license": "MIT", "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", - "h3": "^1.15.5", - "lru-cache": "^11.2.0", + "h3": "^1.15.10", + "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" @@ -5409,23 +4877,23 @@ } }, "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -5434,14 +4902,14 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", - "less": "*", + "less": "^4.0.0", "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" @@ -5483,9 +4951,9 @@ } }, "node_modules/vitefu": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.1.tgz", - "integrity": "sha512-B/Fegf3i8zh0yFbpzZ21amWzHmuNlLlmJT6n7bu5e+pCHUKQIfXSYokrqOBGEMMe9UG2sostKQF9mml/vYaWJQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", "license": "MIT", "workspaces": [ "tests/deps/*", @@ -5493,7 +4961,7 @@ "tests/projects/workspace/packages/*" ], "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0-beta.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "vite": { @@ -5520,38 +4988,6 @@ "node": ">=4" } }, - "node_modules/widest-line": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", - "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", - "license": "MIT", - "dependencies": { - "string-width": "^7.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", - "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/xxhash-wasm": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", @@ -5559,12 +4995,12 @@ "license": "MIT" }, "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "license": "ISC", "engines": { - "node": ">=12" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/yocto-queue": { @@ -5579,60 +5015,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yocto-spinner": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.3.tgz", - "integrity": "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ==", - "license": "MIT", - "dependencies": { - "yoctocolors": "^2.1.1" - }, - "engines": { - "node": ">=18.19" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yoctocolors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz", - "integrity": "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, - "node_modules/zod-to-json-schema": { - "version": "3.25.1", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", - "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", - "license": "ISC", - "peerDependencies": { - "zod": "^3.25 || ^4" - } - }, - "node_modules/zod-to-ts": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", - "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", - "peerDependencies": { - "typescript": "^4.9.4 || ^5.0.2", - "zod": "^3" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/tests/resources/sites/astro-custom-start-command/package.json b/tests/resources/sites/astro-custom-start-command/package.json index bf2475ef57..6520326b72 100644 --- a/tests/resources/sites/astro-custom-start-command/package.json +++ b/tests/resources/sites/astro-custom-start-command/package.json @@ -9,8 +9,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^9.5.4", - "astro": "^5.2.5" + "@astrojs/node": "^10.1.3", + "astro": "^6.4.4" }, "devDependencies": { }, diff --git a/tests/resources/sites/astro-static/package-lock.json b/tests/resources/sites/astro-static/package-lock.json index b71881fc00..66a799852f 100644 --- a/tests/resources/sites/astro-static/package-lock.json +++ b/tests/resources/sites/astro-static/package-lock.json @@ -8,34 +8,42 @@ "name": "my-astro-app", "version": "0.0.1", "dependencies": { - "astro": "^5.2.5" + "astro": "^6.4.4" } }, "node_modules/@astrojs/compiler": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.13.1.tgz", - "integrity": "sha512-f3FN83d2G/v32ipNClRKgYv30onQlMZX1vCeZMjPsMMPl1mDpmbl0+N5BYo4S/ofzqJyS5hvwacEo0CCVDn/Qg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-4.0.0.tgz", + "integrity": "sha512-eouss7G8ygdZqHuke033VMcVw5HTZUu+PXd/h06DGDUg/jt5btPYPqh66ENWw/mU78rBrf/oeC4oqoBwMtDMNA==", "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.7.6.tgz", - "integrity": "sha512-GOle7smBWKfMSP8osUIGOlB5kaHdQLV3foCsf+5Q9Wsuu+C6Fs3Ez/ttXmhjZ1HkSgsogcM1RXSjjOVieHq16Q==", - "license": "MIT" - }, - "node_modules/@astrojs/markdown-remark": { - "version": "6.3.11", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.11.tgz", - "integrity": "sha512-hcaxX/5aC6lQgHeGh1i+aauvSwIT6cfyFjKWvExYSxUhZZBBdvCliOtu06gbQyhbe0pGJNoNmqNlQZ5zYUuIyQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.0.tgz", + "integrity": "sha512-Ry2R3VPeIN4uPCSA4xQc+e+vsJXkalKpEbDc07hV+a/o5Bs2N/s/uDcPJH/05L19DKh9tAy7e6JM3YZ6Cxfezw==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.6", - "@astrojs/prism": "3.3.0", + "@types/hast": "^3.0.4", + "@types/mdast": "^4.0.4", + "js-yaml": "^4.1.1", + "picomatch": "^4.0.4", + "retext-smartypants": "^6.2.0", + "shiki": "^4.0.2", + "smol-toml": "^1.6.0", + "unified": "^11.0.5" + } + }, + "node_modules/@astrojs/markdown-remark": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-7.2.0.tgz", + "integrity": "sha512-+YxmVQu1Bd+MFfSzjq1rOJvD9+nIOJzz5YIIhdIH01RrxRkKbyKoEgyIqP3yv51MhzMDgd79QaPv+kCVPT8vHw==", + "license": "MIT", + "dependencies": { + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", - "import-meta-resolve": "^4.2.0", - "js-yaml": "^4.1.1", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", @@ -43,39 +51,35 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", - "shiki": "^3.21.0", - "smol-toml": "^1.6.0", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", - "unist-util-visit": "^5.0.0", + "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "node_modules/@astrojs/prism": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.3.0.tgz", - "integrity": "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz", + "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==", "license": "MIT", "dependencies": { "prismjs": "^1.30.0" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": ">=22.12.0" } }, "node_modules/@astrojs/telemetry": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.0.tgz", - "integrity": "sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.2.tgz", + "integrity": "sha512-j8DNruA8ors99Al39RYZPJK4DC1bKkoNm93mAMuBhY9TCNC4R8n1q7ovFnJ5qhGh5Lsh7pa1gpQVpYpsJPeTHQ==", "license": "MIT", "dependencies": { - "ci-info": "^4.2.0", - "debug": "^4.4.0", - "dlv": "^1.1.3", + "ci-info": "^4.4.0", "dset": "^3.1.4", - "is-docker": "^3.0.0", - "is-wsl": "^3.1.0", + "is-docker": "^4.0.0", + "is-wsl": "^3.1.1", "which-pm-runs": "^1.1.0" }, "engines": { @@ -83,30 +87,30 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", - "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "license": "MIT", "dependencies": { - "@babel/types": "^7.29.0" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -116,13 +120,13 @@ } }, "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -140,10 +144,38 @@ "node": ">=18" } }, + "node_modules/@clack/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.4.1.tgz", + "integrity": "sha512-FILJa1gGKEFTGZAJE9RpVhrjKz3c3h4ar60dSv6cGuDqufQ84YEIS3GAGvZiN+H6yaLbbvTFNejjCC4tXpZEuw==", + "license": "MIT", + "dependencies": { + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, + "node_modules/@clack/prompts": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.5.1.tgz", + "integrity": "sha512-zccHj2z2oCCO4yrDiRSlFOxWerGqRiysP7a5jPK6uoI9URKAquwY42Dd/iUP8JWHxEzdRe4TlbvZCo8z1/mhrw==", + "license": "MIT", + "dependencies": { + "@clack/core": "1.4.1", + "fast-string-width": "^3.0.2", + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, "node_modules/@emnapi/runtime": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.0.tgz", - "integrity": "sha512-QN75eB0IH2ywSpRpNddCRfQIhmJYBCJ1x5Lb3IscKAL8bMnVAKnRg8dCoXbHzVLLH7P38N2Z3mtulB7W0J0FKw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.0.tgz", + "integrity": "sha512-55coeOFKHv1ywEcUXJtWU5f+Jr/W5tZDvZig8DLKSwUN1JpROQ4rk/SNOQiFWmaR/VKF4zuFyW1B8JduOSv6Pg==", "license": "MIT", "optional": true, "dependencies": { @@ -151,9 +183,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.4.tgz", - "integrity": "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", "cpu": [ "ppc64" ], @@ -167,9 +199,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.4.tgz", - "integrity": "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", "cpu": [ "arm" ], @@ -183,9 +215,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.4.tgz", - "integrity": "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", "cpu": [ "arm64" ], @@ -199,9 +231,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.4.tgz", - "integrity": "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", "cpu": [ "x64" ], @@ -215,9 +247,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.4.tgz", - "integrity": "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", "cpu": [ "arm64" ], @@ -231,9 +263,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.4.tgz", - "integrity": "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", "cpu": [ "x64" ], @@ -247,9 +279,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.4.tgz", - "integrity": "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", "cpu": [ "arm64" ], @@ -263,9 +295,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.4.tgz", - "integrity": "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", "cpu": [ "x64" ], @@ -279,9 +311,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.4.tgz", - "integrity": "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", "cpu": [ "arm" ], @@ -295,9 +327,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.4.tgz", - "integrity": "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", "cpu": [ "arm64" ], @@ -311,9 +343,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.4.tgz", - "integrity": "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", "cpu": [ "ia32" ], @@ -327,9 +359,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.4.tgz", - "integrity": "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", "cpu": [ "loong64" ], @@ -343,9 +375,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.4.tgz", - "integrity": "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", "cpu": [ "mips64el" ], @@ -359,9 +391,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.4.tgz", - "integrity": "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", "cpu": [ "ppc64" ], @@ -375,9 +407,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.4.tgz", - "integrity": "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", "cpu": [ "riscv64" ], @@ -391,9 +423,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.4.tgz", - "integrity": "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", "cpu": [ "s390x" ], @@ -407,9 +439,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.4.tgz", - "integrity": "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", "cpu": [ "x64" ], @@ -423,9 +455,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.4.tgz", - "integrity": "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", "cpu": [ "arm64" ], @@ -439,9 +471,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.4.tgz", - "integrity": "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", "cpu": [ "x64" ], @@ -455,9 +487,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.4.tgz", - "integrity": "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", "cpu": [ "arm64" ], @@ -471,9 +503,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.4.tgz", - "integrity": "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", "cpu": [ "x64" ], @@ -487,9 +519,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.4.tgz", - "integrity": "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", "cpu": [ "arm64" ], @@ -503,9 +535,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.4.tgz", - "integrity": "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", "cpu": [ "x64" ], @@ -519,9 +551,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.4.tgz", - "integrity": "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", "cpu": [ "arm64" ], @@ -535,9 +567,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.4.tgz", - "integrity": "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", "cpu": [ "ia32" ], @@ -551,9 +583,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.4.tgz", - "integrity": "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", "cpu": [ "x64" ], @@ -659,6 +691,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -675,6 +710,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -691,6 +729,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -707,6 +748,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -723,6 +767,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -739,6 +786,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -755,6 +805,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -771,6 +824,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -787,6 +843,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -809,6 +868,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -831,6 +893,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -853,6 +918,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -875,6 +943,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -897,6 +968,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -919,6 +993,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -941,6 +1018,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1045,9 +1125,9 @@ "license": "MIT" }, "node_modules/@rollup/pluginutils": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", - "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", + "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", @@ -1066,16 +1146,10 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1086,9 +1160,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1099,9 +1173,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1112,9 +1186,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1125,9 +1199,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1138,9 +1212,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1151,12 +1225,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1164,12 +1241,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1177,12 +1257,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1190,12 +1273,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1203,12 +1289,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1216,12 +1305,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1229,12 +1321,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1242,12 +1337,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1255,12 +1353,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1268,12 +1369,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1281,12 +1385,15 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1294,12 +1401,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1307,12 +1417,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1320,9 +1433,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1333,9 +1446,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1346,9 +1459,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1359,9 +1472,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1372,9 +1485,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1385,9 +1498,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1398,64 +1511,97 @@ ] }, "node_modules/@shikijs/core": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", - "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.2.0.tgz", + "integrity": "sha512-Hc87Ab1Ld/vEbZRCbwx344I5v+4RU8CVToUTRkqXL1+TjbuOp9U5Xa0M23V4GEWHxVn+yO5otb+HkQVm3ptWQQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/primitive": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-javascript": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.23.0.tgz", - "integrity": "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.2.0.tgz", + "integrity": "sha512-fjETeq1k5ffyXqRgS6+3hpvqseLalp1kjNfRbXpUgWR8FpZ1CmQfiNHovc5lncYjt/Vg5JK/WJEmLahjwMa0og==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.4" + "oniguruma-to-es": "^4.3.6" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.23.0.tgz", - "integrity": "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.2.0.tgz", + "integrity": "sha512-hTorK1dffPkpbMUk6Z+828PgRo7d07HbnizoP0hNPFjhxMHctj0Px/qoHeGMYafc6ju+u9iMldN4JbVzNQM++g==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/langs": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.23.0.tgz", - "integrity": "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.2.0.tgz", + "integrity": "sha512-bwrVRlJ0wUhZxAbVdvBbv2TTC9yLsh4C/IO5Ofz0T8MQntgDvyVnkbjw9vi50r1kx7RCIJdnJnjZAwmAsXFLZQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.2.0.tgz", + "integrity": "sha512-NOq+DtUkVBJtZMVXL5A0vI0Xk8nvDYaXetFHSJFlOqjDZIVhIPRYFdGkSoElDqNuegikcc3A76SNUa8dTqtAYA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.2.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/themes": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.23.0.tgz", - "integrity": "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.2.0.tgz", + "integrity": "sha512-RX8IHYeLv8Cu2W6ruc3RxUqWn0IYCqSrMBzi/uRGAmfyDNOnNO5BF/Px7o97n4XTpmFTo5GbRaazuOWj+2ak2w==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", - "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.2.0.tgz", + "integrity": "sha512-VT/MKtlpOhEPZloSH3Pb9WCZEBDoQVMa9jedp5UAwmJOar1DVc9DRODAxmYPW9M93IK4ryuqRejFfmlvlVDemw==", "license": "MIT", "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/vscode-textmate": { @@ -1465,18 +1611,18 @@ "license": "MIT" }, "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", "license": "MIT", "dependencies": { "@types/ms": "*" } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, "node_modules/@types/hast": { @@ -1519,97 +1665,11 @@ "license": "MIT" }, "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz", + "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==", "license": "ISC" }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "license": "ISC", - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-align/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1624,9 +1684,9 @@ } }, "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "license": "MIT", "engines": { "node": ">=8.6" @@ -1661,80 +1721,72 @@ } }, "node_modules/astro": { - "version": "5.18.1", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.18.1.tgz", - "integrity": "sha512-m4VWilWZ+Xt6NPoYzC4CgGZim/zQUO7WFL0RHCH0AiEavF1153iC3+me2atDvXpf/yX4PyGUeD8wZLq1cirT3g==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/astro/-/astro-6.4.4.tgz", + "integrity": "sha512-hVe8tq3lqt/Dr0UyB//yUmQSlHMTU8scTiF/vQddQVahLE4TTaSdH5H0nb7OvRcwo0UmlAO8DWYar4jNaS7H+A==", "license": "MIT", "dependencies": { - "@astrojs/compiler": "^2.13.0", - "@astrojs/internal-helpers": "0.7.6", - "@astrojs/markdown-remark": "6.3.11", - "@astrojs/telemetry": "3.3.0", + "@astrojs/compiler": "^4.0.0", + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/markdown-remark": "7.2.0", + "@astrojs/telemetry": "3.3.2", "@capsizecss/unpack": "^4.0.0", + "@clack/prompts": "^1.1.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.3.0", - "acorn": "^8.15.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", - "boxen": "8.0.1", - "ci-info": "^4.3.1", + "ci-info": "^4.4.0", "clsx": "^2.1.1", - "common-ancestor-path": "^1.0.1", + "common-ancestor-path": "^2.0.0", "cookie": "^1.1.1", - "cssesc": "^3.0.0", - "debug": "^4.4.3", - "deterministic-object-hash": "^2.0.2", - "devalue": "^5.6.2", + "devalue": "^5.8.1", "diff": "^8.0.3", - "dlv": "^1.1.3", "dset": "^3.1.4", - "es-module-lexer": "^1.7.0", + "es-module-lexer": "^2.0.0", "esbuild": "^0.27.3", - "estree-walker": "^3.0.3", "flattie": "^1.1.1", - "fontace": "~0.4.0", + "fontace": "~0.4.1", + "get-tsconfig": "5.0.0-beta.4", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", - "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", + "jsonc-parser": "^3.3.1", "magic-string": "^0.30.21", - "magicast": "^0.5.1", + "magicast": "^0.5.2", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", - "p-limit": "^6.2.0", - "p-queue": "^8.1.1", + "obug": "^2.1.1", + "p-limit": "^7.3.0", + "p-queue": "^9.1.0", "package-manager-detector": "^1.6.0", "piccolore": "^0.1.3", - "picomatch": "^4.0.3", - "prompts": "^2.4.2", + "picomatch": "^4.0.4", "rehype": "^13.0.2", - "semver": "^7.7.3", - "shiki": "^3.21.0", + "semver": "^7.7.4", + "shiki": "^4.0.2", "smol-toml": "^1.6.0", - "svgo": "^4.0.0", - "tinyexec": "^1.0.2", + "svgo": "^4.0.1", + "tinyclip": "^0.1.12", + "tinyexec": "^1.0.4", "tinyglobby": "^0.2.15", - "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", - "unifont": "~0.7.3", - "unist-util-visit": "^5.0.0", - "unstorage": "^1.17.4", + "unifont": "~0.7.4", + "unist-util-visit": "^5.1.0", + "unstorage": "^1.17.5", "vfile": "^6.0.3", - "vite": "^6.4.1", - "vitefu": "^1.1.1", + "vite": "^7.3.2", + "vitefu": "^1.1.2", "xxhash-wasm": "^1.1.0", - "yargs-parser": "^21.1.1", - "yocto-spinner": "^0.2.3", - "zod": "^3.25.76", - "zod-to-json-schema": "^3.25.1", - "zod-to-ts": "^1.2.0" + "yargs-parser": "^22.0.0", + "zod": "^4.3.6" }, "bin": { - "astro": "astro.js" + "astro": "bin/astro.mjs" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0", + "node": ">=22.12.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0" }, @@ -1765,52 +1817,12 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/base-64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", - "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT" - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, - "node_modules/boxen": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", - "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", - "license": "MIT", - "dependencies": { - "ansi-align": "^3.0.1", - "camelcase": "^8.0.0", - "chalk": "^5.3.0", - "cli-boxes": "^3.0.0", - "string-width": "^7.2.0", - "type-fest": "^4.21.0", - "widest-line": "^5.0.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", - "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -1821,18 +1833,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/character-entities": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", @@ -1893,18 +1893,6 @@ "node": ">=8" } }, - "node_modules/cli-boxes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", - "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -1934,10 +1922,13 @@ } }, "node_modules/common-ancestor-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", - "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", - "license": "ISC" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", + "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">= 18" + } }, "node_modules/cookie": { "version": "1.1.1", @@ -1953,9 +1944,9 @@ } }, "node_modules/cookie-es": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", - "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz", + "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==", "license": "MIT" }, "node_modules/crossws": { @@ -2008,18 +1999,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csso": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", @@ -2084,9 +2063,9 @@ } }, "node_modules/defu": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", - "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", "license": "MIT" }, "node_modules/dequal": { @@ -2114,22 +2093,10 @@ "node": ">=8" } }, - "node_modules/deterministic-object-hash": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", - "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", - "license": "MIT", - "dependencies": { - "base-64": "^1.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", + "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", "license": "MIT" }, "node_modules/devlop": { @@ -2146,20 +2113,14 @@ } }, "node_modules/diff": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", - "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, - "node_modules/dlv": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "license": "MIT" - }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -2236,12 +2197,6 @@ "node": ">=4" } }, - "node_modules/emoji-regex": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "license": "MIT" - }, "node_modules/entities": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", @@ -2255,15 +2210,15 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "license": "MIT" }, "node_modules/esbuild": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.4.tgz", - "integrity": "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -2273,32 +2228,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.4", - "@esbuild/android-arm": "0.27.4", - "@esbuild/android-arm64": "0.27.4", - "@esbuild/android-x64": "0.27.4", - "@esbuild/darwin-arm64": "0.27.4", - "@esbuild/darwin-x64": "0.27.4", - "@esbuild/freebsd-arm64": "0.27.4", - "@esbuild/freebsd-x64": "0.27.4", - "@esbuild/linux-arm": "0.27.4", - "@esbuild/linux-arm64": "0.27.4", - "@esbuild/linux-ia32": "0.27.4", - "@esbuild/linux-loong64": "0.27.4", - "@esbuild/linux-mips64el": "0.27.4", - "@esbuild/linux-ppc64": "0.27.4", - "@esbuild/linux-riscv64": "0.27.4", - "@esbuild/linux-s390x": "0.27.4", - "@esbuild/linux-x64": "0.27.4", - "@esbuild/netbsd-arm64": "0.27.4", - "@esbuild/netbsd-x64": "0.27.4", - "@esbuild/openbsd-arm64": "0.27.4", - "@esbuild/openbsd-x64": "0.27.4", - "@esbuild/openharmony-arm64": "0.27.4", - "@esbuild/sunos-x64": "0.27.4", - "@esbuild/win32-arm64": "0.27.4", - "@esbuild/win32-ia32": "0.27.4", - "@esbuild/win32-x64": "0.27.4" + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" } }, "node_modules/escape-string-regexp": { @@ -2314,13 +2269,10 @@ } }, "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" }, "node_modules/eventemitter3": { "version": "5.0.4", @@ -2334,6 +2286,30 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", + "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2395,16 +2371,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-east-asian-width": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.5.0.tgz", - "integrity": "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==", + "node_modules/get-tsconfig": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", + "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, "engines": { - "node": ">=18" + "node": ">=20.20.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, "node_modules/github-slugger": { @@ -2414,14 +2393,14 @@ "license": "ISC" }, "node_modules/h3": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.6.tgz", - "integrity": "sha512-oi15ESLW5LRthZ+qPCi5GNasY/gvynSKUQxgiovrY63bPAtG59wtM+LSrlcwvOHAXzGrXVLnI97brbkdPF9WoQ==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz", + "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==", "license": "MIT", "dependencies": { - "cookie-es": "^1.2.2", + "cookie-es": "^1.2.3", "crossws": "^0.3.5", - "defu": "^6.1.4", + "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", @@ -2629,16 +2608,6 @@ "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", "license": "BSD-2-Clause" }, - "node_modules/import-meta-resolve": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", - "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/iron-webcrypto": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz", @@ -2649,29 +2618,20 @@ } }, "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz", + "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==", "license": "MIT", "bin": { "is-docker": "cli.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -2690,6 +2650,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -2718,9 +2693,19 @@ } }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -2729,14 +2714,11 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "license": "MIT", - "engines": { - "node": ">=6" - } + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "license": "MIT" }, "node_modules/longest-streak": { "version": "3.1.0", @@ -2749,9 +2731,9 @@ } }, "node_modules/lru-cache": { - "version": "11.2.7", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.7.tgz", - "integrity": "sha512-aY/R+aEsRelme17KGQa/1ZSIpLpNYYrhcrepKTZgE+W3WM16YMCaPwOHLHsmopZHELU0Ojin1lPVxKR0MihncA==", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -2767,12 +2749,12 @@ } }, "node_modules/magicast": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.2.tgz", - "integrity": "sha512-E3ZJh4J3S9KfwdjZhe2afj6R9lGIN5Pher1pF39UGrXRqq/VDaGVIGN13BjHd2u8B61hArAGOnso7nBOouW3TQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", + "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.0", + "@babel/parser": "^7.29.3", "@babel/types": "^7.29.0", "source-map-js": "^1.2.1" } @@ -3597,9 +3579,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "funding": [ { "type": "github", @@ -3669,6 +3651,19 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/obug": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.2.tgz", + "integrity": "sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/ofetch": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz", @@ -3687,60 +3682,60 @@ "license": "MIT" }, "node_modules/oniguruma-parser": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", - "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", + "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", "license": "MIT" }, "node_modules/oniguruma-to-es": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.4.tgz", - "integrity": "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", + "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", "license": "MIT", "dependencies": { - "oniguruma-parser": "^0.12.1", - "regex": "^6.0.1", + "oniguruma-parser": "^0.12.2", + "regex": "^6.1.0", "regex-recursion": "^6.0.2" } }, "node_modules/p-limit": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", - "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz", + "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==", "license": "MIT", "dependencies": { - "yocto-queue": "^1.1.1" + "yocto-queue": "^1.2.1" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-queue": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", - "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz", + "integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==", "license": "MIT", "dependencies": { - "eventemitter3": "^5.0.1", - "p-timeout": "^6.1.2" + "eventemitter3": "^5.0.4", + "p-timeout": "^7.0.0" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-timeout": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", - "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz", + "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==", "license": "MIT", "engines": { - "node": ">=14.16" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3795,9 +3790,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { "node": ">=12" @@ -3807,9 +3802,9 @@ } }, "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "funding": [ { "type": "opencollective", @@ -3826,7 +3821,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -3843,23 +3838,10 @@ "node": ">=6" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", "license": "MIT", "funding": { "type": "github", @@ -4051,6 +4033,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/retext": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", @@ -4113,12 +4104,12 @@ } }, "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -4128,47 +4119,47 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, "node_modules/sax": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.5.0.tgz", - "integrity": "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", + "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" } }, "node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.3.tgz", + "integrity": "sha512-wnilbGyMxzbY7dNOl7jpKbLSjcfeweJWU5j4+u5qW+6/wuGD9KzIGOyZnQVSBM9E7DtWaaH3CyHkppYrKYoxwg==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4223,19 +4214,22 @@ } }, "node_modules/shiki": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.23.0.tgz", - "integrity": "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.2.0.tgz", + "integrity": "sha512-hjNax6o/ylDy9lefQEaSDtzaT3iVNtZ3WmpQnbuQNoG4xvnSKf2kSKbihZVO4JRG1TTMejs7CmNRYlWgAL66pQ==", "license": "MIT", "dependencies": { - "@shikijs/core": "3.23.0", - "@shikijs/engine-javascript": "3.23.0", - "@shikijs/engine-oniguruma": "3.23.0", - "@shikijs/langs": "3.23.0", - "@shikijs/themes": "3.23.0", - "@shikijs/types": "3.23.0", + "@shikijs/core": "4.2.0", + "@shikijs/engine-javascript": "4.2.0", + "@shikijs/engine-oniguruma": "4.2.0", + "@shikijs/langs": "4.2.0", + "@shikijs/themes": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/sisteransi": { @@ -4245,9 +4239,9 @@ "license": "MIT" }, "node_modules/smol-toml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.0.tgz", - "integrity": "sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz", + "integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==", "license": "BSD-3-Clause", "engines": { "node": ">= 18" @@ -4275,23 +4269,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stringify-entities": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", @@ -4306,21 +4283,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/strip-ansi": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", - "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.2.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", @@ -4352,23 +4314,32 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "license": "MIT" }, + "node_modules/tinyclip": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.14.tgz", + "integrity": "sha512-F1oWdz8tjT17qe1d5JgDK6z03WGOhYYAN0lK3/D/fzNiy93xswLLEw7pk+3g05onhAy6Bsc6PLNUGhdgVjemMQ==", + "license": "MIT", + "engines": { + "node": "^16.14.0 || >= 17.3.0" + } + }, "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -4397,26 +4368,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tsconfck": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", - "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", - "license": "MIT", - "bin": { - "tsconfck": "bin/tsconfck.js" - }, - "engines": { - "node": "^18 || >=20" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -4424,36 +4375,10 @@ "license": "0BSD", "optional": true }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "license": "MIT" }, "node_modules/ultrahtml": { @@ -4622,16 +4547,16 @@ } }, "node_modules/unstorage": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.4.tgz", - "integrity": "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", + "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", "license": "MIT", "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", - "h3": "^1.15.5", - "lru-cache": "^11.2.0", + "h3": "^1.15.10", + "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" @@ -4760,23 +4685,23 @@ } }, "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -4785,14 +4710,14 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", - "less": "*", + "less": "^4.0.0", "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" @@ -4833,467 +4758,10 @@ } } }, - "node_modules/vite/node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" - } - }, "node_modules/vitefu": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.2.tgz", - "integrity": "sha512-zpKATdUbzbsycPFBN71nS2uzBUQiVnFoOrr2rvqv34S1lcAgMKKkjWleLGeiJlZ8lwCXvtWaRn7R3ZC16SYRuw==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", "license": "MIT", "workspaces": [ "tests/deps/*", @@ -5301,7 +4769,7 @@ "tests/projects/workspace/packages/*" ], "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-beta.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "vite": { @@ -5328,38 +4796,6 @@ "node": ">=4" } }, - "node_modules/widest-line": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", - "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", - "license": "MIT", - "dependencies": { - "string-width": "^7.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", - "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/xxhash-wasm": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", @@ -5367,12 +4803,12 @@ "license": "MIT" }, "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "license": "ISC", "engines": { - "node": ">=12" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/yocto-queue": { @@ -5387,60 +4823,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yocto-spinner": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.3.tgz", - "integrity": "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ==", - "license": "MIT", - "dependencies": { - "yoctocolors": "^2.1.1" - }, - "engines": { - "node": ">=18.19" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yoctocolors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz", - "integrity": "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, - "node_modules/zod-to-json-schema": { - "version": "3.25.1", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", - "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", - "license": "ISC", - "peerDependencies": { - "zod": "^3.25 || ^4" - } - }, - "node_modules/zod-to-ts": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", - "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", - "peerDependencies": { - "typescript": "^4.9.4 || ^5.0.2", - "zod": "^3" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/tests/resources/sites/astro-static/package.json b/tests/resources/sites/astro-static/package.json index 147dcf1f07..2b2932ec67 100644 --- a/tests/resources/sites/astro-static/package.json +++ b/tests/resources/sites/astro-static/package.json @@ -9,6 +9,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.2.5" + "astro": "^6.4.4" } } diff --git a/tests/resources/sites/astro/package-lock.json b/tests/resources/sites/astro/package-lock.json index becadd9b82..9fc14680a8 100644 --- a/tests/resources/sites/astro/package-lock.json +++ b/tests/resources/sites/astro/package-lock.json @@ -8,35 +8,43 @@ "name": "my-astro-app", "version": "0.0.1", "dependencies": { - "@astrojs/node": "^9.0.2", - "astro": "^5.2.5" + "@astrojs/node": "^10.1.3", + "astro": "^6.4.4" } }, "node_modules/@astrojs/compiler": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.13.1.tgz", - "integrity": "sha512-f3FN83d2G/v32ipNClRKgYv30onQlMZX1vCeZMjPsMMPl1mDpmbl0+N5BYo4S/ofzqJyS5hvwacEo0CCVDn/Qg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-4.0.0.tgz", + "integrity": "sha512-eouss7G8ygdZqHuke033VMcVw5HTZUu+PXd/h06DGDUg/jt5btPYPqh66ENWw/mU78rBrf/oeC4oqoBwMtDMNA==", "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.7.5.tgz", - "integrity": "sha512-vreGnYSSKhAjFJCWAwe/CNhONvoc5lokxtRoZims+0wa3KbHBdPHSSthJsKxPd8d/aic6lWKpRTYGY/hsgK6EA==", - "license": "MIT" - }, - "node_modules/@astrojs/markdown-remark": { - "version": "6.3.10", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.10.tgz", - "integrity": "sha512-kk4HeYR6AcnzC4QV8iSlOfh+N8TZ3MEStxPyenyCtemqn8IpEATBFMTJcfrNW32dgpt6MY3oCkMM/Tv3/I4G3A==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.0.tgz", + "integrity": "sha512-Ry2R3VPeIN4uPCSA4xQc+e+vsJXkalKpEbDc07hV+a/o5Bs2N/s/uDcPJH/05L19DKh9tAy7e6JM3YZ6Cxfezw==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.5", - "@astrojs/prism": "3.3.0", + "@types/hast": "^3.0.4", + "@types/mdast": "^4.0.4", + "js-yaml": "^4.1.1", + "picomatch": "^4.0.4", + "retext-smartypants": "^6.2.0", + "shiki": "^4.0.2", + "smol-toml": "^1.6.0", + "unified": "^11.0.5" + } + }, + "node_modules/@astrojs/markdown-remark": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-7.2.0.tgz", + "integrity": "sha512-+YxmVQu1Bd+MFfSzjq1rOJvD9+nIOJzz5YIIhdIH01RrxRkKbyKoEgyIqP3yv51MhzMDgd79QaPv+kCVPT8vHw==", + "license": "MIT", + "dependencies": { + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", - "import-meta-resolve": "^4.2.0", - "js-yaml": "^4.1.1", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", @@ -44,53 +52,49 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", - "shiki": "^3.19.0", - "smol-toml": "^1.5.2", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", - "unist-util-visit": "^5.0.0", + "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "node_modules/@astrojs/node": { - "version": "9.5.4", - "resolved": "https://registry.npmjs.org/@astrojs/node/-/node-9.5.4.tgz", - "integrity": "sha512-AbPSZsMGu8hXPR2XxV79RaKy8h6wijhtoqZGeUf4OXg2w1mxXlx4VnIc1D+QvtsgauSz7P5PLhmvf6w/J41GJg==", + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/@astrojs/node/-/node-10.1.3.tgz", + "integrity": "sha512-NybvdqXFwUbTkaJ8OhDmkrXK+cdpXR+KhyiaBduVVqzAopT70J9QVah8Iz2vt24+wF6PqH1oxElnQlU4OwcBLA==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.5", + "@astrojs/internal-helpers": "0.10.0", "send": "^1.2.1", "server-destroy": "^1.0.1" }, "peerDependencies": { - "astro": "^5.17.3" + "astro": "^6.3.0" } }, "node_modules/@astrojs/prism": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.3.0.tgz", - "integrity": "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz", + "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==", "license": "MIT", "dependencies": { "prismjs": "^1.30.0" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": ">=22.12.0" } }, "node_modules/@astrojs/telemetry": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.0.tgz", - "integrity": "sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.2.tgz", + "integrity": "sha512-j8DNruA8ors99Al39RYZPJK4DC1bKkoNm93mAMuBhY9TCNC4R8n1q7ovFnJ5qhGh5Lsh7pa1gpQVpYpsJPeTHQ==", "license": "MIT", "dependencies": { - "ci-info": "^4.2.0", - "debug": "^4.4.0", - "dlv": "^1.1.3", + "ci-info": "^4.4.0", "dset": "^3.1.4", - "is-docker": "^3.0.0", - "is-wsl": "^3.1.0", + "is-docker": "^4.0.0", + "is-wsl": "^3.1.1", "which-pm-runs": "^1.1.0" }, "engines": { @@ -98,30 +102,30 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", - "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "license": "MIT", "dependencies": { - "@babel/types": "^7.29.0" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -131,13 +135,13 @@ } }, "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -155,10 +159,38 @@ "node": ">=18" } }, + "node_modules/@clack/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.4.1.tgz", + "integrity": "sha512-FILJa1gGKEFTGZAJE9RpVhrjKz3c3h4ar60dSv6cGuDqufQ84YEIS3GAGvZiN+H6yaLbbvTFNejjCC4tXpZEuw==", + "license": "MIT", + "dependencies": { + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, + "node_modules/@clack/prompts": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.5.1.tgz", + "integrity": "sha512-zccHj2z2oCCO4yrDiRSlFOxWerGqRiysP7a5jPK6uoI9URKAquwY42Dd/iUP8JWHxEzdRe4TlbvZCo8z1/mhrw==", + "license": "MIT", + "dependencies": { + "@clack/core": "1.4.1", + "fast-string-width": "^3.0.2", + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, "node_modules/@emnapi/runtime": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz", - "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.0.tgz", + "integrity": "sha512-55coeOFKHv1ywEcUXJtWU5f+Jr/W5tZDvZig8DLKSwUN1JpROQ4rk/SNOQiFWmaR/VKF4zuFyW1B8JduOSv6Pg==", "license": "MIT", "optional": true, "dependencies": { @@ -166,9 +198,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", "cpu": [ "ppc64" ], @@ -182,9 +214,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", "cpu": [ "arm" ], @@ -198,9 +230,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", "cpu": [ "arm64" ], @@ -214,9 +246,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", "cpu": [ "x64" ], @@ -230,9 +262,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", "cpu": [ "arm64" ], @@ -246,9 +278,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", "cpu": [ "x64" ], @@ -262,9 +294,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", "cpu": [ "arm64" ], @@ -278,9 +310,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", "cpu": [ "x64" ], @@ -294,9 +326,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", "cpu": [ "arm" ], @@ -310,9 +342,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", "cpu": [ "arm64" ], @@ -326,9 +358,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", "cpu": [ "ia32" ], @@ -342,9 +374,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", "cpu": [ "loong64" ], @@ -358,9 +390,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", "cpu": [ "mips64el" ], @@ -374,9 +406,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", "cpu": [ "ppc64" ], @@ -390,9 +422,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", "cpu": [ "riscv64" ], @@ -406,9 +438,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", "cpu": [ "s390x" ], @@ -422,9 +454,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", "cpu": [ "x64" ], @@ -438,9 +470,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", "cpu": [ "arm64" ], @@ -454,9 +486,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", "cpu": [ "x64" ], @@ -470,9 +502,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", "cpu": [ "arm64" ], @@ -486,9 +518,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", "cpu": [ "x64" ], @@ -502,9 +534,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", "cpu": [ "arm64" ], @@ -518,9 +550,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", "cpu": [ "x64" ], @@ -534,9 +566,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", "cpu": [ "arm64" ], @@ -550,9 +582,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", "cpu": [ "ia32" ], @@ -566,9 +598,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", "cpu": [ "x64" ], @@ -674,6 +706,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -690,6 +725,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -706,6 +744,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -722,6 +763,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -738,6 +782,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -754,6 +801,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -770,6 +820,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -786,6 +839,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -802,6 +858,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -824,6 +883,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -846,6 +908,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -868,6 +933,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -890,6 +958,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -912,6 +983,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -934,6 +1008,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -956,6 +1033,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1060,9 +1140,9 @@ "license": "MIT" }, "node_modules/@rollup/pluginutils": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", - "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", + "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", @@ -1081,16 +1161,10 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1101,9 +1175,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1114,9 +1188,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1127,9 +1201,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1140,9 +1214,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1153,9 +1227,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1166,12 +1240,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1179,12 +1256,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1192,12 +1272,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1205,12 +1288,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1218,12 +1304,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1231,12 +1320,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1244,12 +1336,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1257,12 +1352,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1270,12 +1368,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1283,12 +1384,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1296,12 +1400,15 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1309,12 +1416,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1322,12 +1432,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1335,9 +1448,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1348,9 +1461,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1361,9 +1474,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1374,9 +1487,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1387,9 +1500,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1400,9 +1513,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1413,64 +1526,97 @@ ] }, "node_modules/@shikijs/core": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", - "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.2.0.tgz", + "integrity": "sha512-Hc87Ab1Ld/vEbZRCbwx344I5v+4RU8CVToUTRkqXL1+TjbuOp9U5Xa0M23V4GEWHxVn+yO5otb+HkQVm3ptWQQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/primitive": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-javascript": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.23.0.tgz", - "integrity": "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.2.0.tgz", + "integrity": "sha512-fjETeq1k5ffyXqRgS6+3hpvqseLalp1kjNfRbXpUgWR8FpZ1CmQfiNHovc5lncYjt/Vg5JK/WJEmLahjwMa0og==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.4" + "oniguruma-to-es": "^4.3.6" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.23.0.tgz", - "integrity": "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.2.0.tgz", + "integrity": "sha512-hTorK1dffPkpbMUk6Z+828PgRo7d07HbnizoP0hNPFjhxMHctj0Px/qoHeGMYafc6ju+u9iMldN4JbVzNQM++g==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/langs": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.23.0.tgz", - "integrity": "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.2.0.tgz", + "integrity": "sha512-bwrVRlJ0wUhZxAbVdvBbv2TTC9yLsh4C/IO5Ofz0T8MQntgDvyVnkbjw9vi50r1kx7RCIJdnJnjZAwmAsXFLZQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.2.0.tgz", + "integrity": "sha512-NOq+DtUkVBJtZMVXL5A0vI0Xk8nvDYaXetFHSJFlOqjDZIVhIPRYFdGkSoElDqNuegikcc3A76SNUa8dTqtAYA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.2.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/themes": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.23.0.tgz", - "integrity": "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.2.0.tgz", + "integrity": "sha512-RX8IHYeLv8Cu2W6ruc3RxUqWn0IYCqSrMBzi/uRGAmfyDNOnNO5BF/Px7o97n4XTpmFTo5GbRaazuOWj+2ak2w==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", - "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.2.0.tgz", + "integrity": "sha512-VT/MKtlpOhEPZloSH3Pb9WCZEBDoQVMa9jedp5UAwmJOar1DVc9DRODAxmYPW9M93IK4ryuqRejFfmlvlVDemw==", "license": "MIT", "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/vscode-textmate": { @@ -1480,18 +1626,18 @@ "license": "MIT" }, "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", "license": "MIT", "dependencies": { "@types/ms": "*" } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, "node_modules/@types/hast": { @@ -1534,97 +1680,11 @@ "license": "MIT" }, "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz", + "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==", "license": "ISC" }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "license": "ISC", - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-align/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1639,9 +1699,9 @@ } }, "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "license": "MIT", "engines": { "node": ">=8.6" @@ -1676,80 +1736,72 @@ } }, "node_modules/astro": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.18.0.tgz", - "integrity": "sha512-CHiohwJIS4L0G6/IzE1Fx3dgWqXBCXus/od0eGUfxrZJD2um2pE7ehclMmgL/fXqbU7NfE1Ze2pq34h2QaA6iQ==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/astro/-/astro-6.4.4.tgz", + "integrity": "sha512-hVe8tq3lqt/Dr0UyB//yUmQSlHMTU8scTiF/vQddQVahLE4TTaSdH5H0nb7OvRcwo0UmlAO8DWYar4jNaS7H+A==", "license": "MIT", "dependencies": { - "@astrojs/compiler": "^2.13.0", - "@astrojs/internal-helpers": "0.7.5", - "@astrojs/markdown-remark": "6.3.10", - "@astrojs/telemetry": "3.3.0", + "@astrojs/compiler": "^4.0.0", + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/markdown-remark": "7.2.0", + "@astrojs/telemetry": "3.3.2", "@capsizecss/unpack": "^4.0.0", + "@clack/prompts": "^1.1.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.3.0", - "acorn": "^8.15.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", - "boxen": "8.0.1", - "ci-info": "^4.3.1", + "ci-info": "^4.4.0", "clsx": "^2.1.1", - "common-ancestor-path": "^1.0.1", + "common-ancestor-path": "^2.0.0", "cookie": "^1.1.1", - "cssesc": "^3.0.0", - "debug": "^4.4.3", - "deterministic-object-hash": "^2.0.2", - "devalue": "^5.6.2", + "devalue": "^5.8.1", "diff": "^8.0.3", - "dlv": "^1.1.3", "dset": "^3.1.4", - "es-module-lexer": "^1.7.0", + "es-module-lexer": "^2.0.0", "esbuild": "^0.27.3", - "estree-walker": "^3.0.3", "flattie": "^1.1.1", - "fontace": "~0.4.0", + "fontace": "~0.4.1", + "get-tsconfig": "5.0.0-beta.4", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", - "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", + "jsonc-parser": "^3.3.1", "magic-string": "^0.30.21", - "magicast": "^0.5.1", + "magicast": "^0.5.2", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", - "p-limit": "^6.2.0", - "p-queue": "^8.1.1", + "obug": "^2.1.1", + "p-limit": "^7.3.0", + "p-queue": "^9.1.0", "package-manager-detector": "^1.6.0", "piccolore": "^0.1.3", - "picomatch": "^4.0.3", - "prompts": "^2.4.2", + "picomatch": "^4.0.4", "rehype": "^13.0.2", - "semver": "^7.7.3", - "shiki": "^3.21.0", + "semver": "^7.7.4", + "shiki": "^4.0.2", "smol-toml": "^1.6.0", - "svgo": "^4.0.0", - "tinyexec": "^1.0.2", + "svgo": "^4.0.1", + "tinyclip": "^0.1.12", + "tinyexec": "^1.0.4", "tinyglobby": "^0.2.15", - "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", - "unifont": "~0.7.3", - "unist-util-visit": "^5.0.0", - "unstorage": "^1.17.4", + "unifont": "~0.7.4", + "unist-util-visit": "^5.1.0", + "unstorage": "^1.17.5", "vfile": "^6.0.3", - "vite": "^6.4.1", - "vitefu": "^1.1.1", + "vite": "^7.3.2", + "vitefu": "^1.1.2", "xxhash-wasm": "^1.1.0", - "yargs-parser": "^21.1.1", - "yocto-spinner": "^0.2.3", - "zod": "^3.25.76", - "zod-to-json-schema": "^3.25.1", - "zod-to-ts": "^1.2.0" + "yargs-parser": "^22.0.0", + "zod": "^4.3.6" }, "bin": { - "astro": "astro.js" + "astro": "bin/astro.mjs" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0", + "node": ">=22.12.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0" }, @@ -1780,52 +1832,12 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/base-64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", - "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT" - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, - "node_modules/boxen": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", - "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", - "license": "MIT", - "dependencies": { - "ansi-align": "^3.0.1", - "camelcase": "^8.0.0", - "chalk": "^5.3.0", - "cli-boxes": "^3.0.0", - "string-width": "^7.2.0", - "type-fest": "^4.21.0", - "widest-line": "^5.0.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", - "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -1836,18 +1848,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/character-entities": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", @@ -1908,18 +1908,6 @@ "node": ">=8" } }, - "node_modules/cli-boxes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", - "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -1949,10 +1937,13 @@ } }, "node_modules/common-ancestor-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", - "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", - "license": "ISC" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", + "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">= 18" + } }, "node_modules/cookie": { "version": "1.1.1", @@ -1968,9 +1959,9 @@ } }, "node_modules/cookie-es": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", - "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz", + "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==", "license": "MIT" }, "node_modules/crossws": { @@ -2023,18 +2014,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csso": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", @@ -2099,9 +2078,9 @@ } }, "node_modules/defu": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", - "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", "license": "MIT" }, "node_modules/depd": { @@ -2138,22 +2117,10 @@ "node": ">=8" } }, - "node_modules/deterministic-object-hash": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", - "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", - "license": "MIT", - "dependencies": { - "base-64": "^1.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", + "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", "license": "MIT" }, "node_modules/devlop": { @@ -2170,20 +2137,14 @@ } }, "node_modules/diff": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", - "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, - "node_modules/dlv": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "license": "MIT" - }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -2266,12 +2227,6 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, - "node_modules/emoji-regex": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "license": "MIT" - }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -2294,15 +2249,15 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "license": "MIT" }, "node_modules/esbuild": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", - "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -2312,32 +2267,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.3", - "@esbuild/android-arm": "0.27.3", - "@esbuild/android-arm64": "0.27.3", - "@esbuild/android-x64": "0.27.3", - "@esbuild/darwin-arm64": "0.27.3", - "@esbuild/darwin-x64": "0.27.3", - "@esbuild/freebsd-arm64": "0.27.3", - "@esbuild/freebsd-x64": "0.27.3", - "@esbuild/linux-arm": "0.27.3", - "@esbuild/linux-arm64": "0.27.3", - "@esbuild/linux-ia32": "0.27.3", - "@esbuild/linux-loong64": "0.27.3", - "@esbuild/linux-mips64el": "0.27.3", - "@esbuild/linux-ppc64": "0.27.3", - "@esbuild/linux-riscv64": "0.27.3", - "@esbuild/linux-s390x": "0.27.3", - "@esbuild/linux-x64": "0.27.3", - "@esbuild/netbsd-arm64": "0.27.3", - "@esbuild/netbsd-x64": "0.27.3", - "@esbuild/openbsd-arm64": "0.27.3", - "@esbuild/openbsd-x64": "0.27.3", - "@esbuild/openharmony-arm64": "0.27.3", - "@esbuild/sunos-x64": "0.27.3", - "@esbuild/win32-arm64": "0.27.3", - "@esbuild/win32-ia32": "0.27.3", - "@esbuild/win32-x64": "0.27.3" + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" } }, "node_modules/escape-html": { @@ -2359,13 +2314,10 @@ } }, "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", @@ -2388,6 +2340,30 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", + "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2458,16 +2434,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-east-asian-width": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.5.0.tgz", - "integrity": "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==", + "node_modules/get-tsconfig": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", + "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, "engines": { - "node": ">=18" + "node": ">=20.20.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, "node_modules/github-slugger": { @@ -2477,14 +2456,14 @@ "license": "ISC" }, "node_modules/h3": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.6.tgz", - "integrity": "sha512-oi15ESLW5LRthZ+qPCi5GNasY/gvynSKUQxgiovrY63bPAtG59wtM+LSrlcwvOHAXzGrXVLnI97brbkdPF9WoQ==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz", + "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==", "license": "MIT", "dependencies": { - "cookie-es": "^1.2.2", + "cookie-es": "^1.2.3", "crossws": "^0.3.5", - "defu": "^6.1.4", + "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", @@ -2712,16 +2691,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/import-meta-resolve": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", - "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2738,29 +2707,20 @@ } }, "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz", + "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==", "license": "MIT", "bin": { "is-docker": "cli.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -2779,6 +2739,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -2807,9 +2782,19 @@ } }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -2818,14 +2803,11 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "license": "MIT", - "engines": { - "node": ">=6" - } + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "license": "MIT" }, "node_modules/longest-streak": { "version": "3.1.0", @@ -2838,9 +2820,9 @@ } }, "node_modules/lru-cache": { - "version": "11.2.6", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", - "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -2856,12 +2838,12 @@ } }, "node_modules/magicast": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.2.tgz", - "integrity": "sha512-E3ZJh4J3S9KfwdjZhe2afj6R9lGIN5Pher1pF39UGrXRqq/VDaGVIGN13BjHd2u8B61hArAGOnso7nBOouW3TQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", + "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.0", + "@babel/parser": "^7.29.3", "@babel/types": "^7.29.0", "source-map-js": "^1.2.1" } @@ -3711,9 +3693,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "funding": [ { "type": "github", @@ -3783,6 +3765,19 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/obug": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.2.tgz", + "integrity": "sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/ofetch": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz", @@ -3813,60 +3808,60 @@ } }, "node_modules/oniguruma-parser": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", - "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", + "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", "license": "MIT" }, "node_modules/oniguruma-to-es": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.4.tgz", - "integrity": "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", + "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", "license": "MIT", "dependencies": { - "oniguruma-parser": "^0.12.1", - "regex": "^6.0.1", + "oniguruma-parser": "^0.12.2", + "regex": "^6.1.0", "regex-recursion": "^6.0.2" } }, "node_modules/p-limit": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", - "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz", + "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==", "license": "MIT", "dependencies": { - "yocto-queue": "^1.1.1" + "yocto-queue": "^1.2.1" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-queue": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", - "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz", + "integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==", "license": "MIT", "dependencies": { - "eventemitter3": "^5.0.1", - "p-timeout": "^6.1.2" + "eventemitter3": "^5.0.4", + "p-timeout": "^7.0.0" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-timeout": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", - "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz", + "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==", "license": "MIT", "engines": { - "node": ">=14.16" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3921,9 +3916,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { "node": ">=12" @@ -3933,9 +3928,9 @@ } }, "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "funding": [ { "type": "opencollective", @@ -3952,7 +3947,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -3969,23 +3964,10 @@ "node": ">=6" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", "license": "MIT", "funding": { "type": "github", @@ -4186,6 +4168,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/retext": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", @@ -4248,12 +4239,12 @@ } }, "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -4263,47 +4254,47 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, "node_modules/sax": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.5.0.tgz", - "integrity": "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", + "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" } }, "node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.3.tgz", + "integrity": "sha512-wnilbGyMxzbY7dNOl7jpKbLSjcfeweJWU5j4+u5qW+6/wuGD9KzIGOyZnQVSBM9E7DtWaaH3CyHkppYrKYoxwg==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4396,19 +4387,22 @@ } }, "node_modules/shiki": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.23.0.tgz", - "integrity": "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.2.0.tgz", + "integrity": "sha512-hjNax6o/ylDy9lefQEaSDtzaT3iVNtZ3WmpQnbuQNoG4xvnSKf2kSKbihZVO4JRG1TTMejs7CmNRYlWgAL66pQ==", "license": "MIT", "dependencies": { - "@shikijs/core": "3.23.0", - "@shikijs/engine-javascript": "3.23.0", - "@shikijs/engine-oniguruma": "3.23.0", - "@shikijs/langs": "3.23.0", - "@shikijs/themes": "3.23.0", - "@shikijs/types": "3.23.0", + "@shikijs/core": "4.2.0", + "@shikijs/engine-javascript": "4.2.0", + "@shikijs/engine-oniguruma": "4.2.0", + "@shikijs/langs": "4.2.0", + "@shikijs/themes": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/sisteransi": { @@ -4418,9 +4412,9 @@ "license": "MIT" }, "node_modules/smol-toml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.0.tgz", - "integrity": "sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz", + "integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==", "license": "BSD-3-Clause", "engines": { "node": ">= 18" @@ -4457,23 +4451,6 @@ "node": ">= 0.8" } }, - "node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stringify-entities": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", @@ -4488,21 +4465,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/strip-ansi": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", - "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.2.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", @@ -4534,23 +4496,32 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "license": "MIT" }, + "node_modules/tinyclip": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.14.tgz", + "integrity": "sha512-F1oWdz8tjT17qe1d5JgDK6z03WGOhYYAN0lK3/D/fzNiy93xswLLEw7pk+3g05onhAy6Bsc6PLNUGhdgVjemMQ==", + "license": "MIT", + "engines": { + "node": "^16.14.0 || >= 17.3.0" + } + }, "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -4588,26 +4559,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tsconfck": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", - "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", - "license": "MIT", - "bin": { - "tsconfck": "bin/tsconfck.js" - }, - "engines": { - "node": "^18 || >=20" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -4615,36 +4566,10 @@ "license": "0BSD", "optional": true }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "license": "MIT" }, "node_modules/ultrahtml": { @@ -4813,16 +4738,16 @@ } }, "node_modules/unstorage": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.4.tgz", - "integrity": "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", + "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", "license": "MIT", "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", - "h3": "^1.15.5", - "lru-cache": "^11.2.0", + "h3": "^1.15.10", + "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" @@ -4951,23 +4876,23 @@ } }, "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -4976,14 +4901,14 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", - "less": "*", + "less": "^4.0.0", "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" @@ -5024,467 +4949,10 @@ } } }, - "node_modules/vite/node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" - } - }, "node_modules/vitefu": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.2.tgz", - "integrity": "sha512-zpKATdUbzbsycPFBN71nS2uzBUQiVnFoOrr2rvqv34S1lcAgMKKkjWleLGeiJlZ8lwCXvtWaRn7R3ZC16SYRuw==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", "license": "MIT", "workspaces": [ "tests/deps/*", @@ -5492,7 +4960,7 @@ "tests/projects/workspace/packages/*" ], "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-beta.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "vite": { @@ -5519,38 +4987,6 @@ "node": ">=4" } }, - "node_modules/widest-line": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", - "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", - "license": "MIT", - "dependencies": { - "string-width": "^7.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", - "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/xxhash-wasm": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", @@ -5558,12 +4994,12 @@ "license": "MIT" }, "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "license": "ISC", "engines": { - "node": ">=12" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/yocto-queue": { @@ -5578,60 +5014,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yocto-spinner": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.3.tgz", - "integrity": "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ==", - "license": "MIT", - "dependencies": { - "yoctocolors": "^2.1.1" - }, - "engines": { - "node": ">=18.19" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yoctocolors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz", - "integrity": "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, - "node_modules/zod-to-json-schema": { - "version": "3.25.1", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", - "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", - "license": "ISC", - "peerDependencies": { - "zod": "^3.25 || ^4" - } - }, - "node_modules/zod-to-ts": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", - "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", - "peerDependencies": { - "typescript": "^4.9.4 || ^5.0.2", - "zod": "^3" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/tests/resources/sites/astro/package.json b/tests/resources/sites/astro/package.json index 8cbcb910f5..2fa27562a6 100644 --- a/tests/resources/sites/astro/package.json +++ b/tests/resources/sites/astro/package.json @@ -9,7 +9,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^9.0.2", - "astro": "^5.2.5" + "@astrojs/node": "^10.1.3", + "astro": "^6.4.4" } } From 2759ba3fd30821dcd860094f8bf1a6a48586dd82 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 9 Jun 2026 19:20:19 +1200 Subject: [PATCH 075/151] fix: bump appwrite/base 1.4.2 to 1.4.3 to patch OS package CVEs appwrite/base:1.4.3 restores the `apk upgrade` step (appwrite/docker-base#73) that the #71 refactor had dropped, rebuilding the runtime image with patched Alpine packages. This clears the 315 Trivy OsPackageVulnerability alerts in the appwrite image (musl, openssl, zlib, libpng, libexpat, util-linux, imagemagick, rsync, py3-cryptography, ...). Verified appwrite/base:1.4.3 ships the fixed versions: musl 1.2.5-r23, openssl/libssl3/libcrypto3 3.5.6-r0, zlib 1.3.2-r0, libpng 1.6.58-r1, libexpat 2.7.5-r0, imagemagick 7.1.2.24-r0, rsync 3.4.3-r0, py3-cryptography 46.0.7-r0. Co-Authored-By: Claude Opus 4.8 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7e91ed6163..7ffd23f683 100755 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \ --no-plugins --no-scripts --prefer-dist \ `if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi` -FROM appwrite/base:1.4.2 AS base +FROM appwrite/base:1.4.3 AS base LABEL maintainer="team@appwrite.io" From 0a7dde99e23015b4faa48f37fd2c2478d1eba05b Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 9 Jun 2026 13:27:42 +0530 Subject: [PATCH 076/151] Fix project service config for PHP SDK services --- app/config/services.php | 98 ----------------------------------------- 1 file changed, 98 deletions(-) diff --git a/app/config/services.php b/app/config/services.php index f7d57bd63d..73acd50861 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -85,48 +85,6 @@ return [ 'icon' => '/images/services/databases.png', 'platforms' => ['client', 'server', 'console'], ], - 'documentsDB' => [ - 'key' => 'documentsDB', - 'name' => 'DocumentsDB', - 'subtitle' => 'The DocumentsDB service allows you to create structured collections of documents, query and filter lists of documents.', - 'description' => '/docs/services/databases.md', - 'controller' => '', // Uses modules - 'sdk' => true, - 'docs' => true, - 'docsUrl' => 'https://appwrite.io/docs/references/documentsdb', - 'tests' => false, - 'optional' => true, - 'icon' => '/images/services/databases.png', - 'platforms' => ['server', 'console'], - ], - 'tablesDB' => [ - 'key' => 'tablesDB', - 'name' => 'TablesDB', - 'subtitle' => 'The TablesDB service allows you to create structured tables of columns, query and filter lists of rows.', - 'description' => '/docs/services/tablesdb.md', - 'controller' => '', // Uses modules - 'sdk' => true, - 'docs' => true, - 'docsUrl' => 'https://appwrite.io/docs/references/tablesdb', - 'tests' => false, - 'optional' => true, - 'icon' => '/images/services/databases.png', - 'platforms' => ['server', 'console'], - ], - 'vectorsDB' => [ - 'key' => 'vectorsDB', - 'name' => 'VectorsDB', - 'subtitle' => 'The VectorsDB service allows you to create vector collections, embeddings, indexes, and documents.', - 'description' => '/docs/services/databases.md', - 'controller' => '', // Uses modules - 'sdk' => true, - 'docs' => true, - 'docsUrl' => 'https://appwrite.io/docs/references/vectorsdb', - 'tests' => false, - 'optional' => true, - 'icon' => '/images/services/databases.png', - 'platforms' => ['server', 'console'], - ], 'locale' => [ 'key' => 'locale', 'name' => 'Locale', @@ -239,48 +197,6 @@ return [ 'icon' => '', 'platforms' => ['client', 'server', 'console'], ], - 'webhooks' => [ - 'key' => 'webhooks', - 'name' => 'Webhooks', - 'subtitle' => 'The Webhooks service allows you to configure event-driven HTTP callbacks for your project.', - 'description' => '', - 'controller' => '', // Uses modules - 'sdk' => true, - 'docs' => true, - 'docsUrl' => '', - 'tests' => false, - 'optional' => true, - 'icon' => '', - 'platforms' => ['server', 'console'], - ], - 'tokens' => [ - 'key' => 'tokens', - 'name' => 'Tokens', - 'subtitle' => 'The Tokens service allows you to create and manage resource tokens for project resources.', - 'description' => '', - 'controller' => '', // Uses modules - 'sdk' => true, - 'docs' => true, - 'docsUrl' => '', - 'tests' => false, - 'optional' => true, - 'icon' => '', - 'platforms' => ['server', 'console'], - ], - 'presences' => [ - 'key' => 'presences', - 'name' => 'Presences', - 'subtitle' => 'The Presences service allows you to create, query, and manage realtime presence state.', - 'description' => '', - 'controller' => '', // Uses modules - 'sdk' => true, - 'docs' => true, - 'docsUrl' => 'https://appwrite.io/docs/references/presences', - 'tests' => false, - 'optional' => true, - 'icon' => '', - 'platforms' => ['client', 'server', 'console'], - ], 'sites' => [ 'key' => 'sites', 'name' => 'Sites', @@ -365,20 +281,6 @@ return [ 'icon' => '', 'platforms' => ['client', 'server', 'console'], ], - 'assistant' => [ - 'key' => 'assistant', - 'name' => 'Assistant', - 'subtitle' => 'The Assistant service allows Console users to ask assistant queries.', - 'description' => '', - 'controller' => '', // Uses modules - 'sdk' => true, - 'docs' => true, - 'docsUrl' => 'https://appwrite.io/docs/references/assistant', - 'tests' => false, - 'optional' => false, - 'icon' => '', - 'platforms' => ['console'], - ], 'organization' => [ 'key' => 'organization', 'name' => 'Organization', From c73f256bff1c69b24a572839c48fcdd24bdbe4fc Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 9 Jun 2026 14:43:39 +0530 Subject: [PATCH 077/151] Fix flaky site duplicate deployments (#12539) * Fix flaky site duplicate deployments * fix refactor * (fix): propagate ready status immediately and retry canceled build log write on conflict * (test): retry preview-domain serving assertions to absorb runtime cold-start * Update latest deployment in one write * Use transaction exceptions for deployment retries * Remove Mongo code check from build retry --- .../Platform/Modules/Compute/Base.php | 24 ----- .../Functions/Http/Deployments/Create.php | 12 --- .../Functions/Http/Deployments/Delete.php | 13 ++- .../Http/Deployments/Duplicate/Create.php | 12 --- .../Http/Deployments/Status/Update.php | 34 +++++-- .../Http/Deployments/Template/Create.php | 13 --- .../Functions/Http/Functions/Create.php | 13 --- .../Modules/Functions/Workers/Builds.php | 91 +++++++++++++------ .../Modules/Sites/Http/Deployments/Create.php | 24 ----- .../Modules/Sites/Http/Deployments/Delete.php | 13 ++- .../Http/Deployments/Duplicate/Create.php | 12 --- .../Sites/Http/Deployments/Status/Update.php | 34 +++++-- .../Http/Deployments/Template/Create.php | 12 --- .../Modules/VCS/Http/GitHub/Deployment.php | 12 --- .../Services/Sites/SitesCustomServerTest.php | 28 +++--- 15 files changed, 150 insertions(+), 197 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index b0efac3829..2dfbd3a6fb 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -139,18 +139,6 @@ class Base extends Action 'activate' => $activate, ])); - $function = $function - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $publisherForBuilds->enqueue(new BuildMessage( project: $project, resource: $function, @@ -253,18 +241,6 @@ class Base extends Action 'activate' => $activate, ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index 25863d424c..7094e912c5 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -303,12 +303,6 @@ class Create extends Action 'type' => $type ])); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); } else { $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ 'sourceSize' => $fileSize, @@ -350,12 +344,6 @@ class Create extends Action 'type' => $type ])); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); } else { $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ 'sourceChunksUploaded' => $chunksUploaded, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php index be4437ffe3..6862b0d776 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php @@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -89,8 +90,16 @@ class Delete extends Action throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); } - if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + try { + if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } + } catch (TransactionException) { + $deploymentExists = !$dbForProject->getDocument('deployments', $deployment->getId())->isEmpty(); + + if ($deploymentExists && !$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } } if (!empty($deployment->getAttribute('sourcePath', ''))) { diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php index 76070c8bf5..93f34ebb05 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -120,18 +120,6 @@ class Create extends Action 'buildLogs' => '', ])); - $function = $function - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $function->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $function->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $function->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'), - ])); - $publisherForBuilds->enqueue(new BuildMessage( project: $project, resource: $function, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php index dab477ef1f..85d93c14c1 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php @@ -12,6 +12,7 @@ use Executor\Executor; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -91,17 +92,30 @@ class Update extends Action $endTime = new \DateTime('now'); $duration = $endTime->getTimestamp() - $startTime->getTimestamp(); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildEndedAt' => DateTime::now(), - 'buildDuration' => $duration, - 'status' => 'canceled' - ])); - - if ($deployment->getSequence() === $function->getAttribute('latestDeploymentInternalId', '')) { - $function = $function->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'), + try { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' ])); + } catch (TransactionException) { + $deployment = $dbForProject->getDocument('deployments', $deployment->getId()); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) { + throw new Exception(Exception::BUILD_ALREADY_COMPLETED); + } + + if ($deployment->getAttribute('status') !== 'canceled') { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' + ])); + } } try { diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php index 87d1282d8b..136549e9c9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -174,19 +174,6 @@ class Create extends Base 'activate' => $activate, ])); - $function = $function - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $function->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $function->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $function->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'), - ])); - - $this->updateEmptyManualRule($project, $function, $deployment, $dbForPlatform, $authorization); $publisherForBuilds->enqueue(new BuildMessage( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index eaafe561df..6c09de8a41 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -344,12 +344,6 @@ class Create extends Base referenceType: 'branch' ); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); } elseif (!$template->isEmpty()) { // Deploy non-VCS from template $deploymentId = ID::unique(); @@ -370,13 +364,6 @@ class Create extends Base 'activate' => true, ])); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $publisherForBuilds->enqueue(new BuildMessage( project: $project, resource: $function, diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 07a7b1f89c..77ba3c89b9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -30,6 +30,7 @@ use Utopia\Database\Exception\Conflict; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Restricted; use Utopia\Database\Exception\Structure; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Query; use Utopia\Detector\Detection\Rendering\SSR; use Utopia\Detector\Detection\Rendering\XStatic; @@ -247,6 +248,7 @@ class Builds extends Action ->setParam('deploymentId', $deployment->getId()); if ($deployment->getAttribute('status') === 'canceled') { + $resource = $this->updateLatestDeployment($dbForProject, $resource); $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; @@ -261,9 +263,7 @@ class Builds extends Action 'status' => 'processing', ])); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); - } + $resource = $this->updateLatestDeployment($dbForProject, $resource); Span::add('deployment.status', 'processing'); @@ -537,9 +537,7 @@ class Builds extends Action ])); Span::add('deployment.status', 'building'); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); - } + $resource = $this->updateLatestDeployment($dbForProject, $resource); $queueForRealtime ->setPayload($deployment->getArrayCopy()) @@ -898,16 +896,21 @@ class Builds extends Action $deployment->setAttribute('buildLogs', $logs); /** Update the status */ + $endTime = DateTime::now(); + $durationEnd = \microtime(true); + $deployment->setAttribute('buildEndedAt', $endTime); + $deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart))); $deployment->setAttribute('status', 'ready'); $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ + 'buildEndedAt' => $deployment->getAttribute('buildEndedAt'), + 'buildDuration' => $deployment->getAttribute('buildDuration'), 'buildLogs' => $deployment->getAttribute('buildLogs'), 'status' => 'ready', ])); Span::add('deployment.status', 'ready'); + Span::add('build.duration', $deployment->getAttribute('buildDuration')); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); - } + $resource = $this->updateLatestDeployment($dbForProject, $resource); if ($isVcsEnabled) { $this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform, $queueForRealtime, $platform); @@ -994,6 +997,8 @@ class Builds extends Action Span::add('build.activated', true); } + $resource = $this->updateLatestDeployment($dbForProject, $resource); + $this->afterDeploymentSuccess( $project, $deployment, @@ -1063,13 +1068,6 @@ class Builds extends Action } } - $endTime = DateTime::now(); - $durationEnd = \microtime(true); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildEndedAt' => $endTime, - 'buildDuration' => \intval(\ceil($durationEnd - $durationStart)), - ])); - Span::add('build.duration', $deployment->getAttribute('buildDuration')); $queueForRealtime ->setPayload($deployment->getArrayCopy()) ->trigger(); @@ -1150,9 +1148,7 @@ class Builds extends Action 'buildLogs' => $message, ])); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); - } + $resource = $this->updateLatestDeployment($dbForProject, $resource); $queueForRealtime ->setPayload($deployment->getArrayCopy()) @@ -1496,20 +1492,61 @@ class Builds extends Action } } + private function updateLatestDeployment(Database $dbForProject, Document $resource): Document + { + $latestDeployment = $dbForProject->findOne('deployments', [ + Query::equal('resourceType', [$resource->getCollection()]), + Query::equal('resourceInternalId', [$resource->getSequence()]), + Query::orderDesc('$createdAt'), + ]); + + $updates = $latestDeployment->isEmpty() + ? [ + 'latestDeploymentCreatedAt' => '', + 'latestDeploymentInternalId' => '', + 'latestDeploymentId' => '', + 'latestDeploymentStatus' => '', + ] + : [ + 'latestDeploymentCreatedAt' => $latestDeployment->getCreatedAt(), + 'latestDeploymentInternalId' => $latestDeployment->getSequence(), + 'latestDeploymentId' => $latestDeployment->getId(), + 'latestDeploymentStatus' => $latestDeployment->getAttribute('status', ''), + ]; + + return $dbForProject->updateDocument( + $resource->getCollection(), + $resource->getId(), + new Document($updates) + ); + } + private function cancelDeployment(string $deploymentId, Database $dbForProject, Realtime $queueForRealtime) { Span::add('deployment.status', 'canceled'); - $deployment = $dbForProject->getDocument('deployments', $deploymentId); + $attempts = 0; - $logs = $deployment->getAttribute('buildLogs', ''); - $date = \date('H:i:s'); - $logs .= "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[33m Build has been canceled. \033[0m\n"; + while (true) { + try { + $deployment = $dbForProject->getDocument('deployments', $deploymentId); - $deployment->setAttribute('buildLogs', $logs); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildLogs' => $deployment->getAttribute('buildLogs'), - ])); + $logs = $deployment->getAttribute('buildLogs', ''); + $date = \date('H:i:s'); + $logs .= "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[33m Build has been canceled. \033[0m\n"; + + $deployment->setAttribute('buildLogs', $logs); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildLogs' => $deployment->getAttribute('buildLogs'), + ])); + + break; + } catch (TransactionException $exception) { + if (++$attempts >= 5) { + throw $exception; + } + } + } $queueForRealtime ->setPayload($deployment->getArrayCopy()) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 5fd724346c..53137ff000 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -311,18 +311,6 @@ class Create extends Action 'type' => $type, ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; @@ -393,18 +381,6 @@ class Create extends Action 'type' => $type, ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $site->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), - ])); - $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; $ruleId = md5($domain); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php index b50e9b54f4..a1ccf6cad5 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php @@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -89,8 +90,16 @@ class Delete extends Action throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); } - if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + try { + if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } + } catch (TransactionException) { + $deploymentExists = !$dbForProject->getDocument('deployments', $deployment->getId())->isEmpty(); + + if ($deploymentExists && !$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } } if (!empty($deployment->getAttribute('sourcePath', ''))) { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index b3619c6017..261f1df648 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -138,18 +138,6 @@ class Create extends Action 'type' => $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual' ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $site->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), - ])); - // Preview deployments for sites $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php index 7ea5cc87cb..a28a7465e6 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php @@ -12,6 +12,7 @@ use Executor\Executor; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -89,17 +90,30 @@ class Update extends Action $endTime = new \DateTime('now'); $duration = $endTime->getTimestamp() - $startTime->getTimestamp(); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildEndedAt' => DateTime::now(), - 'buildDuration' => $duration, - 'status' => 'canceled' - ])); - - if ($deployment->getSequence() === $site->getAttribute('latestDeploymentInternalId', '')) { - $site = $site->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), + try { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' ])); + } catch (TransactionException) { + $deployment = $dbForProject->getDocument('deployments', $deployment->getId()); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) { + throw new Exception(Exception::BUILD_ALREADY_COMPLETED); + } + + if ($deployment->getAttribute('status') !== 'canceled') { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' + ])); + } } try { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php index b0d39ad6f9..2d6b441616 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -184,18 +184,6 @@ class Create extends Base 'activate' => $activate, ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $site->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), - ])); - $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php index cde39e9292..d172fdc688 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php @@ -392,18 +392,6 @@ trait Deployment 'activate' => $activate, ]))); - $resource = $resource - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $authorization->skip(fn () => $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document([ - 'latestDeploymentId' => $resource->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $resource->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $resource->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $resource->getAttribute('latestDeploymentStatus'), - ]))); - if ($resource->getCollection() === 'sites') { $projectId = $project->getId(); diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 1df10da690..e837fd1baf 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -2540,12 +2540,14 @@ final class SitesCustomServerTest extends Scope $this->assertNotEmpty($response['cookies']['a_jwt_console']); $this->assertEquals($jwt['body']['jwt'], $response['cookies']['a_jwt_console']); - $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ - 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] - ], followRedirects: false); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Contact page", (string) $response['body']); - $this->assertStringContainsString("Preview by", (string) $response['body']); + $this->assertEventually(function () use ($proxyClient, $jwt) { + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", (string) $response['body']); + $this->assertStringContainsString("Preview by", (string) $response['body']); + }); // Failure: Session missing (old bad, new ok) $session = $this->client->call(Client::METHOD_DELETE, '/account/sessions/current', array_merge([ @@ -2573,12 +2575,14 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(201, $jwt['headers']['status-code']); $this->assertNotEmpty($jwt['body']['jwt']); - $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ - 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] - ], followRedirects: false); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Contact page", (string) $response['body']); - $this->assertStringContainsString("Preview by", (string) $response['body']); + $this->assertEventually(function () use ($proxyClient, $jwt) { + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", (string) $response['body']); + $this->assertStringContainsString("Preview by", (string) $response['body']); + }); $user = $this->client->call(Client::METHOD_PATCH, '/account/status', array_merge([ 'origin' => 'http://localhost', From 06f933554717e4d8ffab1346a73c7293f4568a2b Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 9 Jun 2026 11:15:46 +0100 Subject: [PATCH 078/151] Replace unstructured logging in screenshots worker with Span Drop the Console::log narration and the Console::warning error dump in the screenshots worker. Add Span::add tracing for context (project.id, deployment.id, site.id, site.framework, screenshot.count), following the conventions used by the Builds worker. Error reporting is left to the worker harness: the catch block already rethrows, and app/worker.php records the Throwable on the span via setError, so the handler no longer duplicates it. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Modules/Functions/Workers/Screenshots.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php index c766f73929..35cbe63a15 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php @@ -10,7 +10,6 @@ use Appwrite\Role; use Exception; use Utopia\Compression\Compression; use Utopia\Config\Config; -use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; @@ -18,6 +17,7 @@ use Utopia\Database\Query; use Utopia\Fetch\Client as FetchClient; use Utopia\Platform\Action; use Utopia\Queue\Message; +use Utopia\Span\Span; use Utopia\Storage\Device; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; @@ -59,7 +59,7 @@ class Screenshots extends Action Device $deviceForFiles, Telemetry $telemetry ): void { - Console::log('Screenshot action started'); + Span::add('project.id', $project->getId()); $payload = $message->getPayload(); @@ -70,9 +70,8 @@ class Screenshots extends Action $screenshotMessage = Screenshot::fromArray($payload); $counter = $telemetry->createCounter('worker.screenshots.capture'); - Console::log('Site screenshot started'); - $deploymentId = $screenshotMessage->deploymentId; + Span::add('deployment.id', $deploymentId); $deployment = $dbForProject->getDocument('deployments', $deploymentId); if ($deployment->isEmpty()) { @@ -80,12 +79,15 @@ class Screenshots extends Action } $siteId = $deployment->getAttribute('resourceId'); + Span::add('site.id', $siteId); $site = $dbForProject->getDocument('sites', $siteId); if ($site->isEmpty()) { throw new \Exception('Site not found'); } + Span::add('site.framework', $site->getAttribute('framework', '')); + // Realtime preparation $event = "sites.[siteId].deployments.[deploymentId].update"; $queueForRealtime @@ -205,6 +207,8 @@ class Screenshots extends Action throw new \Exception($screenshotError); } + Span::add('screenshot.count', \count($screenshots)); + $mimeType = "image/png"; $updates = new Document([]); @@ -268,10 +272,6 @@ class Screenshots extends Action 'deploymentScreenshotLight' => $deployment->getAttribute('screenshotLight', ''), ])); } catch (\Throwable $th) { - Console::warning("Screenshot failed to generate:"); - Console::warning($th->getMessage()); - Console::warning($th->getTraceAsString()); - $date = \date('H:i:s'); $this->appendToLogs($dbForProject, $deployment->getId(), $queueForRealtime, "[$date] [appwrite] Screenshot capturing failed. Deployment will continue. \n"); From bf566912f36e953b4bbe0a991603cb2d56b9631b Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 9 Jun 2026 14:28:00 +0400 Subject: [PATCH 079/151] Order MFA authenticators by creation time --- app/init/database/filters.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/init/database/filters.php b/app/init/database/filters.php index e171805c47..cba0c0cad6 100644 --- a/app/init/database/filters.php +++ b/app/init/database/filters.php @@ -231,6 +231,7 @@ Database::addFilter( return $database->getAuthorization()->skip(fn () => $database ->find('authenticators', [ Query::equal('userInternalId', [$document->getSequence()]), + Query::orderDesc('$createdAt'), Query::limit(APP_LIMIT_SUBQUERY), ])); } From 5f8006a2ed3d8b7bb62e319ad334048d30c78363 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 9 Jun 2026 16:46:40 +0530 Subject: [PATCH 080/151] Fix flaky webhook and site deployment tests (#12550) * Fix project webhook execution flake * Fix flaky site duplicate deployment test * Wait for site screenshot worker before deleting deployment * Increase project webhook deployment wait --- .../Services/ProjectWebhooks/WebhooksBase.php | 11 +++++++- .../Services/Sites/SitesCustomServerTest.php | 28 +++++++++++-------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/tests/e2e/Services/ProjectWebhooks/WebhooksBase.php b/tests/e2e/Services/ProjectWebhooks/WebhooksBase.php index 8e98c8bb48..e852cf093b 100644 --- a/tests/e2e/Services/ProjectWebhooks/WebhooksBase.php +++ b/tests/e2e/Services/ProjectWebhooks/WebhooksBase.php @@ -26,7 +26,16 @@ trait WebhooksBase $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body'])); - }, 120000, 500); + + $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId, $function['body']['deploymentId'] ?? '', \json_encode($function['body'])); + }, 240000, 500); } /** diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index e837fd1baf..1413a5ffb9 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -1759,6 +1759,11 @@ final class SitesCustomServerTest extends Scope $deployment = $this->getDeployment($siteId, $deploymentId); $this->assertEquals('ready', $deployment['body']['status']); + $this->assertTrue( + \str_contains((string) $deployment['body']['buildLogs'], 'Screenshot capturing finished.') + || \str_contains((string) $deployment['body']['buildLogs'], 'Screenshot capturing failed.'), + 'Screenshot worker did not finish: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT) + ); }, 120000, 500); /** @@ -2340,16 +2345,19 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); - $deploymentId2 = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId2); + $cliDeploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($cliDeploymentId); - $deployment = $this->getDeployment($siteId, $deploymentId2); + $deployment = $this->getDeployment($siteId, $cliDeploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertGreaterThan(0, $deployment['body']['sourceSize']); $this->assertEquals(0, $deployment['body']['buildSize']); $this->assertEquals($deployment['body']['sourceSize'], $deployment['body']['totalSize']); $this->assertEquals('cli', $deployment['body']['type']); + $this->waitDeploymentReady($siteId, $cliDeploymentId); + $this->waitDeploymentActivated($siteId, $cliDeploymentId); + // create another duplicate deployment with manual trigger $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/duplicate', array_merge([ 'content-type' => 'multipart/form-data', @@ -2360,25 +2368,23 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); - $deploymentId2 = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId2); + $manualDeploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($manualDeploymentId); - $deployment = $this->getDeployment($siteId, $deploymentId2); + $deployment = $this->getDeployment($siteId, $manualDeploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertGreaterThan(0, $deployment['body']['sourceSize']); $this->assertEquals(0, $deployment['body']['buildSize']); $this->assertEquals($deployment['body']['sourceSize'], $deployment['body']['totalSize']); $this->assertEquals('manual', $deployment['body']['type']); - $this->assertEventually(function () use ($siteId, $deploymentId2) { - $site = $this->getSite($siteId); - $this->assertEquals($deploymentId2, $site['body']['deploymentId']); - }, 120000, 500); + $this->waitDeploymentReady($siteId, $manualDeploymentId); + $this->waitDeploymentActivated($siteId, $manualDeploymentId); $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); $this->assertStringContainsString("Index page", (string) $response['body']); - $deployment = $this->getDeployment($siteId, $deploymentId2); + $deployment = $this->getDeployment($siteId, $manualDeploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertGreaterThan(0, $deployment['body']['sourceSize']); $this->assertGreaterThan(0, $deployment['body']['buildSize']); From 5bf426d1497c544dbb007bfea96982da0f393507 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 9 Jun 2026 12:32:37 +0100 Subject: [PATCH 081/151] Make webhooks worker coroutine-safe The webhooks worker held per-message state on the shared Action instance (`private array $errors`), which is reused across coroutines. With more than one coroutine, one message's reset/append would clobber another's, causing errors to be lost or attributed to the wrong message. Scope the error accumulator to each `action()` call and have `execute()` return its failure log (or null) instead of mutating instance state. With the race removed, enable concurrency by bumping the worker to `_APP_WORKER_MAX_COROUTINES=8`, matching the other concurrent workers. Co-Authored-By: Claude Opus 4.8 (1M context) --- docker-compose.yml | 2 +- src/Appwrite/Platform/Workers/Webhooks.php | 29 ++++++++++++---------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2907ab864f..212b0f1f47 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -386,7 +386,7 @@ services: environment: - _APP_ENV - _APP_WORKERS_NUM=1 - - _APP_WORKER_MAX_COROUTINES=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index 48f12d3ee9..d91425d59b 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -20,7 +20,6 @@ use Utopia\System\System; class Webhooks extends Action { - private array $errors = []; private const MAX_FILE_SIZE = 5242880; // 5 MB public static function getName(): string @@ -58,11 +57,8 @@ class Webhooks extends Action */ public function action(Message $message, Document $project, Database $dbForPlatform, MailPublisher $publisherForMails, UsagePublisher $publisherForUsage, Log $log, array $plan): void { - $this->errors = []; $payload = $message->getPayload(); - - if (empty($payload)) { throw new Exception('Missing payload'); } @@ -73,14 +69,18 @@ class Webhooks extends Action $log->addTag('projectId', $project->getId()); + $errors = []; foreach ($project->getAttribute('webhooks', []) as $webhook) { if (array_intersect($webhook->getAttribute('events', []), $events)) { - $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $publisherForMails, $publisherForUsage, $plan); + $error = $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $publisherForMails, $publisherForUsage, $plan); + if ($error !== null) { + $errors[] = $error; + } } } - if (!empty($this->errors)) { - throw new Exception(\implode(" / \n\n", $this->errors)); + if (!empty($errors)) { + throw new Exception(\implode(" / \n\n", $errors)); } } @@ -93,12 +93,12 @@ class Webhooks extends Action * @param Database $dbForPlatform * @param MailPublisher $publisherForMails * @param array $plan - * @return void + * @return string|null The error log if the delivery failed, otherwise null */ - private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, MailPublisher $publisherForMails, UsagePublisher $publisherForUsage, array $plan): void + private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, MailPublisher $publisherForMails, UsagePublisher $publisherForUsage, array $plan): ?string { if ($webhook->getAttribute('enabled') !== true) { - return; + return null; } $url = \rawurldecode($webhook->getAttribute('url')); @@ -107,8 +107,7 @@ class Webhooks extends Action $host = \parse_url($url, PHP_URL_HOST) ?? ''; $hostnameValidator = new PublicHostname(); if (!$hostnameValidator->isValid($host)) { - $this->errors[] = 'Webhook target ' . $host . ' rejected: ' . $hostnameValidator->getDescription(); - return; + return 'Webhook target ' . $host . ' rejected: ' . $hostnameValidator->getDescription(); } } @@ -159,6 +158,8 @@ class Webhooks extends Action $curlError = \curl_error($ch); $statusCode = \curl_getinfo($ch, CURLINFO_RESPONSE_CODE); + $error = null; + if (!empty($curlError) || $statusCode >= 400) { $dbForPlatform->increaseDocumentAttribute('webhooks', $webhook->getId(), 'attempts', 1); $webhook = $dbForPlatform->getDocument('webhooks', $webhook->getId()); @@ -189,7 +190,7 @@ class Webhooks extends Action $dbForPlatform->updateDocument('webhooks', $webhook->getId(), new Document($updatePayload)); $dbForPlatform->purgeCachedDocument('projects', $project->getId()); - $this->errors[] = $logs; + $error = $logs; $usage = (new UsageContext()) ->addMetric(METRIC_WEBHOOKS_FAILED, 1) ->addMetric(str_replace('{webhookInternalId}', $webhook->getSequence(), METRIC_WEBHOOK_ID_FAILED), 1); @@ -207,6 +208,8 @@ class Webhooks extends Action project: $project, metrics: $usage->getMetrics(), )); + + return $error; } /** From 0848175951aa1c837d861c5347ba1deaadf16894 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 9 Jun 2026 18:52:25 +0530 Subject: [PATCH 082/151] Add project path auth scheme to specs (#12554) --- src/Appwrite/Platform/Tasks/Specs.php | 18 ++++++++-- .../SDK/Specification/Format/OpenAPI3.php | 36 ++++++++----------- .../SDK/Specification/Format/Swagger2.php | 36 ++++++++----------- 3 files changed, 43 insertions(+), 47 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 8717ae742e..4db9e99e58 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -139,11 +139,15 @@ class Specs extends Action 'description' => 'Your project ID', 'in' => 'header', ], - 'ProjectQuery' => [ + 'ProjectPath' => [ 'type' => 'apiKey', 'name' => 'project', 'description' => 'Your project ID', 'in' => 'query', + 'x-appwrite' => [ + 'location' => 'path', + 'param' => 'project_id', + ], ], 'JWT' => [ 'type' => 'apiKey', @@ -201,11 +205,15 @@ class Specs extends Action 'description' => 'Your project ID', 'in' => 'header', ], - 'ProjectQuery' => [ + 'ProjectPath' => [ 'type' => 'apiKey', 'name' => 'project', 'description' => 'Your project ID', 'in' => 'query', + 'x-appwrite' => [ + 'location' => 'path', + 'param' => 'project_id', + ], ], 'Key' => [ 'type' => 'apiKey', @@ -275,11 +283,15 @@ class Specs extends Action 'description' => 'Your project ID', 'in' => 'header', ], - 'ProjectQuery' => [ + 'ProjectPath' => [ 'type' => 'apiKey', 'name' => 'project', 'description' => 'Your project ID', 'in' => 'query', + 'x-appwrite' => [ + 'location' => 'path', + 'param' => 'project_id', + ], ], 'Key' => [ 'type' => 'apiKey', diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 670f9f9f5f..8b36c45176 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -81,28 +81,20 @@ class OpenAPI3 extends Format ], ]; - if (isset($output['components']['securitySchemes']['Project'])) { - $output['components']['securitySchemes']['Project']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['components']['securitySchemes']['ProjectQuery'])) { - $output['components']['securitySchemes']['ProjectQuery']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['components']['securitySchemes']['Key'])) { - $output['components']['securitySchemes']['Key']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['components']['securitySchemes']['JWT'])) { - $output['components']['securitySchemes']['JWT']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['components']['securitySchemes']['Locale'])) { - $output['components']['securitySchemes']['Locale']['x-appwrite'] = ['demo' => 'en']; - } - - if (isset($output['components']['securitySchemes']['Mode'])) { - $output['components']['securitySchemes']['Mode']['x-appwrite'] = ['demo' => '']; + foreach ([ + 'Project' => '', + 'ProjectPath' => '', + 'Key' => '', + 'JWT' => '', + 'Locale' => 'en', + 'Mode' => '', + ] as $key => $demo) { + if (isset($output['components']['securitySchemes'][$key])) { + $output['components']['securitySchemes'][$key]['x-appwrite'] = \array_merge( + $output['components']['securitySchemes'][$key]['x-appwrite'] ?? [], + ['demo' => $demo] + ); + } } $usedModels = []; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index e5f240dde3..7b4c6791c1 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -70,28 +70,20 @@ class Swagger2 extends Format ], ]; - if (isset($output['securityDefinitions']['Project'])) { - $output['securityDefinitions']['Project']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['securityDefinitions']['ProjectQuery'])) { - $output['securityDefinitions']['ProjectQuery']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['securityDefinitions']['Key'])) { - $output['securityDefinitions']['Key']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['securityDefinitions']['JWT'])) { - $output['securityDefinitions']['JWT']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['securityDefinitions']['Locale'])) { - $output['securityDefinitions']['Locale']['x-appwrite'] = ['demo' => 'en']; - } - - if (isset($output['securityDefinitions']['Mode'])) { - $output['securityDefinitions']['Mode']['x-appwrite'] = ['demo' => '']; + foreach ([ + 'Project' => '', + 'ProjectPath' => '', + 'Key' => '', + 'JWT' => '', + 'Locale' => 'en', + 'Mode' => '', + ] as $key => $demo) { + if (isset($output['securityDefinitions'][$key])) { + $output['securityDefinitions'][$key]['x-appwrite'] = \array_merge( + $output['securityDefinitions'][$key]['x-appwrite'] ?? [], + ['demo' => $demo] + ); + } } $usedModels = []; From ea72585c5b0f4f7ef8fa56d670f0f02c88d4724a Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 9 Jun 2026 21:11:21 +0400 Subject: [PATCH 083/151] Bound TOTP rotation wait in account tests --- tests/e2e/Services/Account/AccountCustomClientTest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index 36a80662d8..1928b0b1c8 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -133,12 +133,18 @@ final class AccountCustomClientTest extends Scope protected function getNextTOTP(\OTPHP\TOTP $totp, string $previousOtp): string { + $deadline = time() + 35; + do { sleep(1); $otp = $totp->now(); - } while ($otp === $previousOtp); - return $otp; + if ($otp !== $previousOtp) { + return $otp; + } + } while (time() < $deadline); + + $this->fail('TOTP did not rotate within the expected time window.'); } /** From 487249c41329257458230146504118a7f48b4351 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 10 Jun 2026 00:59:01 +0400 Subject: [PATCH 084/151] Add node modules cache key for builds --- docker-compose.yml | 7 +- .../Modules/Functions/Workers/Builds.php | 71 ++++++++++++++++++- src/Executor/Executor.php | 6 +- 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7d3f6bdc5f..0e61c9b8b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1218,11 +1218,11 @@ services: - appwrite openruntimes-executor: - container_name: openruntimes-executor + container_name: exc1 hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.11.4 + image: openruntimes/executor:0.24.0 restart: unless-stopped networks: - appwrite @@ -1236,6 +1236,8 @@ services: # It's not possible to share mount file between 2 containers without host mount (copying is too slow) - /tmp:/tmp:rw environment: + - OPR_EXECUTOR_CONNECTION_STORAGE=local://localhost + - OPR_EXECUTOR_CONNECTION_BUILD_CACHE_STORAGE= - OPR_EXECUTOR_IMAGE_PULL=enabled - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL @@ -1494,3 +1496,4 @@ volumes: appwrite-builds: appwrite-config: appwrite-models: + openruntimes-node-modules-cache: diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 92e00cd4e6..760e926a21 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -679,6 +679,14 @@ class Builds extends Action deployment: $deployment ); + $cacheKey = $this->getNodeModulesCacheKey($project, $resource, $runtime, $version, $command); + + Span::add('build.node_modules_cache.enabled', $cacheKey !== ''); + Span::add('build.node_modules_cache.key', $cacheKey); + + $cacheDebugLogs = $this->getNodeModulesCacheDebugLog($cacheKey, $runtime, $version, $command, $source); + $deployment = $this->appendBuildLog($dbForProject, $queueForRealtime, $deployment, $cacheDebugLogs); + $response = null; $err = null; @@ -692,7 +700,7 @@ class Builds extends Action $span = Span::current(); Co::join([ - Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cpus, $memory, $timeout, &$err, $version, $span) { + Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cacheKey, $cpus, $memory, $timeout, &$err, $version, $span) { try { if ($version === 'v2') { $command = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh'; @@ -737,7 +745,8 @@ class Builds extends Action destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}", variables: $vars, command: $command, - outputDirectory: $outputDirectory ?? '' + outputDirectory: $outputDirectory ?? '', + cacheKey: $cacheKey ); } catch (ExecutorTimeout $error) { @@ -888,7 +897,7 @@ class Builds extends Action $logs = $logsBefore . $logsAfter; } - $deployment->setAttribute('buildLogs', $logs); + $deployment->setAttribute('buildLogs', $cacheDebugLogs . $logs); $adapter = null; if ($resource->getCollection() === 'sites' && ! empty($detectionLogs)) { @@ -1342,6 +1351,62 @@ class Builds extends Action return ''; } + protected function getNodeModulesCacheKey(Document $project, Document $resource, array $runtime, string $version, string $command): string + { + if ($version !== 'v5' || $command === '' || $command === '0') { + return ''; + } + + $hashContext = [ + 'version' => 'v1', + 'projectId' => $project->getId(), + 'resourceType' => $resource->getCollection(), + 'resourceId' => $resource->getId(), + 'runtime' => $runtime['image'] ?? '', + ]; + + return \substr(\hash('sha256', \json_encode($hashContext, JSON_THROW_ON_ERROR)), 0, 48); + } + + protected function getNodeModulesCacheDebugLog(string $cacheKey, array $runtime, string $version, string $command, string $source): string + { + $date = \date('H:i:s'); + $runtimeKey = $runtime['key'] ?? ''; + $prefix = "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[36m"; + + if ($cacheKey !== '') { + return $prefix . " build cache requested. key={$cacheKey} source={$source} \033[0m\n"; + } + + $reason = match (true) { + $version !== 'v5' => 'runtime version is not v5', + $command === '' || $command === '0' => 'build command is empty', + default => 'cache key unavailable', + }; + + return $prefix . " build cache not requested. reason={$reason} runtime={$runtimeKey} version={$version} source={$source} \033[0m\n"; + } + + protected function appendBuildLog(Database $dbForProject, Realtime $queueForRealtime, Document $deployment, string $log): Document + { + if ($log === '') { + return $deployment; + } + + $logs = $deployment->getAttribute('buildLogs', '') . $log; + $deployment->setAttribute('buildLogs', $logs); + + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildLogs' => $logs, + ])); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + return $deployment; + } + /** * @throws Structure * @throws \Utopia\Database\Exception diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index c570970732..53c86f1287 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -71,7 +71,8 @@ class Executor array $variables = [], ?string $command = null, string $outputDirectory = '', - string $runtimeEntrypoint = '' + string $runtimeEntrypoint = '', + string $cacheKey = '' ) { $runtimeId = "$projectId-$deploymentId-build"; $route = "/runtimes"; @@ -95,7 +96,8 @@ class Executor 'version' => $version, 'timeout' => $timeout, 'outputDirectory' => $outputDirectory, - 'runtimeEntrypoint' => $runtimeEntrypoint + 'runtimeEntrypoint' => $runtimeEntrypoint, + 'cacheKey' => $cacheKey ]; From 241602d9e1edad71d89c89337dd66fa7c01a8a84 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 10 Jun 2026 02:16:10 +0400 Subject: [PATCH 085/151] Update E2E SitesBase to use exc1 container --- tests/e2e/Services/Sites/SitesBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 7ce6772c90..21d3a4ff66 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -72,7 +72,7 @@ trait SitesBase throw new Critical('Deployment failed: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); } - Console::execute("docker inspect openruntimes-executor --format='{{.State.ExitCode}}'", '', $this->stdout, $this->stderr); + Console::execute("docker inspect exc1 --format='{{.State.ExitCode}}'", '', $this->stdout, $this->stderr); if (\trim($this->stdout) !== '0') { $msg = 'Executor has a problem: ' . $this->stderr . ' (' . $this->stdout . '), current status: '; From 1af1da01e203aadb152b76f1b08aaa972ec3bf68 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 10 Jun 2026 02:18:02 +0400 Subject: [PATCH 086/151] Update E2E SitesBase executor logs lookup --- tests/e2e/Services/Sites/SitesBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 21d3a4ff66..f93a534bc4 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -76,7 +76,7 @@ trait SitesBase if (\trim($this->stdout) !== '0') { $msg = 'Executor has a problem: ' . $this->stderr . ' (' . $this->stdout . '), current status: '; - Console::execute("docker compose logs openruntimes-executor", '', $this->stdout, $this->stderr); + Console::execute("docker logs exc1", '', $this->stdout, $this->stderr); $msg .= $this->stdout . ' (' . $this->stderr . ')'; throw new Critical($msg . json_encode($deployment['body'], JSON_PRETTY_PRINT)); From 57269867daf25cf49e2836f6111619dff9445ff5 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 10 Jun 2026 02:36:06 +0400 Subject: [PATCH 087/151] Update install compose executor config --- app/views/install/compose.phtml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 6ce1fb5cea..d401db9ce0 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -983,12 +983,12 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); - appwrite openruntimes-executor: - container_name: openruntimes-executor + container_name: exc1 hostname: exc1 <<: *x-logging restart: unless-stopped stop_signal: SIGINT - image: openruntimes/executor:0.11.4 + image: openruntimes/executor:0.24.0 networks: - appwrite - runtimes @@ -1001,6 +1001,8 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); # It's not possible to share mount file between 2 containers without host mount (copying is too slow) - /tmp:/tmp:rw environment: + - OPR_EXECUTOR_CONNECTION_STORAGE=local://localhost + - OPR_EXECUTOR_CONNECTION_BUILD_CACHE_STORAGE= - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL - OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK @@ -1209,3 +1211,4 @@ volumes: appwrite-sites: appwrite-builds: appwrite-config: + openruntimes-node-modules-cache: From f63a1d53b621d724bc02b507db7dbd3563e22545 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 10 Jun 2026 12:04:46 +0530 Subject: [PATCH 088/151] Fix generated spec lint warnings (#12553) * Fix generated spec lint warnings * (fix): infer item types from JSON-string examples and wrap oneOf in allOf --- src/Appwrite/SDK/Specification/Format.php | 54 +++++ .../SDK/Specification/Format/OpenAPI3.php | 54 ++++- .../SDK/Specification/Format/Swagger2.php | 53 +++- tests/unit/SDK/Specification/FormatTest.php | 228 ++++++++++++++++++ 4 files changed, 373 insertions(+), 16 deletions(-) diff --git a/src/Appwrite/SDK/Specification/Format.php b/src/Appwrite/SDK/Specification/Format.php index 29ad2d84b8..bedd8e4c1e 100644 --- a/src/Appwrite/SDK/Specification/Format.php +++ b/src/Appwrite/SDK/Specification/Format.php @@ -101,6 +101,60 @@ abstract class Format return $this->params[$key] ?? $default; } + /** + * @return array + */ + protected function getArrayItemsSchema(mixed $example): array + { + if (\is_string($example)) { + $decoded = \json_decode($example, true); + if (\is_array($decoded)) { + $example = $decoded; + } + } + + if (!\is_array($example) || empty($example)) { + return ['type' => 'object']; + } + + foreach ($example as $item) { + if ($item === null) { + continue; + } + + if (\is_array($item)) { + if (!\array_is_list($item)) { + return [ + 'type' => 'object', + 'additionalProperties' => true, + ]; + } + + return [ + 'type' => 'array', + 'items' => $this->getArrayItemsSchema($item), + ]; + } + + if (\is_int($item) || \is_float($item)) { + return [ + 'type' => 'number', + 'format' => 'double', + ]; + } + + return [ + 'type' => match (\gettype($item)) { + 'boolean' => 'boolean', + 'string' => 'string', + default => 'object', + }, + ]; + } + + return ['type' => 'object']; + } + /** * Set Services. * diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 8b36c45176..b53f0b32e5 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -497,11 +497,36 @@ class OpenAPI3 extends Format case \Utopia\Database\Validator\Spatial::class: /** @var Spatial $validator */ $node['schema']['type'] = 'array'; - $node['schema']['items'] = [ - 'oneOf' => [ - ['type' => 'array'] - ] - ]; + $node['schema']['items'] = match ($validator->getSpatialType()) { + Database::VAR_POINT => [ + 'type' => 'number', + 'format' => 'double', + ], + Database::VAR_LINESTRING => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + Database::VAR_POLYGON => [ + 'type' => 'array', + 'items' => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + ], + default => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + }; $node['schema']['x-example'] = ($param['example'] ?? '') ?: match ($validator->getSpatialType()) { Database::VAR_POINT => '[1, 2]', Database::VAR_LINESTRING => '[[1, 2], [3, 4], [5, 6]]', @@ -777,7 +802,7 @@ class OpenAPI3 extends Format if ($isPathParam) { // Param is in URL path (directly or through alias) $node['in'] = 'path'; $temp['parameters'][] = $node; - } elseif ($route->getMethod() == 'GET') { // Param is in query + } elseif (\in_array($route->getMethod(), ['GET', 'DELETE'], true)) { // Param is in query $node['in'] = 'query'; $temp['parameters'][] = $node; } else { // Param is in payload @@ -852,7 +877,7 @@ class OpenAPI3 extends Format } foreach ($this->models as $model) { - if (!in_array($model->getType(), $usedModels) && $model->getType() !== 'error') { + if (!in_array($model->getType(), $usedModels)) { continue; } @@ -910,6 +935,7 @@ class OpenAPI3 extends Format case 'array': $type = 'array'; + $items = $this->getArrayItemsSchema($rule['example'] ?? []); break; case 'integer': @@ -1001,7 +1027,19 @@ class OpenAPI3 extends Format } } if ($items) { - $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items; + if ($rule['array'] || $rule['type'] === 'array') { + $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items; + } else { + if (isset($items['$ref']) || isset($items['oneOf'])) { + $items = ['allOf' => [$items]]; + } + /** @var array $property */ + $property = $output['components']['schemas'][$model->getType()]['properties'][$name]; + $output['components']['schemas'][$model->getType()]['properties'][$name] = [ + ...$property, + ...$items, + ]; + } } if ($rule['type'] === 'enum' && !empty($rule['enum'])) { if ($rule['array']) { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 7b4c6791c1..8b5bac9d5b 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -479,11 +479,36 @@ class Swagger2 extends Format case \Utopia\Database\Validator\Spatial::class: /** @var Spatial $validator */ $node['type'] = 'array'; - $node['schema']['items'] = [ - 'oneOf' => [ - ['type' => 'array'] - ] - ]; + $node['items'] = match ($validator->getSpatialType()) { + Database::VAR_POINT => [ + 'type' => 'number', + 'format' => 'double', + ], + Database::VAR_LINESTRING => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + Database::VAR_POLYGON => [ + 'type' => 'array', + 'items' => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + ], + default => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + }; $node['x-example'] = ($param['example'] ?? '') ?: match ($validator->getSpatialType()) { Database::VAR_POINT => '[1, 2]', Database::VAR_LINESTRING => '[[1, 2], [3, 4], [5, 6]]', @@ -737,7 +762,7 @@ class Swagger2 extends Format if ($isPathParam) { // Param is in URL path (directly or through alias) $node['in'] = 'path'; $temp['parameters'][] = $node; - } elseif ($route->getMethod() == 'GET') { // Param is in query + } elseif (\in_array($route->getMethod(), ['GET', 'DELETE'], true)) { // Param is in query $node['in'] = 'query'; $temp['parameters'][] = $node; } else { // Param is in payload @@ -871,6 +896,7 @@ class Swagger2 extends Format case 'array': $type = 'array'; + $items = $this->getArrayItemsSchema($rule['example'] ?? []); break; case 'integer': @@ -925,7 +951,6 @@ class Swagger2 extends Format } } else { $items = [ - 'type' => $type, '$ref' => '#/definitions/' . $rule['type'], ]; } @@ -978,7 +1003,19 @@ class Swagger2 extends Format } } if ($items) { - $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items; + if ($rule['array'] || $rule['type'] === 'array') { + $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items; + } else { + if (isset($items['$ref'])) { + $items = ['allOf' => [$items]]; + } + /** @var array $property */ + $property = $output['definitions'][$model->getType()]['properties'][$name]; + $output['definitions'][$model->getType()]['properties'][$name] = [ + ...$property, + ...$items, + ]; + } } if ($rule['type'] === 'enum' && !empty($rule['enum'])) { if ($rule['array']) { diff --git a/tests/unit/SDK/Specification/FormatTest.php b/tests/unit/SDK/Specification/FormatTest.php index 962979657d..11f9c0d7f6 100644 --- a/tests/unit/SDK/Specification/FormatTest.php +++ b/tests/unit/SDK/Specification/FormatTest.php @@ -10,6 +10,15 @@ use Appwrite\SDK\Specification\Format\Swagger2; use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model\AlgoArgon2; +use Appwrite\Utopia\Response\Model\AlgoBcrypt; +use Appwrite\Utopia\Response\Model\AlgoMd5; +use Appwrite\Utopia\Response\Model\AlgoPhpass; +use Appwrite\Utopia\Response\Model\AlgoScrypt; +use Appwrite\Utopia\Response\Model\AlgoScryptModified; +use Appwrite\Utopia\Response\Model\AlgoSha; +use Appwrite\Utopia\Response\Model\AttributeLine; +use Appwrite\Utopia\Response\Model\Error as ErrorModel; use Appwrite\Utopia\Response\Model\HealthStatus; use Appwrite\Utopia\Response\Model\PlatformAndroid; use Appwrite\Utopia\Response\Model\PlatformApple; @@ -17,8 +26,13 @@ use Appwrite\Utopia\Response\Model\PlatformLinux; use Appwrite\Utopia\Response\Model\PlatformList; use Appwrite\Utopia\Response\Model\PlatformWeb; use Appwrite\Utopia\Response\Model\PlatformWindows; +use Appwrite\Utopia\Response\Model\Preferences; +use Appwrite\Utopia\Response\Model\Team; +use Appwrite\Utopia\Response\Model\User; use Appwrite\Utopia\Response\Model\Webhook; use PHPUnit\Framework\TestCase; +use Utopia\Database\Database; +use Utopia\Database\Validator\Spatial; use Utopia\DI\Container; use Utopia\Http\Route; use Utopia\Validator\Nullable; @@ -40,6 +54,11 @@ class TestFormat extends Format { return $this->getRequestParameterConfig($optional, $nullable, $default, $methodName, $paramName); } + + public function arrayItemsSchema(mixed $example): array + { + return $this->getArrayItemsSchema($example); + } } final class FormatTest extends TestCase @@ -113,6 +132,215 @@ final class FormatTest extends TestCase ); } + public function testDeleteRouteOptionalParamsAreQueryParams(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('DELETE', '/v1/tests/:testId')) + ->desc('Delete test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'deleteTest', + description: 'Delete test.', + auth: [], + responses: [], + )) + ->param('testId', '', new Text(256), 'Test ID.') + ->param('transactionId', null, new Nullable(new Text(256)), 'Transaction ID.', true); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + + $this->assertArrayNotHasKey('requestBody', $openApi['paths']['/tests/{testId}']['delete']); + $this->assertCount(2, $openApi['paths']['/tests/{testId}']['delete']['parameters']); + $this->assertSame('path', $openApi['paths']['/tests/{testId}']['delete']['parameters'][0]['in']); + $this->assertSame('transactionId', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['name']); + $this->assertSame('query', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['in']); + + $this->assertCount(2, $swagger['paths']['/tests/{testId}']['delete']['parameters']); + $this->assertSame('path', $swagger['paths']['/tests/{testId}']['delete']['parameters'][0]['in']); + $this->assertSame('transactionId', $swagger['paths']['/tests/{testId}']['delete']['parameters'][1]['name']); + $this->assertSame('query', $swagger['paths']['/tests/{testId}']['delete']['parameters'][1]['in']); + } + + public function testModelReferencesDoNotEmitItemsOnObjectProperties(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/team')) + ->desc('Get test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getTeamTest', + description: 'Get test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_TEAM, + ), + ], + )); + + $models = [ + new Team(), + new Preferences(), + new ErrorModel(), + ]; + + $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + + $openApiPrefs = $openApi['components']['schemas']['team']['properties']['prefs']; + $swaggerPrefs = $swagger['definitions']['team']['properties']['prefs']; + + $this->assertArrayNotHasKey('items', $openApiPrefs); + $this->assertArrayNotHasKey('error', $openApi['components']['schemas']); + $this->assertSame('object', $openApiPrefs['type']); + $this->assertSame([['$ref' => '#/components/schemas/preferences']], $openApiPrefs['allOf']); + + $this->assertArrayNotHasKey('items', $swaggerPrefs); + $this->assertArrayNotHasKey('error', $swagger['definitions']); + $this->assertSame('object', $swaggerPrefs['type']); + $this->assertSame([['$ref' => '#/definitions/preferences']], $swaggerPrefs['allOf']); + } + + public function testArrayItemsSchemaInfersTypesFromJsonStringExamples(): void + { + $this->assertSame( + [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + $this->format->arrayItemsSchema('[[1,2],[3,4]]') + ); + + $this->assertSame( + [ + 'type' => 'object', + 'additionalProperties' => true, + ], + $this->format->arrayItemsSchema('[{"resource":"Database","id":"public"}]') + ); + + $this->assertSame( + ['type' => 'string'], + $this->format->arrayItemsSchema('["topt", "email"]') + ); + + $this->assertSame( + ['type' => 'object'], + $this->format->arrayItemsSchema('[SHARED_SECRET]') + ); + } + + public function testMultiTypePropertiesWrapOneOfInAllOf(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/user')) + ->desc('Get test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getUserTest', + description: 'Get test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_USER, + ), + ], + )); + + $models = [ + new User(), + new AlgoArgon2(), + new AlgoScrypt(), + new AlgoScryptModified(), + new AlgoBcrypt(), + new AlgoPhpass(), + new AlgoSha(), + new AlgoMd5(), + ]; + + $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + + $openApiHashOptions = $openApi['components']['schemas']['user']['properties']['hashOptions']; + $swaggerHashOptions = $swagger['definitions']['user']['properties']['hashOptions']; + + $this->assertSame('object', $openApiHashOptions['type']); + $this->assertArrayNotHasKey('items', $openApiHashOptions); + $this->assertArrayNotHasKey('oneOf', $openApiHashOptions); + $this->assertCount(1, $openApiHashOptions['allOf']); + $this->assertCount(7, $openApiHashOptions['allOf'][0]['oneOf']); + $this->assertSame(['$ref' => '#/components/schemas/algoArgon2'], $openApiHashOptions['allOf'][0]['oneOf'][0]); + + $this->assertSame('object', $swaggerHashOptions['type']); + $this->assertArrayNotHasKey('items', $swaggerHashOptions); + $this->assertCount(7, $swaggerHashOptions['x-oneOf']); + $this->assertSame(['$ref' => '#/definitions/algoArgon2'], $swaggerHashOptions['x-oneOf'][0]); + } + + public function testArraySchemasEmitItems(): void + { + Method::$processed = []; + Method::$errors = []; + + $requestRoute = (new Route('POST', '/v1/tests/spatial')) + ->desc('Create spatial test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'createSpatialTest', + description: 'Create spatial test.', + auth: [], + responses: [], + )) + ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value.', true); + + $modelRoute = (new Route('GET', '/v1/tests/spatial-model')) + ->desc('Get spatial test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getSpatialTest', + description: 'Get spatial test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_ATTRIBUTE_LINE, + ), + ], + )); + + $openApi = (new OpenAPI3(new Container(), [], [$requestRoute, $modelRoute], [new AttributeLine()], [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$requestRoute, $modelRoute], [new AttributeLine()], [], 0, 'console'))->parse(); + + $openApiRequestDefault = $openApi['paths']['/tests/spatial']['post']['requestBody']['content']['application/json']['schema']['properties']['default']; + $swaggerRequestDefault = $swagger['paths']['/tests/spatial']['post']['parameters'][0]['schema']['properties']['default']; + $openApiModelDefault = $openApi['components']['schemas']['attributeLine']['properties']['default']; + $swaggerModelDefault = $swagger['definitions']['attributeLine']['properties']['default']; + + foreach ([$openApiRequestDefault, $swaggerRequestDefault, $openApiModelDefault, $swaggerModelDefault] as $default) { + $this->assertSame('array', $default['type']); + $this->assertSame('array', $default['items']['type']); + $this->assertSame('number', $default['items']['items']['type']); + $this->assertSame('double', $default['items']['items']['format']); + } + } + public function testPasswordFormatMarksOnlyExplicitPasswordFields(): void { Method::$processed = []; From fca069aa9f5ba98bf0d0fbb7ef298658afb7fe04 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 10 Jun 2026 09:01:32 +0100 Subject: [PATCH 089/151] Fix locking test refactor check --- tests/unit/Locking/LockTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/Locking/LockTest.php b/tests/unit/Locking/LockTest.php index b789ffe3e0..b6fcfba4d2 100644 --- a/tests/unit/Locking/LockTest.php +++ b/tests/unit/Locking/LockTest.php @@ -1,5 +1,7 @@ Date: Wed, 10 Jun 2026 14:06:11 +0530 Subject: [PATCH 090/151] use server-side branch search via vcs 4.2.2 --- composer.lock | 12 ++++++------ .../Installations/Repositories/Branches/XList.php | 6 +----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index af1527d3cd..e3a4a84841 100644 --- a/composer.lock +++ b/composer.lock @@ -5160,16 +5160,16 @@ }, { "name": "utopia-php/vcs", - "version": "4.2.1", + "version": "4.2.2", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "59b64833fafb6c6e88c1eff8545e4e6adb8f5993" + "reference": "bb42584d3efb95ff4eb241605bb15165c56974de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/59b64833fafb6c6e88c1eff8545e4e6adb8f5993", - "reference": "59b64833fafb6c6e88c1eff8545e4e6adb8f5993", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/bb42584d3efb95ff4eb241605bb15165c56974de", + "reference": "bb42584d3efb95ff4eb241605bb15165c56974de", "shasum": "" }, "require": { @@ -5203,9 +5203,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/4.2.1" + "source": "https://github.com/utopia-php/vcs/tree/4.2.2" }, - "time": "2026-05-29T10:47:49+00:00" + "time": "2026-06-10T08:08:48+00:00" }, { "name": "utopia-php/websocket", diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php index fda462159f..c1a86c5597 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php @@ -96,11 +96,7 @@ class XList extends Action throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND); } - $branches = $github->listBranches($owner, $repositoryName); - - if (!empty($search)) { - $branches = \array_values(\array_filter($branches, fn (string $branch) => \stripos($branch, $search) !== false)); - } + $branches = $github->listBranches($owner, $repositoryName, search: $search); $total = \count($branches); [ From e087554db7ceb1e9ba1fa371812ec8d1a6a21726 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sun, 7 Jun 2026 23:22:23 +0100 Subject: [PATCH 091/151] chore(http): upgrade utopia-php/http to 2.0.0-rc5 rc5 adopts PSR-7 header semantics: getHeader() now returns a list of values, getHeaders() keys are lowercased with list values, and getHeaderLine() is the new accessor for a single concatenated string. - Migrate all string-expecting getHeader() call sites to getHeaderLine() - Drop the custom Request::getHeader()/getHeaders() overrides: the former is now signature-incompatible with the array-returning parent, and the latter's synthesized cookie header was dead (filtered by the function header allowlist, no other consumer) - Collapse PSR-7 list values to a single line when forwarding request headers to functions (general.php) - Fix the lowercased x-fallback-cookies lookup in GraphQL Resolvers - Update RequestTest to the getHeaderLine semantics Co-Authored-By: Claude Opus 4.8 (1M context) --- app/controllers/api/graphql.php | 8 +-- app/controllers/general.php | 15 +++--- app/controllers/mock.php | 2 +- app/controllers/shared/api.php | 8 +-- app/http.php | 2 +- app/init/realtime/connection.php | 24 ++++----- app/init/resources/request.php | 44 +++++++-------- composer.lock | 12 ++--- src/Appwrite/GraphQL/Resolvers.php | 5 +- .../Installer/Http/Installer/Install.php | 2 +- .../Installer/Http/Installer/Validate.php | 2 +- .../Modules/Databases/Http/Init/Timeout.php | 2 +- .../Functions/Http/Deployments/Create.php | 6 +-- .../Http/Deployments/Download/Get.php | 2 +- .../Functions/Http/Executions/Create.php | 2 +- .../Functions/Http/Functions/Create.php | 2 +- .../Modules/Presences/HTTP/Upsert.php | 2 +- .../Modules/Sites/Http/Deployments/Create.php | 6 +-- .../Sites/Http/Deployments/Download/Get.php | 2 +- .../Http/Deployments/Duplicate/Create.php | 2 +- .../Storage/Http/Buckets/Files/Create.php | 4 +- .../Http/Buckets/Files/Download/Get.php | 2 +- .../Storage/Http/Buckets/Files/Push/Get.php | 2 +- .../Storage/Http/Buckets/Files/View/Get.php | 2 +- .../Modules/VCS/Http/GitHub/Events/Create.php | 4 +- src/Appwrite/Utopia/Request.php | 54 +------------------ tests/unit/Utopia/RequestTest.php | 23 +++----- 27 files changed, 92 insertions(+), 149 deletions(-) diff --git a/app/controllers/api/graphql.php b/app/controllers/api/graphql.php index 4a509aefdd..1c596bb931 100644 --- a/app/controllers/api/graphql.php +++ b/app/controllers/api/graphql.php @@ -122,11 +122,11 @@ Http::post('/v1/graphql/mutation') ->action(function (Request $request, Response $response, GQLSchema $schema, Adapter $promiseAdapter) { $query = $request->getParams(); - if ($request->getHeader('x-sdk-graphql') == 'true') { + if ($request->getHeaderLine('x-sdk-graphql') == 'true') { $query = $query['query']; } - $type = $request->getHeader('content-type'); + $type = $request->getHeaderLine('content-type'); if (\str_starts_with($type, 'application/graphql')) { $query = parseGraphql($request); @@ -173,11 +173,11 @@ Http::post('/v1/graphql') ->action(function (Request $request, Response $response, GQLSchema $schema, Adapter $promiseAdapter) { $query = $request->getParams(); - if ($request->getHeader('x-sdk-graphql') == 'true') { + if ($request->getHeaderLine('x-sdk-graphql') == 'true') { $query = $query['query']; } - $type = $request->getHeader('content-type'); + $type = $request->getHeaderLine('content-type'); if (\str_starts_with($type, 'application/graphql')) { $query = parseGraphql($request); diff --git a/app/controllers/general.php b/app/controllers/general.php index cb25803b4c..8bed6c8e03 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -400,7 +400,8 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $headersFiltered = []; foreach ($headers as $key => $value) { if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_REQUEST)) { - $headersFiltered[] = ['name' => $key, 'value' => $value]; + // Request headers follow PSR-7 and arrive as a list of values; collapse to a single line. + $headersFiltered[] = ['name' => $key, 'value' => \is_array($value) ? \implode(', ', $value) : $value]; } } @@ -803,7 +804,7 @@ Http::init() ->inject('request') ->action(function (Document $project, Request $request) { if ($project->getId() === 'console') { - $message = empty($request->getHeader('x-appwrite-project')) ? + $message = empty($request->getHeaderLine('x-appwrite-project')) ? 'No Appwrite project was specified. Please specify your project ID when initializing your Appwrite SDK.' : 'This endpoint is not available for the console project. The Appwrite Console is a reserved project ID and cannot be used with the Appwrite SDKs and APIs. Please check if your project ID is correct.'; throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, $message); @@ -861,7 +862,7 @@ Http::init() return; } - $requestFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); + $requestFormat = $request->getHeaderLine('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); if ($requestFormat) { if (version_compare($requestFormat, '1.4.0', '<')) { $request->addFilter(new RequestV16()); @@ -899,7 +900,7 @@ Http::init() } } - $localeParam = (string) $request->getParam('locale', $request->getHeader('x-appwrite-locale', '')); + $localeParam = (string) $request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', '')); if (\in_array($localeParam, $localeCodes)) { $locale->setDefault($localeParam); } @@ -919,7 +920,7 @@ Http::init() /* * Response format */ - $responseFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); + $responseFormat = $request->getHeaderLine('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); if ($responseFormat) { if (version_compare($responseFormat, '1.9.5', '<')) { $response->addFilter(new ResponseV26()); @@ -1006,7 +1007,7 @@ Http::init() // Application level CSRF protection $origin = $request->getOrigin(); - if (empty($origin) || !$devKey->isEmpty() || !empty($request->getHeader('x-appwrite-key'))) { + if (empty($origin) || !$devKey->isEmpty() || !empty($request->getHeaderLine('x-appwrite-key'))) { return; } $route = $request->getRoute(); @@ -1315,7 +1316,7 @@ Http::error() } $log->addTag('hostname', $request->getHostname()); - $log->addTag('locale', (string)$request->getParam('locale', $request->getHeader('x-appwrite-locale', ''))); + $log->addTag('locale', (string)$request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', ''))); $log->addExtra('file', $error->getFile()); $log->addExtra('line', $error->getLine()); diff --git a/app/controllers/mock.php b/app/controllers/mock.php index 00389085af..fcb17da717 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -46,7 +46,7 @@ Http::get('/v1/mock/tests/locale') ->inject('request') ->inject('response') ->action(function (Locale $locale, array $localeCodes, Request $request, Response $response) { - $localeParam = (string) $request->getParam('locale', $request->getHeader('x-appwrite-locale', '')); + $localeParam = (string) $request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', '')); if (\in_array($localeParam, $localeCodes)) { $locale->setDefault($localeParam); } diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index db1bf99edb..4b5f7170ff 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -201,19 +201,19 @@ Http::init() if (! empty($apiKey->getProjectId())) { $dbKey = $project->find( key: 'secret', - find: $request->getHeader('x-appwrite-key', ''), + find: $request->getHeaderLine('x-appwrite-key', ''), subject: 'keys' ); } elseif (! empty($apiKey->getUserId())) { $dbKey = $user->find( key: 'secret', - find: $request->getHeader('x-appwrite-key', ''), + find: $request->getHeaderLine('x-appwrite-key', ''), subject: 'keys' ); } elseif (! empty($apiKey->getTeamId())) { $dbKey = $team->find( key: 'secret', - find: $request->getHeader('x-appwrite-key', ''), + find: $request->getHeaderLine('x-appwrite-key', ''), subject: 'keys' ); } @@ -231,7 +231,7 @@ Http::init() } $sdkValidator = new WhiteList($servers, true); - $sdk = $request->getHeader('x-sdk-name', 'UNKNOWN'); + $sdk = $request->getHeaderLine('x-sdk-name', 'UNKNOWN'); if ($sdk !== 'UNKNOWN' && $sdkValidator->isValid($sdk)) { $sdks = $dbKey->getAttribute('sdks', []); diff --git a/app/http.php b/app/http.php index a6fc6df13b..94bc5d01ac 100644 --- a/app/http.php +++ b/app/http.php @@ -578,7 +578,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $log->addTag('code', $th->getCode()); // $log->addTag('projectId', $project->getId()); // TODO: Figure out how to get ProjectID, if it becomes relevant $log->addTag('hostname', $request->getHostname()); - $log->addTag('locale', (string)$request->getParam('locale', $request->getHeader('x-appwrite-locale', ''))); + $log->addTag('locale', (string)$request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', ''))); $log->addExtra('file', $th->getFile()); $log->addExtra('line', $th->getLine()); diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index ea00b7f356..397d077aa7 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -24,7 +24,7 @@ use Utopia\Validator\WhiteList; */ return function (Container $container): void { $getProjectId = static function (Request $request): string { - $projectId = $request->getHeader('x-appwrite-project', ''); + $projectId = $request->getHeaderLine('x-appwrite-project', ''); if (!empty($projectId)) { return $projectId; @@ -36,7 +36,7 @@ return function (Container $container): void { }; $getMode = static function (Request $request, Document $project) use ($getProjectId): string { - $mode = $request->getParam('mode', $request->getHeader('x-appwrite-mode', APP_MODE_DEFAULT)); + $mode = $request->getParam('mode', $request->getHeaderLine('x-appwrite-mode', APP_MODE_DEFAULT)); $projectId = $getProjectId($request); if (!empty($projectId) && $project->getId() !== $projectId) { @@ -113,7 +113,7 @@ return function (Container $container): void { }; $findDevKey = static function (Request $request, Document $project, array $servers, Authorization $authorization) use ($getDbForPlatform): Document { - $devKey = $request->getHeader('x-appwrite-dev-key', $request->getParam('devKey', '')); + $devKey = $request->getHeaderLine('x-appwrite-dev-key', $request->getParam('devKey', '')); $key = $project->find('secret', $devKey, 'devKeys'); if (!$key) { @@ -137,7 +137,7 @@ return function (Container $container): void { } $sdkValidator = new WhiteList($servers, true); - $sdk = \strtolower($request->getHeader('x-sdk-name', 'UNKNOWN')); + $sdk = \strtolower($request->getHeaderLine('x-sdk-name', 'UNKNOWN')); if ($sdk !== 'unknown' && $sdkValidator->isValid($sdk)) { $sdks = $key->getAttribute('sdks', []); @@ -233,7 +233,7 @@ return function (Container $container): void { ); if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { - $sessionHeader = $request->getHeader('x-appwrite-session', ''); + $sessionHeader = $request->getHeaderLine('x-appwrite-session', ''); if (!empty($sessionHeader)) { $store->decode($sessionHeader); @@ -241,7 +241,7 @@ return function (Container $container): void { } if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { - $fallback = \json_decode($request->getHeader('x-fallback-cookies', ''), true); + $fallback = \json_decode($request->getHeaderLine('x-fallback-cookies', ''), true); $store->decode((\is_array($fallback) && isset($fallback[$store->getKey()])) ? $fallback[$store->getKey()] : ''); } @@ -271,7 +271,7 @@ return function (Container $container): void { $user = new User([]); } - $authJWT = $request->getHeader('x-appwrite-jwt', ''); + $authJWT = $request->getHeaderLine('x-appwrite-jwt', ''); if (!empty($authJWT) && !$project->isEmpty()) { if (!$user->isEmpty()) { throw new Exception(Exception::USER_JWT_AND_COOKIE_SET); @@ -300,8 +300,8 @@ return function (Container $container): void { } } - $accountKey = $request->getHeader('x-appwrite-key', ''); - $accountKeyUserId = $request->getHeader('x-appwrite-user', ''); + $accountKey = $request->getHeaderLine('x-appwrite-key', ''); + $accountKeyUserId = $request->getHeaderLine('x-appwrite-user', ''); if (!empty($accountKeyUserId) && !empty($accountKey)) { if (!$user->isEmpty()) { @@ -329,9 +329,9 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateUserId = $request->getHeaderLine('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeaderLine('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeaderLine('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index f7a98e0f8f..982cd13088 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -387,7 +387,7 @@ return function (Container $context): void { // Get session from header for SSR clients if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { - $sessionHeader = $request->getHeader('x-appwrite-session', ''); + $sessionHeader = $request->getHeaderLine('x-appwrite-session', ''); if (! empty($sessionHeader)) { $store->decode($sessionHeader); @@ -399,7 +399,7 @@ return function (Container $context): void { if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { $response->addHeader('X-Debug-Fallback', 'true'); - $fallback = $request->getHeader('x-fallback-cookies', ''); + $fallback = $request->getHeaderLine('x-fallback-cookies', ''); $fallback = \json_decode($fallback, true); $store->decode(((is_array($fallback) && isset($fallback[$store->getKey()])) ? $fallback[$store->getKey()] : '')); } @@ -432,7 +432,7 @@ return function (Container $context): void { $user = new User([]); } - $authJWT = $request->getHeader('x-appwrite-jwt', ''); + $authJWT = $request->getHeaderLine('x-appwrite-jwt', ''); if (! empty($authJWT) && ! $project->isEmpty()) { // JWT authentication if (! $user->isEmpty()) { throw new Exception(Exception::USER_JWT_AND_COOKIE_SET); @@ -462,8 +462,8 @@ return function (Container $context): void { } // Account based on account API key - $accountKey = $request->getHeader('x-appwrite-key', ''); - $accountKeyUserId = $request->getHeader('x-appwrite-user', ''); + $accountKey = $request->getHeaderLine('x-appwrite-key', ''); + $accountKeyUserId = $request->getHeaderLine('x-appwrite-user', ''); if (! empty($accountKeyUserId) && ! empty($accountKey)) { if (! $user->isEmpty()) { throw new Exception(Exception::USER_API_KEY_AND_SESSION_SET); @@ -491,9 +491,9 @@ return function (Container $context): void { // Impersonation: if current user has impersonator capability and headers/params are set, act as another user // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateUserId = $request->getHeaderLine('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeaderLine('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeaderLine('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; @@ -525,10 +525,10 @@ return function (Container $context): void { /** @var Appwrite\Utopia\Request $request */ /** @var Utopia\Database\Database $dbForPlatform */ /** @var Utopia\Database\Document $console */ - $projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', '')); + $projectId = $request->getParam('project', $request->getHeaderLine('x-appwrite-project', '')); // Realtime channel "project" can send project=Query array if (! \is_string($projectId)) { - $projectId = $request->getHeader('x-appwrite-project', ''); + $projectId = $request->getHeaderLine('x-appwrite-project', ''); } // Backwards compatibility for new services, originally project resources @@ -920,9 +920,9 @@ return function (Container $context): void { * - 'default' => Requests for Client and Server Side * - 'admin' => Request from the Console on non-console projects */ - $mode = $request->getParam('mode', $request->getHeader('x-appwrite-mode', APP_MODE_DEFAULT)); + $mode = $request->getParam('mode', $request->getHeaderLine('x-appwrite-mode', APP_MODE_DEFAULT)); - $projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', '')); + $projectId = $request->getParam('project', $request->getHeaderLine('x-appwrite-project', '')); if (!empty($projectId) && $project->getId() !== $projectId) { $mode = APP_MODE_ADMIN; } @@ -932,7 +932,7 @@ return function (Container $context): void { $context->set('requestTimestamp', function ($request) { // TODO: Move this to the Request class itself - $timestampHeader = $request->getHeader('x-appwrite-timestamp'); + $timestampHeader = $request->getHeaderLine('x-appwrite-timestamp'); $requestTimestamp = null; if (! empty($timestampHeader)) { try { @@ -946,7 +946,7 @@ return function (Container $context): void { }, ['request']); $context->set('devKey', function (Request $request, Document $project, array $servers, Database $dbForPlatform, Authorization $authorization) { - $devKey = $request->getHeader('x-appwrite-dev-key', $request->getParam('devKey', '')); + $devKey = $request->getHeaderLine('x-appwrite-dev-key', $request->getParam('devKey', '')); // Check if given key match project's development keys $key = $project->find('secret', $devKey, 'devKeys'); @@ -972,7 +972,7 @@ return function (Container $context): void { // add sdk to key $sdkValidator = new WhiteList($servers, true); - $sdk = \strtolower($request->getHeader('x-sdk-name', 'UNKNOWN')); + $sdk = \strtolower($request->getHeaderLine('x-sdk-name', 'UNKNOWN')); if ($sdk !== 'unknown' && $sdkValidator->isValid($sdk)) { $sdks = $key->getAttribute('sdks', []); @@ -1001,7 +1001,7 @@ return function (Container $context): void { } else { $route = $utopia->match($request)?->route; $path = ! empty($route) ? $route->getPath() : $request->getURI(); - $orgHeader = $request->getHeader('x-appwrite-organization', ''); + $orgHeader = $request->getHeaderLine('x-appwrite-organization', ''); if (str_starts_with($path, '/v1/projects/:projectId')) { $uri = $request->getURI(); $pid = explode('/', $uri)[3]; @@ -1047,7 +1047,7 @@ return function (Container $context): void { } if ($allowed) { - $host = $request->getQuery('appwrite-hostname', $request->getHeader('x-appwrite-hostname', '')) ?? ''; + $host = $request->getQuery('appwrite-hostname', $request->getHeaderLine('x-appwrite-hostname', '')) ?? ''; if (! empty($host)) { return $host; } @@ -1057,7 +1057,7 @@ return function (Container $context): void { }, ['request', 'apiKey']); $context->set('apiKey', function (Request $request, Document $project, Document $team, Document $user): ?Key { - $key = $request->getHeader('x-appwrite-key'); + $key = $request->getHeaderLine('x-appwrite-key'); if (empty($key)) { return null; @@ -1065,9 +1065,9 @@ return function (Container $context): void { $key = Key::decode($project, $team, $user, $key); - $userHeader = $request->getHeader('x-appwrite-user'); - $organizationHeader = $request->getHeader('x-appwrite-organization'); - $projectHeader = $request->getHeader('x-appwrite-project'); + $userHeader = $request->getHeaderLine('x-appwrite-user'); + $organizationHeader = $request->getHeaderLine('x-appwrite-organization'); + $projectHeader = $request->getHeaderLine('x-appwrite-project'); if (! empty($key->getProjectId())) { if (empty($projectHeader) || $projectHeader !== $key->getProjectId()) { @@ -1170,7 +1170,7 @@ return function (Container $context): void { ['host' => \gethostname(), 'project' => $project->getId()] ); - $timeout = \intval($request->getHeader('x-appwrite-timeout')); + $timeout = \intval($request->getHeaderLine('x-appwrite-timeout')); if (!empty($timeout) && Http::isDevelopment()) { $database->setTimeout($timeout); } diff --git a/composer.lock b/composer.lock index e3a4a84841..7014501161 100644 --- a/composer.lock +++ b/composer.lock @@ -4106,16 +4106,16 @@ }, { "name": "utopia-php/http", - "version": "2.0.0-rc4", + "version": "2.0.0-rc5", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "0396a959c6a3be7c16b4b72283347327a75d1f92" + "reference": "ec968c1fd7a4281d8febb3ed771207be0b852b14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/0396a959c6a3be7c16b4b72283347327a75d1f92", - "reference": "0396a959c6a3be7c16b4b72283347327a75d1f92", + "url": "https://api.github.com/repos/utopia-php/http/zipball/ec968c1fd7a4281d8febb3ed771207be0b852b14", + "reference": "ec968c1fd7a4281d8febb3ed771207be0b852b14", "shasum": "" }, "require": { @@ -4156,9 +4156,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/2.0.0-rc4" + "source": "https://github.com/utopia-php/http/tree/2.0.0-rc5" }, - "time": "2026-06-02T04:17:22+00:00" + "time": "2026-06-04T13:35:09+00:00" }, { "name": "utopia-php/image", diff --git a/src/Appwrite/GraphQL/Resolvers.php b/src/Appwrite/GraphQL/Resolvers.php index ab98e6df0c..7f542346ee 100644 --- a/src/Appwrite/GraphQL/Resolvers.php +++ b/src/Appwrite/GraphQL/Resolvers.php @@ -40,8 +40,9 @@ class Resolvers ); } + // Response headers follow PSR-7: keys are lowercased and values are lists. $headers = $from->getHeaders(); - $fallbackCookies = $headers['X-Fallback-Cookies'] ?? null; + $fallbackCookies = $headers['x-fallback-cookies'] ?? null; if ($fallbackCookies === null) { return; } @@ -347,7 +348,7 @@ class Resolvers $request->addHeader('x-appwrite-source', 'graphql'); // Drop json content type so post args are used directly. - if (\str_starts_with($request->getHeader('content-type'), 'application/json')) { + if (\str_starts_with($request->getHeaderLine('content-type'), 'application/json')) { $request->removeHeader('content-type'); } diff --git a/src/Appwrite/Platform/Installer/Http/Installer/Install.php b/src/Appwrite/Platform/Installer/Http/Installer/Install.php index e7e9008e3b..a3368a75b1 100644 --- a/src/Appwrite/Platform/Installer/Http/Installer/Install.php +++ b/src/Appwrite/Platform/Installer/Http/Installer/Install.php @@ -73,7 +73,7 @@ class Install extends Action Config $config, array $paths ): void { - $acceptHeader = $request->getHeader('accept'); + $acceptHeader = $request->getHeaderLine('accept'); $wantsStream = stripos($acceptHeader, 'text/event-stream') !== false; if ($wantsStream) { diff --git a/src/Appwrite/Platform/Installer/Http/Installer/Validate.php b/src/Appwrite/Platform/Installer/Http/Installer/Validate.php index 9a2e0b4528..9b8006d971 100644 --- a/src/Appwrite/Platform/Installer/Http/Installer/Validate.php +++ b/src/Appwrite/Platform/Installer/Http/Installer/Validate.php @@ -38,7 +38,7 @@ class Validate extends Action public static function validateCsrf(Request $request): bool { $cookie = $request->getCookie(Server::CSRF_COOKIE); - $header = $request->getHeader('x-appwrite-installer-csrf'); + $header = $request->getHeaderLine('x-appwrite-installer-csrf'); return $cookie !== '' && $header !== '' && hash_equals($cookie, $header); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php index 87f6e3ee8d..3a9b59d064 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php @@ -25,7 +25,7 @@ class Timeout extends Action ->inject('request') ->inject('dbForProject') ->callback(function (Request $request, Database $dbForProject) { - $timeout = \intval($request->getHeader('x-appwrite-timeout')); + $timeout = \intval($request->getHeaderLine('x-appwrite-timeout')); if (!empty($timeout) && Http::isDevelopment()) { $dbForProject->setTimeout($timeout); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index 7094e912c5..1679a1cc64 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -166,7 +166,7 @@ class Create extends Action throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); } - $contentRange = $request->getHeader('content-range'); + $contentRange = $request->getHeaderLine('content-range'); $deploymentId = ID::unique(); $chunk = 1; $chunks = 1; @@ -175,7 +175,7 @@ class Create extends Action $start = $request->getContentRangeStart(); $end = $request->getContentRangeEnd(); $fileSize = $request->getContentRangeSize(); - $deploymentId = $request->getHeader('x-appwrite-id', $deploymentId); + $deploymentId = $request->getHeaderLine('x-appwrite-id', $deploymentId); // TODO make `end >= $fileSize` in next breaking version if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); @@ -237,7 +237,7 @@ class Create extends Action throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); } - $type = $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; try { $locks($lockKey, 600, function () use ($activate, &$chunks, $chunksUploaded, $commands, $dbForProject, $deploymentId, $deviceForFunctions, $entrypoint, $fileSize, &$function, $functionId, $path, &$metadata, $platform, $project, $publisherForBuilds, $queueForEvents, $response, $type): void { diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index d6475b4914..2d57ec5525 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -107,7 +107,7 @@ class Get extends Action ->addHeader('Content-Disposition', 'attachment; filename="' . $deploymentId . '-' . $type . '.tar.gz"'); $size = $device->getFileSize($path); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 98c9c6e345..2c2b03a204 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -517,7 +517,7 @@ class Create extends Base $execution->setAttribute('responseBody', $executionResponse['body'] ?? ''); $execution->setAttribute('responseHeaders', $headers); - $acceptTypes = \explode(', ', $request->getHeader('accept')); + $acceptTypes = \explode(', ', $request->getHeaderLine('accept')); foreach ($acceptTypes as $acceptType) { if (\str_starts_with($acceptType, 'application/json') || \str_starts_with($acceptType, 'application/*')) { $response->setContentType(Response::CONTENT_TYPE_JSON); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 6c09de8a41..601025c794 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -308,7 +308,7 @@ class Create extends Base ])); // Backwards compatibility with 1.6 behaviour - $requestFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); + $requestFormat = $request->getHeaderLine('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); if ($requestFormat && version_compare($requestFormat, '1.7.0', '<')) { // build from template $template = new Document([]); diff --git a/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php b/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php index 9b5163fdbf..9e691e4647 100644 --- a/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php +++ b/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php @@ -156,7 +156,7 @@ class Upsert extends PlatformAction if (empty($userInternalId)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to resolve valid user internal ID.'); } - $isGraphQL = $request->getHeader('x-appwrite-source') === 'graphql'; + $isGraphQL = $request->getHeaderLine('x-appwrite-source') === 'graphql'; $presenceData = [ 'userInternalId' => $userInternalId, diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 53137ff000..2ac71376ed 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -166,7 +166,7 @@ class Create extends Action throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); } - $contentRange = $request->getHeader('content-range'); + $contentRange = $request->getHeaderLine('content-range'); $deploymentId = ID::unique(); $chunk = 1; $chunks = 1; @@ -175,7 +175,7 @@ class Create extends Action $start = $request->getContentRangeStart(); $end = $request->getContentRangeEnd(); $fileSize = $request->getContentRangeSize(); - $deploymentId = $request->getHeader('x-appwrite-id', $deploymentId); + $deploymentId = $request->getHeaderLine('x-appwrite-id', $deploymentId); // TODO make `end >= $fileSize` in next breaking version if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); @@ -237,7 +237,7 @@ class Create extends Action throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); } - $type = $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; $commands = []; if (!empty($installCommand)) { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 6fbafd908b..fa84b2f22f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -100,7 +100,7 @@ class Get extends Action } $size = $device->getFileSize($path); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); $response ->setContentType('application/gzip') diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index 261f1df648..e575fbbf07 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -135,7 +135,7 @@ class Create extends Action 'status' => 'waiting', 'buildPath' => '', 'buildLogs' => '', - 'type' => $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual' + 'type' => $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual' ])); // Preview deployments for sites diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php index 11f388d3c0..c5252a299f 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -187,7 +187,7 @@ class Create extends Action $fileTmpName = (\is_array($file['tmp_name']) && isset($file['tmp_name'][0])) ? $file['tmp_name'][0] : $file['tmp_name']; $fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; - $contentRange = $request->getHeader('content-range'); + $contentRange = $request->getHeaderLine('content-range'); $fileId = $fileId === 'unique()' ? ID::unique() : $fileId; $chunk = 1; $chunks = 1; @@ -196,7 +196,7 @@ class Create extends Action $start = $request->getContentRangeStart(); $end = $request->getContentRangeEnd(); $fileSize = $request->getContentRangeSize(); - $fileId = $request->getHeader('x-appwrite-id', $fileId); + $fileId = $request->getHeaderLine('x-appwrite-id', $fileId); // TODO make `end >= $fileSize` in next breaking version if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 160fd30c37..ed02a295c8 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -128,7 +128,7 @@ class Get extends Action $size = $file->getAttribute('sizeOriginal', 0); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); $end = $request->getRangeEnd(); diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php index f069b1cc2a..2b2d23c1fa 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php @@ -119,7 +119,7 @@ class Get extends Action $size = $file->getAttribute('sizeOriginal', 0); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); $end = $request->getRangeEnd(); diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index 4ff3360eab..01e8b56fbe 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -137,7 +137,7 @@ class Get extends Action $size = $file->getAttribute('sizeOriginal', 0); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); $end = $request->getRangeEnd(); diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php index c79df05f8a..420715ddc6 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php @@ -58,11 +58,11 @@ class Create extends Action ) { $this->preprocessEvent($request); - $event = $request->getHeader('x-github-event', ''); + $event = $request->getHeaderLine('x-github-event', ''); Span::add('vcs.github.event.name', $event); $payload = $request->getRawPayload(); - $signature = $request->getHeader('x-hub-signature-256', ''); + $signature = $request->getHeaderLine('x-hub-signature-256', ''); $secretKey = System::getEnv('_APP_VCS_GITHUB_WEBHOOK_SECRET', ''); $valid = empty($secretKey) ? true : $github->validateWebhookEvent($payload, $signature, $secretKey); diff --git a/src/Appwrite/Utopia/Request.php b/src/Appwrite/Utopia/Request.php index 1070d993c8..ba832fb229 100644 --- a/src/Appwrite/Utopia/Request.php +++ b/src/Appwrite/Utopia/Request.php @@ -177,56 +177,6 @@ class Request extends UtopiaRequest return $this->route !== null; } - /** - * Get headers - * - * Method for getting all HTTP header parameters, including cookies. - * - * @return array - */ - public function getHeaders(): array - { - try { - $headers = $this->generateHeaders(); - } catch (\Throwable) { - $headers = []; - } - - if (empty($this->swoole->cookie)) { - return $headers; - } - - $cookieHeaders = []; - foreach ($this->swoole->cookie as $key => $value) { - $cookieHeaders[] = "{$key}={$value}"; - } - - if (!empty($cookieHeaders)) { - $headers['cookie'] = \implode('; ', $cookieHeaders); - } - - return $headers; - } - - /** - * Get header - * - * Method for querying HTTP header parameters. If $key is not found $default value will be returned. - * - * @param string $key - * @param string $default - * @return string - */ - public function getHeader(string $key, string $default = ''): string - { - $headers = $this->getHeaders(); - $value = $headers[$key] ?? $default; - if (\is_array($value)) { - $value = $value[0] ?? $default; - } - return \is_string($value) ? $value : $default; - } - /** * Get User Agent * @@ -237,7 +187,7 @@ class Request extends UtopiaRequest */ public function getUserAgent(string $default = ''): string { - $forwardedUserAgent = $this->getHeader('x-forwarded-user-agent'); + $forwardedUserAgent = $this->getHeaderLine('x-forwarded-user-agent'); if (!empty($forwardedUserAgent)) { $roles = $this->authorization->getRoles(); $isAppUser = $this->user?->isKey($roles) ?? false; @@ -264,7 +214,7 @@ class Request extends UtopiaRequest $params = array_intersect_key($params, array_flip($allowedParams)); } if (!isset($params['project'])) { - $params['project'] = $this->getHeader('x-appwrite-project', ''); + $params['project'] = $this->getHeaderLine('x-appwrite-project', ''); } ksort($params); return md5($this->getURI() . '*' . serialize($params) . '*' . APP_CACHE_BUSTER); diff --git a/tests/unit/Utopia/RequestTest.php b/tests/unit/Utopia/RequestTest.php index c6a082d7fc..5594a906a5 100644 --- a/tests/unit/Utopia/RequestTest.php +++ b/tests/unit/Utopia/RequestTest.php @@ -165,35 +165,26 @@ final class RequestTest extends TestCase $this->assertSame($secondRoute, $secondRequest->getRoute()); } - public function testGetHeaderReturnsStringValue(): void + public function testGetHeaderLineReturnsStringValue(): void { $this->request->addHeader('referer', 'https://example.com'); - $this->assertSame('https://example.com', $this->request->getHeader('referer')); + $this->assertSame('https://example.com', $this->request->getHeaderLine('referer')); } - public function testGetHeaderReturnsDefaultWhenMissing(): void + public function testGetHeaderLineReturnsDefaultWhenMissing(): void { - $this->assertSame('', $this->request->getHeader('referer')); - $this->assertSame('fallback', $this->request->getHeader('referer', 'fallback')); + $this->assertSame('', $this->request->getHeaderLine('referer')); + $this->assertSame('fallback', $this->request->getHeaderLine('referer', 'fallback')); } - public function testGetHeaderCoercesArrayToFirstElement(): void + public function testGetHeaderLineJoinsMultipleValues(): void { $swoole = new SwooleRequest(); $swoole->header = ['referer' => ['https://a.example', 'https://b.example']]; $request = new Request($swoole); - $this->assertSame('https://a.example', $request->getHeader('referer')); - } - - public function testGetHeaderReturnsDefaultWhenValueNotString(): void - { - $swoole = new SwooleRequest(); - $swoole->header = ['referer' => 123]; - $request = new Request($swoole); - - $this->assertSame('fallback', $request->getHeader('referer', 'fallback')); + $this->assertSame('https://a.example, https://b.example', $request->getHeaderLine('referer')); } public function testGetParamsCachesRawParamsWhenFilterThrows4xx(): void From 4870e2eb50a8ad362c5875abd6739a5e5a3ca3a8 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sun, 7 Jun 2026 23:31:17 +0100 Subject: [PATCH 092/151] fix(http): flatten PSR-7 request headers before forwarding to executor UsageTest::testCustomDomainsFunctionStats hit a 500: the function/site execution proxy forwards $request->getHeaders() to the executor as a {name: value} string map, but rc5's getHeaders() returns each header as a PSR-7 list of values. The array-valued headers broke the multipart executor request. Collapse them to single-line strings at the boundary. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/controllers/general.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 8bed6c8e03..94caf4760d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -293,7 +293,12 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $body = $swooleRequest->getContent() ?: ''; $method = $swooleRequest->server['request_method']; - $requestHeaders = $request->getHeaders(); + // getHeaders() follows PSR-7 and returns each header as a list of values; + // collapse to single-line strings for the function/site header map below. + $requestHeaders = \array_map( + static fn (array $values) => \implode(', ', $values), + $request->getHeaders() + ); if ($resource->isEmpty() || !$resource->getAttribute('enabled')) { if ($type === 'function') { @@ -400,8 +405,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $headersFiltered = []; foreach ($headers as $key => $value) { if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_REQUEST)) { - // Request headers follow PSR-7 and arrive as a list of values; collapse to a single line. - $headersFiltered[] = ['name' => $key, 'value' => \is_array($value) ? \implode(', ', $value) : $value]; + $headersFiltered[] = ['name' => $key, 'value' => $value]; } } From 47e30bda635c10a6ef6ac737cfbd7edd7a878ba4 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sun, 7 Jun 2026 23:39:39 +0100 Subject: [PATCH 093/151] fix(http): restore synthesized cookie header for request forwarding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SitesCustomServerTest::testCookieHeader regressed: removing the custom Request::getHeaders() override dropped cookie forwarding to function/site executions. Swoole parses the incoming Cookie header into its own cookie jar, so it is absent from the raw header map — the synthesized `cookie` header was load-bearing, not dead code (the allowlist only filters the stored execution metadata, while the full header map is what reaches the executor). Restore the override in PSR-7 form, rebuilding the header from rc5's getCookieParams(), and add unit tests covering the behavior. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/Appwrite/Utopia/Request.php | 26 ++++++++++++++++++++++++++ tests/unit/Utopia/RequestTest.php | 24 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/Appwrite/Utopia/Request.php b/src/Appwrite/Utopia/Request.php index ba832fb229..be23c2f211 100644 --- a/src/Appwrite/Utopia/Request.php +++ b/src/Appwrite/Utopia/Request.php @@ -177,6 +177,32 @@ class Request extends UtopiaRequest return $this->route !== null; } + /** + * Get headers + * + * Method for getting all HTTP headers, including a synthesized `cookie` + * header. Swoole parses the incoming Cookie header into its own cookie jar, + * so it is absent from the raw header map; rebuild it here so consumers that + * forward request headers (e.g. function/site executions) still receive it. + * + * @return array> + */ + public function getHeaders(): array + { + $headers = parent::getHeaders(); + + $cookies = $this->getCookieParams(); + if (!empty($cookies)) { + $pairs = []; + foreach ($cookies as $key => $value) { + $pairs[] = "{$key}={$value}"; + } + $headers['cookie'] = [\implode('; ', $pairs)]; + } + + return $headers; + } + /** * Get User Agent * diff --git a/tests/unit/Utopia/RequestTest.php b/tests/unit/Utopia/RequestTest.php index 5594a906a5..476c5e232f 100644 --- a/tests/unit/Utopia/RequestTest.php +++ b/tests/unit/Utopia/RequestTest.php @@ -187,6 +187,30 @@ final class RequestTest extends TestCase $this->assertSame('https://a.example, https://b.example', $request->getHeaderLine('referer')); } + public function testGetHeadersSynthesizesCookieHeaderFromCookieJar(): void + { + // Swoole parses the Cookie header into its cookie jar, so getHeaders() + // must rebuild it for consumers that forward request headers onward + // (e.g. function/site executions). + $swoole = new SwooleRequest(); + $swoole->header = ['host' => 'example.com']; + $swoole->cookie = ['custom-session-id' => 'abcd123', 'custom-user-id' => 'efgh456']; + $request = new Request($swoole); + + $headers = $request->getHeaders(); + + $this->assertSame(['custom-session-id=abcd123; custom-user-id=efgh456'], $headers['cookie']); + } + + public function testGetHeadersOmitsCookieHeaderWhenNoCookies(): void + { + $swoole = new SwooleRequest(); + $swoole->header = ['host' => 'example.com']; + $request = new Request($swoole); + + $this->assertArrayNotHasKey('cookie', $request->getHeaders()); + } + public function testGetParamsCachesRawParamsWhenFilterThrows4xx(): void { /* From 47e60535fb4669230167826ca5b86cd1dee0cc9e Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 10 Jun 2026 10:23:50 +0100 Subject: [PATCH 094/151] Purge project cache after project settings updates --- app/controllers/api/projects.php | 3 +++ .../Modules/Project/Http/Project/AuthMethods/Update.php | 1 + .../Platform/Modules/Project/Http/Project/Labels/Update.php | 1 + .../Modules/Project/Http/Project/MockPhone/Create.php | 1 + .../Modules/Project/Http/Project/MockPhone/Delete.php | 1 + .../Modules/Project/Http/Project/MockPhone/Update.php | 1 + .../Platform/Modules/Project/Http/Project/OAuth2/Base.php | 5 ++++- .../Http/Project/Policies/MembershipPrivacy/Update.php | 1 + .../Http/Project/Policies/PasswordDictionary/Update.php | 1 + .../Project/Http/Project/Policies/PasswordHistory/Update.php | 1 + .../Http/Project/Policies/PasswordPersonalData/Update.php | 1 + .../Http/Project/Policies/PasswordStrength/Update.php | 1 + .../Project/Http/Project/Policies/SessionAlert/Update.php | 1 + .../Project/Http/Project/Policies/SessionDuration/Update.php | 1 + .../Http/Project/Policies/SessionInvalidation/Update.php | 1 + .../Project/Http/Project/Policies/SessionLimit/Update.php | 1 + .../Project/Http/Project/Policies/UserLimit/Update.php | 1 + .../Modules/Project/Http/Project/Protocols/Update.php | 1 + .../Platform/Modules/Project/Http/Project/SMTP/Update.php | 1 + .../Modules/Project/Http/Project/Services/Update.php | 1 + .../Modules/Project/Http/Project/Templates/Email/Update.php | 1 + 21 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 8ab30fac99..8244c05fc5 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -59,6 +59,7 @@ Http::patch('/v1/projects/:projectId/oauth2') } $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project->setAttribute('oAuthProviders', $providers)); + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->dynamic($project, Response::MODEL_PROJECT); }); @@ -93,6 +94,7 @@ Http::patch('/v1/projects/:projectId/auth/mock-numbers') $auths['mockNumbers'] = $numbers; $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project->setAttribute('auths', $auths)); + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->dynamic($project, Response::MODEL_PROJECT); }); @@ -120,6 +122,7 @@ Http::delete('/v1/projects/:projectId/templates/email') unset($templates['email.' . $type . '-' . $locale]); $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project->setAttribute('templates', $templates)); + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->noContent(); }); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php index e98d3141f6..f5f0ae0a32 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php @@ -82,6 +82,7 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('methodId', $methodId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php index 8a3506eb13..76c47a32f8 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php @@ -71,6 +71,7 @@ class Update extends Action $labels = (array) \array_values(\array_unique($labels)); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document(['labels' => $labels]))); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php index f4002c60ef..759dd931c0 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php @@ -101,6 +101,7 @@ class Create extends Action ]); $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php index 0fb23e1764..f65a955b3d 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php @@ -95,6 +95,7 @@ class Delete extends Action ]); $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php index 48b90a1b97..f2b618c39e 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php @@ -97,6 +97,7 @@ class Update extends Action ]); $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php index b5b8cacb73..b439e7fdf7 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php @@ -425,7 +425,10 @@ abstract class Base extends Action 'oAuthProviders' => $oAuthProviders ]); - return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); + + return $project; } public function action( diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index 5d7043fedf..b167aba794 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -103,6 +103,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php index d7ee99fbfe..d0f8882e99 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php @@ -75,6 +75,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php index 84861a19e1..be611e299f 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php @@ -83,6 +83,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php index 435f00fc39..ff7819f192 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php @@ -76,6 +76,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php index 3fbcbe8b30..0f8c566511 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php @@ -103,6 +103,7 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php index 79653d46ad..d930fd89e7 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php @@ -75,6 +75,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php index 0a7f33218a..10eabb57cd 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php @@ -75,6 +75,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php index a1feb67346..d4d87edbba 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php @@ -75,6 +75,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php index 936a541249..93ae339b79 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php @@ -81,6 +81,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php index 2b7e704853..b3f430b779 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php @@ -81,6 +81,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php index bfc73802c8..e0e4477a3c 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php @@ -79,6 +79,7 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'apis' => $protocols, ]))); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('protocolId', $protocolId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index bf513f5dac..dd8a469d26 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -170,6 +170,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index 518eeb4c36..86ef67bb01 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -79,6 +79,7 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'services' => $services, ]))); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('serviceId', $serviceId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php index c8ec04bc76..8186931c5f 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php @@ -129,6 +129,7 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); + $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('templateId', $templateId); From e638394e1da050c641eaec748be9dcc4d1ac13a4 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 10 Jun 2026 10:51:17 +0100 Subject: [PATCH 095/151] Revert "Purge project cache after project settings updates" This reverts commit 47e60535fb4669230167826ca5b86cd1dee0cc9e. --- app/controllers/api/projects.php | 3 --- .../Modules/Project/Http/Project/AuthMethods/Update.php | 1 - .../Platform/Modules/Project/Http/Project/Labels/Update.php | 1 - .../Modules/Project/Http/Project/MockPhone/Create.php | 1 - .../Modules/Project/Http/Project/MockPhone/Delete.php | 1 - .../Modules/Project/Http/Project/MockPhone/Update.php | 1 - .../Platform/Modules/Project/Http/Project/OAuth2/Base.php | 5 +---- .../Http/Project/Policies/MembershipPrivacy/Update.php | 1 - .../Http/Project/Policies/PasswordDictionary/Update.php | 1 - .../Project/Http/Project/Policies/PasswordHistory/Update.php | 1 - .../Http/Project/Policies/PasswordPersonalData/Update.php | 1 - .../Http/Project/Policies/PasswordStrength/Update.php | 1 - .../Project/Http/Project/Policies/SessionAlert/Update.php | 1 - .../Project/Http/Project/Policies/SessionDuration/Update.php | 1 - .../Http/Project/Policies/SessionInvalidation/Update.php | 1 - .../Project/Http/Project/Policies/SessionLimit/Update.php | 1 - .../Project/Http/Project/Policies/UserLimit/Update.php | 1 - .../Modules/Project/Http/Project/Protocols/Update.php | 1 - .../Platform/Modules/Project/Http/Project/SMTP/Update.php | 1 - .../Modules/Project/Http/Project/Services/Update.php | 1 - .../Modules/Project/Http/Project/Templates/Email/Update.php | 1 - 21 files changed, 1 insertion(+), 26 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 8244c05fc5..8ab30fac99 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -59,7 +59,6 @@ Http::patch('/v1/projects/:projectId/oauth2') } $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project->setAttribute('oAuthProviders', $providers)); - $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->dynamic($project, Response::MODEL_PROJECT); }); @@ -94,7 +93,6 @@ Http::patch('/v1/projects/:projectId/auth/mock-numbers') $auths['mockNumbers'] = $numbers; $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project->setAttribute('auths', $auths)); - $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->dynamic($project, Response::MODEL_PROJECT); }); @@ -122,7 +120,6 @@ Http::delete('/v1/projects/:projectId/templates/email') unset($templates['email.' . $type . '-' . $locale]); $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project->setAttribute('templates', $templates)); - $dbForPlatform->purgeCachedDocument('projects', $project->getId()); $response->noContent(); }); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php index f5f0ae0a32..e98d3141f6 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php @@ -82,7 +82,6 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('methodId', $methodId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php index 76c47a32f8..8a3506eb13 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php @@ -71,7 +71,6 @@ class Update extends Action $labels = (array) \array_values(\array_unique($labels)); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document(['labels' => $labels]))); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php index 759dd931c0..f4002c60ef 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php @@ -101,7 +101,6 @@ class Create extends Action ]); $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php index f65a955b3d..0fb23e1764 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php @@ -95,7 +95,6 @@ class Delete extends Action ]); $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php index f2b618c39e..48b90a1b97 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php @@ -97,7 +97,6 @@ class Update extends Action ]); $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('number', $number); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php index b439e7fdf7..b5b8cacb73 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php @@ -425,10 +425,7 @@ abstract class Base extends Action 'oAuthProviders' => $oAuthProviders ]); - $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); - - return $project; + return $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index b167aba794..5d7043fedf 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -103,7 +103,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php index d0f8882e99..d7ee99fbfe 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php @@ -75,7 +75,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php index be611e299f..84861a19e1 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php @@ -83,7 +83,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php index ff7819f192..435f00fc39 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php @@ -76,7 +76,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php index 0f8c566511..3fbcbe8b30 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php @@ -103,7 +103,6 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'auths' => $auths, ]))); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php index d930fd89e7..79653d46ad 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php @@ -75,7 +75,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php index 10eabb57cd..0a7f33218a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php @@ -75,7 +75,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php index d4d87edbba..a1feb67346 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php @@ -75,7 +75,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php index 93ae339b79..936a541249 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php @@ -81,7 +81,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php index b3f430b779..2b7e704853 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php @@ -81,7 +81,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents ->setParam('projectId', $project->getId()) diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php index e0e4477a3c..bfc73802c8 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php @@ -79,7 +79,6 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'apis' => $protocols, ]))); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('protocolId', $protocolId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index dd8a469d26..bf513f5dac 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -170,7 +170,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $response->dynamic($project, Response::MODEL_PROJECT); } diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index 86ef67bb01..518eeb4c36 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -79,7 +79,6 @@ class Update extends Action $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'services' => $services, ]))); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('serviceId', $serviceId); diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php index 8186931c5f..c8ec04bc76 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php @@ -129,7 +129,6 @@ class Update extends Action ]); $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $updates)); - $authorization->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); $queueForEvents->setParam('templateId', $templateId); From a03af216531834b481bc8117505e98d63ed12a1f Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Wed, 10 Jun 2026 12:34:12 +0100 Subject: [PATCH 096/151] Fix lock test Redis connection --- tests/unit/Locking/LockTest.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/unit/Locking/LockTest.php b/tests/unit/Locking/LockTest.php index b6fcfba4d2..4a0436acb3 100644 --- a/tests/unit/Locking/LockTest.php +++ b/tests/unit/Locking/LockTest.php @@ -11,6 +11,7 @@ use Redis; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\DSN\DSN; use Utopia\Logger\Log; use Utopia\Telemetry\Adapter\None as NoTelemetry; @@ -34,8 +35,7 @@ final class LockTest extends TestCase protected function setUp(): void { - $host = \getenv('_APP_REDIS_HOST') ?: 'redis'; - $port = (int) (\getenv('_APP_REDIS_PORT') ?: 6379); + [$host, $port] = $this->getRedisConnection(); $this->redis = new Redis(); $this->redis->connect($host, $port, 1.0); @@ -50,6 +50,27 @@ final class LockTest extends TestCase $this->cleanupKeys(); } + /** + * @return array{0: string, 1: int} + */ + private function getRedisConnection(): array + { + $dsn = \getenv('_APP_CONNECTIONS_CACHE') ?: ''; + + if ($dsn !== '') { + $dsn = \explode(',', $dsn, 2)[0]; + $dsn = \explode('=', $dsn, 2)[1] ?? $dsn; + $parsed = new DSN($dsn); + + return [$parsed->getHost(), (int) ($parsed->getPort() ?? '6379')]; + } + + return [ + \getenv('_APP_REDIS_HOST') ?: 'redis', + (int) (\getenv('_APP_REDIS_PORT') ?: 6379), + ]; + } + protected function tearDown(): void { if (isset($this->redis) && $this->redis->isConnected()) { From 5453271705d896c80a84bdf1eb03bd1bed63f8d6 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 11 Jun 2026 10:46:24 +0530 Subject: [PATCH 097/151] Fix OpenAPI 3 spec generation parity with Swagger 2 (#12564) The OpenAPI 3 format generator dropped or diverged on several pieces of information that the Swagger 2 generator emits, so SDKs generated from the OpenAPI 3 specs differed from those generated from Swagger 2: - Deduplicate x-appwrite platforms with array_unique - Merge Method additionalParameters into route params (GraphQL routes lost their query/variables body parameters) - Emit the default {} for JSON/Assoc parameters on the schema - Always emit x-enum-keys for string whitelist enums, mirroring Swagger 2 - Emit response content for binary (Image/File) and redirect responses so the produced content type is preserved - Keep the produced content type in x-appwrite.produces when no response declares content (e.g. 204-only methods), and align the No content description with Swagger 2 for 204/301/302/308 - Mirror Swagger 2 for json model rules: keep additionalProperties: true (previously overwritten), skip nullable, and emit type object even for array json rules Verified by generating all SDKs from both spec formats across the console, client and server platforms: output is now byte-identical. --- .../SDK/Specification/Format/OpenAPI3.php | 79 +++++++--- tests/unit/SDK/Specification/FormatTest.php | 143 ++++++++++++++++++ 2 files changed, 201 insertions(+), 21 deletions(-) diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index b53f0b32e5..38f81bca69 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -129,6 +129,7 @@ class OpenAPI3 extends Format $specs = new Specs(); $sdkPlatforms = $specs->getSDKPlatformsForRouteSecurity($routeSecurity); + $sdkPlatforms = array_values(array_unique($sdkPlatforms)); $namespace = $sdk->getNamespace(); $descContents = $this->getDescriptionContents($desc); @@ -323,6 +324,17 @@ class OpenAPI3 extends Format 'image/bmp', ]) ? 'Image' : 'File', ]; + + if ($produces !== '') { + $temp['responses'][(string)$response->getCode()]['content'] = [ + $produces => [ + 'schema' => [ + 'type' => 'string', + 'format' => 'binary', + ], + ], + ]; + } } else { if (\is_array($model)) { $modelDescription = \join(', or ', \array_map(fn ($m) => $m->getName(), $model)); @@ -359,12 +371,29 @@ class OpenAPI3 extends Format } } - if ($response->getCode() === 204) { + if (in_array($response->getCode(), [204, 301, 302, 308], true)) { $temp['responses'][(string)$response->getCode()]['description'] = 'No content'; + } + + if ($response->getCode() === 204) { unset($temp['responses'][(string)$response->getCode()]['content']); } } + // No response declares content (e.g. 204 No content): keep the produced + // content type available for SDK generation. + $hasResponseContent = false; + foreach ($temp['responses'] as $responseData) { + if (isset($responseData['content'])) { + $hasResponseContent = true; + break; + } + } + + if (!$hasResponseContent && $produces !== '') { + $temp['x-appwrite']['produces'] = [$produces]; + } + if (!empty($scope)) { $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; @@ -402,7 +431,12 @@ class OpenAPI3 extends Format $bodyRequired = []; - foreach ($route->getParams() as $name => $param) { // Set params + $parameters = \array_merge( + $route->getParams(), + $sdk->getAdditionalParameters(), + ); + + foreach ($parameters as $name => $param) { // Set params if (($param['deprecated'] ?? false) === true) { continue; } @@ -548,8 +582,8 @@ class OpenAPI3 extends Format break; case \Utopia\Validator\JSON::class: case \Utopia\Validator\Assoc::class: - $param['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; $node['schema']['type'] = 'object'; + $node['schema']['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; $node['schema']['x-example'] = ($param['example'] ?? '') ?: '{}'; break; case \Utopia\Storage\Validator\File::class: @@ -679,19 +713,15 @@ class OpenAPI3 extends Format } $enumKeys = []; - if (!empty($enum->map)) { - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } + foreach ($enumValues as $enumValue) { + $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; } $node['schema']['items']['enum'] = $enumValues; if (!empty($enum->name)) { $node['schema']['items']['x-enum-name'] = $enum->name; } - if (!empty($enumKeys)) { - $node['schema']['items']['x-enum-keys'] = $enumKeys; - } + $node['schema']['items']['x-enum-keys'] = $enumKeys; } } if ($validator->getType() === 'integer') { @@ -720,19 +750,15 @@ class OpenAPI3 extends Format } $enumKeys = []; - if (!empty($enum->map)) { - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } + foreach ($enumValues as $enumValue) { + $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; } $node['schema']['enum'] = $enumValues; if (!empty($enum->name)) { $node['schema']['x-enum-name'] = $enum->name; } - if (!empty($enumKeys)) { - $node['schema']['x-enum-keys'] = $enumKeys; - } + $node['schema']['x-enum-keys'] = $enumKeys; } } if ($validator->getType() === 'integer') { @@ -829,9 +855,7 @@ class OpenAPI3 extends Format /// If the enum flag is Set, add the enum values to the body $body['content'][$consumes[0]]['schema']['properties'][$name]['enum'] = $node['schema']['enum']; $body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-name'] = $node['schema']['x-enum-name'] ?? null; - if (isset($node['schema']['x-enum-keys'])) { - $body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-keys'] = $node['schema']['x-enum-keys']; - } + $body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-keys'] = $node['schema']['x-enum-keys']; } if ($node['schema']['x-upload-id'] ?? false) { @@ -930,7 +954,6 @@ class OpenAPI3 extends Format case 'json': $type = 'object'; - $output['components']['schemas'][$model->getType()]['properties'][$name]['additionalProperties'] = true; break; case 'array': @@ -996,6 +1019,20 @@ class OpenAPI3 extends Format } $readOnly = $rule['readOnly'] ?? false; + if ($rule['type'] == 'json') { + $output['components']['schemas'][$model->getType()]['properties'][$name] = [ + 'type' => $type, + 'additionalProperties' => true, + 'description' => $rule['description'] ?? '', + 'x-example' => $rule['example'] ?? null, + ]; + + if ($readOnly) { + $output['components']['schemas'][$model->getType()]['properties'][$name]['readOnly'] = true; + } + continue; + } + if ($rule['array']) { $output['components']['schemas'][$model->getType()]['properties'][$name] = [ 'type' => 'array', diff --git a/tests/unit/SDK/Specification/FormatTest.php b/tests/unit/SDK/Specification/FormatTest.php index 11f9c0d7f6..c70674cec6 100644 --- a/tests/unit/SDK/Specification/FormatTest.php +++ b/tests/unit/SDK/Specification/FormatTest.php @@ -2,6 +2,7 @@ namespace Tests\Unit\SDK\Specification; +use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\SDK\Specification\Format; @@ -20,6 +21,7 @@ use Appwrite\Utopia\Response\Model\AlgoSha; use Appwrite\Utopia\Response\Model\AttributeLine; use Appwrite\Utopia\Response\Model\Error as ErrorModel; use Appwrite\Utopia\Response\Model\HealthStatus; +use Appwrite\Utopia\Response\Model\None as NoneModel; use Appwrite\Utopia\Response\Model\PlatformAndroid; use Appwrite\Utopia\Response\Model\PlatformApple; use Appwrite\Utopia\Response\Model\PlatformLinux; @@ -27,6 +29,7 @@ use Appwrite\Utopia\Response\Model\PlatformList; use Appwrite\Utopia\Response\Model\PlatformWeb; use Appwrite\Utopia\Response\Model\PlatformWindows; use Appwrite\Utopia\Response\Model\Preferences; +use Appwrite\Utopia\Response\Model\Provider; use Appwrite\Utopia\Response\Model\Team; use Appwrite\Utopia\Response\Model\User; use Appwrite\Utopia\Response\Model\Webhook; @@ -35,6 +38,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Spatial; use Utopia\DI\Container; use Utopia\Http\Route; +use Utopia\Validator\JSON; use Utopia\Validator\Nullable; use Utopia\Validator\Text; @@ -383,4 +387,143 @@ final class FormatTest extends TestCase $this->assertArrayNotHasKey('format', $swaggerProperties['name']); $this->assertSame('password', $swagger['definitions']['webhook']['properties']['authPassword']['format']); } + + public function testNoContentMethodsKeepProducesMetadata(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('DELETE', '/v1/tests/:testId')) + ->desc('Delete test') + ->label('scope', 'tests.write') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'deleteTest', + description: 'Delete test.', + auth: [], + responses: [ + new SDKResponse( + code: 204, + model: Response::MODEL_NONE, + ), + ], + )) + ->param('testId', '', new Text(256), 'Test ID.'); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); + + $openApiMethod = $openApi['paths']['/tests/{testId}']['delete']; + + $this->assertArrayNotHasKey('content', $openApiMethod['responses']['204']); + $this->assertSame(['application/json'], $openApiMethod['x-appwrite']['produces']); + $this->assertSame(['application/json'], $swagger['paths']['/tests/{testId}']['delete']['produces']); + } + + public function testBinaryResponsesEmitResponseContent(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/icon')) + ->desc('Get test icon') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getTestIcon', + description: 'Get test icon.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_NONE, + ), + ], + contentType: ContentType::IMAGE_PNG, + )); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); + + $openApiMethod = $openApi['paths']['/tests/icon']['get']; + + $this->assertSame( + ['type' => 'string', 'format' => 'binary'], + $openApiMethod['responses']['200']['content']['image/png']['schema'] + ); + $this->assertArrayNotHasKey('produces', $openApiMethod['x-appwrite']); + $this->assertSame(['image/png'], $swagger['paths']['/tests/icon']['get']['produces']); + } + + public function testAdditionalParametersAreIncludedInRequestBody(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('POST', '/v1/tests/graphql')) + ->desc('GraphQL test endpoint') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'queryTest', + description: 'GraphQL test endpoint.', + auth: [], + responses: [], + additionalParameters: [ + 'query' => [ + 'default' => [], + 'validator' => new JSON(), + 'description' => 'The query or queries to execute.', + 'optional' => false, + ], + ], + )); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + + $openApiQuery = $openApi['paths']['/tests/graphql']['post']['requestBody']['content']['application/json']['schema']['properties']['query']; + $swaggerQuery = $swagger['paths']['/tests/graphql']['post']['parameters'][0]['schema']['properties']['query']; + + $this->assertSame('object', $openApiQuery['type']); + $this->assertEquals($swaggerQuery, $openApiQuery); + } + + public function testJsonModelRulesKeepAdditionalPropertiesAndSkipNullable(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/provider')) + ->desc('Get test provider') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getTestProvider', + description: 'Get test provider.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_PROVIDER, + ), + ], + )); + + $models = [ + new Provider(), + new ErrorModel(), + ]; + + $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + $swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + + $openApiOptions = $openApi['components']['schemas']['provider']['properties']['options']; + $swaggerOptions = $swagger['definitions']['provider']['properties']['options']; + + $this->assertTrue($openApiOptions['additionalProperties']); + $this->assertArrayNotHasKey('nullable', $openApiOptions); + $this->assertEquals($swaggerOptions, $openApiOptions); + } } From ab0d9b2ba85d1d656eb28eee13f604fe0cb9cd5f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 11 Jun 2026 12:41:53 +0530 Subject: [PATCH 098/151] Generate SDKs and specs from OpenAPI 3 only (#12565) Update appwrite/sdk-generator to ^2.0, where OpenAPI 3 is the native spec parsing pipeline, and remove Swagger 2 spec generation entirely: - The sdks task generates from open-api3-* spec files via the generator's OpenAPI3 parser - The specs task only emits the open-api3 format - The Swagger2 specification format class is removed; keeping two format emitters in sync was pure maintenance overhead now that nothing consumes the swagger2 output SDK examples regenerated through the new pipeline are byte-identical to the committed ones. --- composer.json | 2 +- composer.lock | 23 +- src/Appwrite/Platform/Tasks/SDKs.php | 8 +- src/Appwrite/Platform/Tasks/Specs.php | 4 +- .../SDK/Specification/Format/Swagger2.php | 1050 ----------------- tests/unit/SDK/Specification/FormatTest.php | 40 +- 6 files changed, 19 insertions(+), 1108 deletions(-) delete mode 100644 src/Appwrite/SDK/Specification/Format/Swagger2.php diff --git a/composer.json b/composer.json index 3d8f3b4bf1..0e45b48ffe 100644 --- a/composer.json +++ b/composer.json @@ -108,7 +108,7 @@ ], "require-dev": { "ext-fileinfo": "*", - "appwrite/sdk-generator": "*", + "appwrite/sdk-generator": "^2.0", "brianium/paratest": "7.*", "phpunit/phpunit": "12.*", "swoole/ide-helper": "6.*", diff --git a/composer.lock b/composer.lock index 80ff9265c9..5fb89d8d4c 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": "1cc46b6b8e657c29ee41fd975a2033f8", + "content-hash": "9f9908fb48b239cd403e78fb9e1cdbb8", "packages": [ { "name": "adhocore/jwt", @@ -5398,16 +5398,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.32.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "7ec48fd30746e9fbc3a9bd7d3af8052acf400ff8" + "reference": "60a2e804c1464494d763e5ff6bfff9b188502253" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7ec48fd30746e9fbc3a9bd7d3af8052acf400ff8", - "reference": "7ec48fd30746e9fbc3a9bd7d3af8052acf400ff8", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/60a2e804c1464494d763e5ff6bfff9b188502253", + "reference": "60a2e804c1464494d763e5ff6bfff9b188502253", "shasum": "" }, "require": { @@ -5415,19 +5415,20 @@ "ext-json": "*", "ext-mbstring": "*", "matthiasmullie/minify": "1.3.*", - "php": ">=8.3", + "php": ">=8.5", "twig/twig": "3.27.*" }, "require-dev": { "brianium/paratest": "7.*", "phpunit/phpunit": "11.*", + "rector/rector": "^2.4", "squizlabs/php_codesniffer": "3.*" }, "type": "library", "autoload": { "psr-4": { - "Appwrite\\SDK\\": "src/SDK", - "Appwrite\\Spec\\": "src/Spec" + "Appwrite\\SDK\\": "src/SDK/", + "Appwrite\\Spec\\": "src/Spec/" } }, "notification-url": "https://packagist.org/downloads/", @@ -5440,12 +5441,12 @@ "email": "eldad@appwrite.io" } ], - "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", + "description": "SDK generator for Appwrite APIs across multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.32.0" + "source": "https://github.com/appwrite/sdk-generator/tree/2.0.0" }, - "time": "2026-06-03T08:49:57+00:00" + "time": "2026-06-11T05:54:24+00:00" }, { "name": "brianium/paratest", diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 69e1828a66..b3802b8eac 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -27,8 +27,8 @@ use Appwrite\SDK\Language\Swift; use Appwrite\SDK\Language\Unity; use Appwrite\SDK\Language\Web; use Appwrite\SDK\SDK; +use Appwrite\Spec\OpenAPI3; use Appwrite\Spec\StaticSpec; -use Appwrite\Spec\Swagger2; use CzProject\GitPhp\Git; use Utopia\Agents\Adapters\OpenAI; use Utopia\Agents\DiffCheck\DiffCheck; @@ -302,14 +302,14 @@ class SDKs extends Action } Console::info("━━━ {$language['name']} SDK ({$platform['name']}, {$version}) ━━━"); - $specFormat = $language['spec'] ?? 'swagger2'; + $specFormat = $language['spec'] ?? 'openapi3'; $spec = null; if ($specFormat === 'static') { Console::log(' Using static SDK spec...'); } else { Console::log(' Fetching API spec...'); - $specPath = __DIR__ . '/../../../../app/config/specs/swagger2-' . $version . '-' . $language['family'] . '.json'; + $specPath = __DIR__ . '/../../../../app/config/specs/open-api3-' . $version . '-' . $language['family'] . '.json'; if (!file_exists($specPath)) { throw new \Exception('Spec file not found: ' . $specPath . '. Please run "docker compose exec appwrite specs --version=' . $version . '" first to generate the specs.'); @@ -483,7 +483,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND licenseName: 'BSD-3-Clause', licenseURL: 'https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE', ) - : new Swagger2($spec) + : new OpenAPI3($spec) ); $sdk diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 4db9e99e58..bd2a03ecf0 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -6,7 +6,6 @@ use Appwrite\Network\Validator\Redirect; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Specification\Format\OpenAPI3; -use Appwrite\SDK\Specification\Format\Swagger2; use Appwrite\SDK\Specification\Specification; use Appwrite\Utopia\Request as AppwriteRequest; use Appwrite\Utopia\Response as AppwriteResponse; @@ -62,7 +61,6 @@ class Specs extends Action protected function getFormatInstance(string $format, array $arguments) { return match ($format) { - 'swagger2' => new Swagger2(...$arguments), 'open-api3' => new OpenAPI3(...$arguments), default => throw new Exception('Format not found: ' . $format) }; @@ -660,7 +658,7 @@ class Specs extends Action $platform ]; - foreach (['swagger2', 'open-api3'] as $format) { + foreach (['open-api3'] as $format) { $formatInstance = $this->getFormatInstance($format, $arguments); $specs = new Specification($formatInstance); diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php deleted file mode 100644 index 8b5bac9d5b..0000000000 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ /dev/null @@ -1,1050 +0,0 @@ - '2.0', - 'info' => [ - 'version' => $this->getParam('version'), - 'title' => $this->getParam('name'), - 'description' => $this->getParam('description'), - 'termsOfService' => $this->getParam('terms'), - 'contact' => [ - 'name' => $this->getParam('contact.name'), - 'url' => $this->getParam('contact.url'), - 'email' => $this->getParam('contact.email'), - ], - 'license' => [ - 'name' => 'BSD-3-Clause', - 'url' => 'https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE', - ], - ], - 'host' => \parse_url($this->getParam('endpoint', ''), PHP_URL_HOST), - 'x-host-docs' => \parse_url($this->getParam('endpoint.docs', ''), PHP_URL_HOST), - 'basePath' => \parse_url($this->getParam('endpoint', ''), PHP_URL_PATH), - 'schemes' => [\parse_url($this->getParam('endpoint', ''), PHP_URL_SCHEME)], - 'consumes' => ['application/json', 'multipart/form-data'], - 'produces' => ['application/json'], - 'securityDefinitions' => $this->keys, - 'paths' => [], - 'tags' => $this->services, - 'definitions' => [], - 'externalDocs' => [ - 'description' => $this->getParam('docs.description'), - 'url' => $this->getParam('docs.url'), - ], - ]; - - foreach ([ - 'Project' => '', - 'ProjectPath' => '', - 'Key' => '', - 'JWT' => '', - 'Locale' => 'en', - 'Mode' => '', - ] as $key => $demo) { - if (isset($output['securityDefinitions'][$key])) { - $output['securityDefinitions'][$key]['x-appwrite'] = \array_merge( - $output['securityDefinitions'][$key]['x-appwrite'] ?? [], - ['demo' => $demo] - ); - } - } - - $usedModels = []; - - foreach ($this->routes as $route) { - /** @var Route $route */ - $url = \str_replace('/v1', '', $route->getPath()); - - $scope = $route->getLabel('scope', ''); - - $sdk = $route->getLabel('sdk', false); - - if ($sdk === false) { - continue; - } - - $additionalMethods = null; - if (\is_array($sdk)) { - $additionalMethods = $sdk; - $sdkValues = \array_values($sdk); - /** @var Method $sdk */ - $sdk = $sdkValues[0]; - } - - $consumes = []; - if (strtoupper($route->getMethod()) !== 'GET' && strtoupper($route->getMethod()) !== 'HEAD') { - $consumes = [$sdk->getRequestType()->value]; - } - - $methodName = $sdk->getMethodName(); - - $desc = $sdk->getDescriptionFilePath() ?: $sdk->getDescription(); - $produces = ($sdk->getContentType())->value; - $routeSecurity = $sdk->getAuth(); - - $specs = new Specs(); - $sdkPlatforms = $specs->getSDKPlatformsForRouteSecurity($routeSecurity); - - $sdkPlatforms = array_values(array_unique($sdkPlatforms)); - $namespace = $sdk->getNamespace(); - - $descContents = $this->getDescriptionContents($desc); - - $temp = [ - 'summary' => $route->getDesc(), - 'operationId' => $namespace . ucfirst($methodName), - 'consumes' => [], - 'produces' => [], - 'tags' => [$namespace], - 'description' => $descContents, - 'responses' => [], - 'deprecated' => $sdk->isDeprecated(), - 'x-appwrite' => [ // Appwrite related metadata - 'method' => $methodName, - 'group' => $sdk->getGroup(), - 'cookies' => $route->getLabel('sdk.cookies', false), - 'type' => $sdk->getType()->value ?? '', - 'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodName) . '.md', - 'rate-limit' => $route->getLabel('abuse-limit', 0), - 'rate-time' => $route->getLabel('abuse-time', 3600), - 'rate-key' => $route->getLabel('abuse-key', 'url:{url},ip:{ip}'), - 'scope' => $route->getLabel('scope', ''), - 'platforms' => $sdkPlatforms, - 'packaging' => $sdk->isPackaging(), - 'public' => $sdk->isPublic(), - ], - ]; - - if ($sdk->getDescriptionFilePath() !== null) { - $temp['x-appwrite']['edit'] = 'https://github.com/appwrite/appwrite/edit/master' . $sdk->getDescription(); - } - - if ($sdk->getDeprecated()) { - $temp['x-appwrite']['deprecated'] = [ - 'since' => $sdk->getDeprecated()->getSince(), - 'replaceWith' => $sdk->getDeprecated()->getReplaceWith(), - ]; - } - - if ($produces) { - $temp['produces'][] = $produces; - } - - if (\is_array($additionalMethods) && \count($additionalMethods) > 0) { - $temp['x-appwrite']['methods'] = []; - foreach ($additionalMethods as $methodObj) { - /** @var Method $methodObj */ - $desc = $methodObj->getDescriptionFilePath(); - - $methodSecurities = $methodObj->getAuth(); - $methodSdkPlatforms = $specs->getSDKPlatformsForRouteSecurity($methodSecurities); - - if (!\in_array($this->platform, $methodSdkPlatforms)) { - continue; - } - - $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; - foreach ($methodObj->getAuth() as $security) { - /** @var AuthType $security */ - if (\array_key_exists($security->value, $this->keys)) { - $methodSecurities[$security->value] = []; - } - } - - $additionalMethod = [ - 'name' => $methodObj->getMethodName(), - 'namespace' => $methodObj->getNamespace(), - 'desc' => $methodObj->getDesc(), - 'auth' => \array_slice($methodSecurities, 0, $this->authCount), - 'parameters' => [], - 'required' => [], - 'responses' => [], - 'description' => $this->getDescriptionContents($desc), - 'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md', - 'public' => $methodObj->isPublic(), - ]; - - // add deprecation only if method has it! - if ($methodObj->getDeprecated()) { - $additionalMethod['deprecated'] = [ - 'since' => $methodObj->getDeprecated()->getSince(), - 'replaceWith' => $methodObj->getDeprecated()->getReplaceWith(), - ]; - } - - // If additional method has no parameters, inherit from route - if (empty($methodObj->getParameters())) { - foreach ($route->getParams() as $name => $param) { - $additionalMethod['parameters'][] = $name; - if (!$param['optional']) { - $additionalMethod['required'][] = $name; - } - } - } else { - // Use method's own parameters - foreach ($methodObj->getParameters() as $parameter) { - $additionalMethod['parameters'][] = $parameter->getName(); - if (!$parameter->getOptional()) { - $additionalMethod['required'][] = $parameter->getName(); - } - } - } - - foreach ($methodObj->getResponses() as $response) { - /** @var Response|array $response */ - $responseModel = $response->getModel(); - if (\is_array($responseModel)) { - foreach ($responseModel as $modelName) { - foreach ($this->models as $value) { - if ($value->getType() === $modelName) { - $usedModels[] = $modelName; - break; - } - } - } - $additionalMethod['responses'][] = [ - 'code' => $response->getCode(), - 'model' => \array_map(fn ($m) => '#/definitions/' . $m, $responseModel) - ]; - } else { - $responseData = [ - 'code' => $response->getCode(), - ]; - - // lets not assume stuff here! - if ($response->getCode() !== 204) { - $responseData['model'] = '#/definitions/' . $responseModel; - foreach ($this->models as $value) { - if ($value->getType() === $responseModel) { - $usedModels[] = $responseModel; - break; - } - } - } - - $additionalMethod['responses'][] = $responseData; - } - } - - $temp['x-appwrite']['methods'][] = $additionalMethod; - } - } - - // Handle Responses - foreach ($sdk->getResponses() as $response) { - /** @var Response $response */ - $model = $response->getModel(); - - foreach ($this->models as $value) { - if (\is_array($model)) { - $model = \array_map(fn ($m) => $m === $value->getType() ? $value : $m, $model); - } else { - if ($value->getType() === $model) { - $model = $value; - break; - } - } - } - - if (\is_string($model)) { - throw new \RuntimeException("Unresolved response model '{$model}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered."); - } - - if (\is_array($model)) { - foreach ($model as $m) { - if (\is_string($m)) { - throw new \RuntimeException("Unresolved response model '{$m}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered."); - } - } - } - - if (!(\is_array($model)) && $model->isNone()) { - if ($produces === ContentType::TEXT->value && !\in_array($response->getCode(), [204, 301, 302, 308], true)) { - $temp['responses'][(string)$response->getCode()] = [ - 'description' => 'Text', - 'schema' => [ - 'type' => 'string', - ], - ]; - - continue; - } - - $temp['responses'][(string)$response->getCode()] = [ - 'description' => in_array($produces, [ - 'image/*', - 'image/jpeg', - 'image/gif', - 'image/png', - 'image/webp', - 'image/svg-x', - 'image/x-icon', - 'image/bmp', - ]) ? 'Image' : 'File', - 'schema' => [ - 'type' => 'file' - ], - ]; - } else { - if (\is_array($model)) { - $modelDescription = \join(', or ', \array_map(fn ($m) => $m->getName(), $model)); - // model has multiple possible responses, we will use oneOf - foreach ($model as $m) { - $usedModels[] = $m->getType(); - } - $temp['responses'][(string)$response->getCode()] = [ - 'description' => $modelDescription, - 'schema' => \array_filter([ - 'x-oneOf' => \array_map(function ($m) { - return ['$ref' => '#/definitions/' . $m->getType()]; - }, $model), - 'x-discriminator' => $this->getDiscriminator($model, '#/definitions/'), - ]), - ]; - } else { - // Response definition using one type - $usedModels[] = $model->getType(); - $temp['responses'][(string)$response->getCode()] = [ - 'description' => $model->getName(), - 'schema' => [ - '$ref' => '#/definitions/' . $model->getType(), - ], - ]; - } - } - - if (in_array($response->getCode(), [204, 301, 302, 308], true)) { - $temp['responses'][(string)$response->getCode()]['description'] = 'No content'; - unset($temp['responses'][(string)$response->getCode()]['schema']); - } - } - - if (!empty($scope)) { - $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; - - foreach ($sdk->getAuth() as $security) { - if (\array_key_exists($security->value, $this->keys)) { - $securities[$security->value] = []; - } - } - - $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); - - if ($sdk->getType() === MethodType::LOCATION) { - foreach ($sdk->getLocationAuth() as $key) { - if (\array_key_exists($key, $this->keys)) { - $securities[$key] = []; - $temp['x-appwrite']['auth'][$key] = []; - } - } - } - - $temp['security'][] = $securities; - } - - $body = [ - 'name' => 'payload', - 'in' => 'body', - 'schema' => [ - 'type' => 'object', - 'properties' => [], - ], - ]; - - $bodyRequired = []; - - $parameters = \array_merge( - $route->getParams(), - $sdk->getAdditionalParameters() ?? [], - ); - - foreach ($parameters as $name => $param) { // Set params - if (($param['deprecated'] ?? false) === true) { - continue; - } - - /** @var Validator $validator */ - $validator = $this->getValidator($param); - - $isNullable = $validator instanceof Nullable; - - $parameter = $this->getRequestParameterConfig( - $param['optional'], - $isNullable, - $param['default'], - $sdk->getNamespace() . '.' . $sdk->getMethodName(), - $name, - ); - - $node = [ - 'name' => $name, - 'description' => $param['description'], - 'required' => $parameter['required'], - ]; - - if ($isNullable) { - /** @var Nullable $validator */ - $validator = $validator->getValidator(); - } - - $class = \get_class($validator); - - $base = \get_parent_class($class); - - switch ($base) { - case \Appwrite\Utopia\Database\Validator\Queries\Base::class: - $class = $base; - break; - } - - if ($class === \Utopia\Validator\AnyOf::class) { - $validator = $param['validator']->getValidators()[0]; - $class = \get_class($validator); - } - - $array = false; - if ($class === \Utopia\Validator\ArrayList::class) { - $array = true; - $subclass = \get_class($validator->getValidator()); - switch ($subclass) { - case \Appwrite\Utopia\Database\Validator\Operation::class: - case \Utopia\Validator\WhiteList::class: - $class = $subclass; - break; - } - } - - switch ($class) { - case \Utopia\Validator\Text::class: - case \Utopia\Database\Validator\UID::class: - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; - break; - case \Utopia\Validator\Boolean::class: - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: false; - break; - case \Appwrite\Utopia\Database\Validator\CustomId::class: - if ($sdk->getType() === MethodType::UPLOAD) { - $node['x-upload-id'] = true; - } - $node['type'] = $validator->getType(); - $node['x-appwrite'] = [ - 'idGenerator' => 'ID.unique', - ]; - $node['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; - break; - case \Utopia\Database\Validator\Datetime::class: - $node['type'] = $validator->getType(); - $node['format'] = 'datetime'; - $node['x-example'] = ($param['example'] ?? '') ?: Model::TYPE_DATETIME_EXAMPLE; - break; - case \Utopia\Database\Validator\Spatial::class: - /** @var Spatial $validator */ - $node['type'] = 'array'; - $node['items'] = match ($validator->getSpatialType()) { - Database::VAR_POINT => [ - 'type' => 'number', - 'format' => 'double', - ], - Database::VAR_LINESTRING => [ - 'type' => 'array', - 'items' => [ - 'type' => 'number', - 'format' => 'double', - ], - ], - Database::VAR_POLYGON => [ - 'type' => 'array', - 'items' => [ - 'type' => 'array', - 'items' => [ - 'type' => 'number', - 'format' => 'double', - ], - ], - ], - default => [ - 'type' => 'array', - 'items' => [ - 'type' => 'number', - 'format' => 'double', - ], - ], - }; - $node['x-example'] = ($param['example'] ?? '') ?: match ($validator->getSpatialType()) { - Database::VAR_POINT => '[1, 2]', - Database::VAR_LINESTRING => '[[1, 2], [3, 4], [5, 6]]', - Database::VAR_POLYGON => '[[[1, 2], [3, 4], [5, 6], [1, 2]]]', - default => '', - }; - break; - case \Utopia\Emails\Validator\Email::class: - $node['type'] = $validator->getType(); - $node['format'] = 'email'; - $node['x-example'] = ($param['example'] ?? '') ?: 'email@example.com'; - break; - case \Utopia\Validator\Host::class: - case \Utopia\Validator\URL::class: - case \Appwrite\Network\Validator\Redirect::class: - $node['type'] = $validator->getType(); - $node['format'] = 'url'; - $node['x-example'] = ($param['example'] ?? '') ?: 'https://example.com'; - break; - case \Utopia\Validator\ArrayList::class: - /** @var ArrayList $validator */ - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => $validator->getValidator()->getType(), - ]; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - case \Utopia\Validator\JSON::class: - case \Utopia\Validator\Assoc::class: - $node['type'] = 'object'; - $node['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; - $node['x-example'] = ($param['example'] ?? '') ?: '{}'; - break; - case \Utopia\Storage\Validator\File::class: - $consumes = ['multipart/form-data']; - $node['type'] = 'file'; - break; - case \Appwrite\Functions\Validator\Payload::class: - $consumes = ['multipart/form-data']; - $node['type'] = 'payload'; - break; - case \Appwrite\Utopia\Database\Validator\Queries\Base::class: - case \Utopia\Database\Validator\Queries::class: - case \Utopia\Database\Validator\Queries\Document::class: - case \Utopia\Database\Validator\Queries\Documents::class: - case \Appwrite\Utopia\Database\Validator\Queries\Branches::class: - case \Appwrite\Utopia\Database\Validator\Queries\Columns::class: - case \Appwrite\Utopia\Database\Validator\Queries\Tables::class: - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => 'string', - ]; - break; - case \Utopia\Database\Validator\Permissions::class: - $node['type'] = $validator->getType(); - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => 'string', - ]; - $node['x-example'] = ($param['example'] ?? '') ?: '["' . Permission::read(Role::any()) . '"]'; - break; - case \Utopia\Database\Validator\Roles::class: - $node['type'] = $validator->getType(); - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => 'string', - ]; - $node['x-example'] = ($param['example'] ?? '') ?: '["' . Role::any()->toString() . '"]'; - break; - case \Appwrite\Auth\Validator\Password::class: - case \Appwrite\SDK\Specification\Validator\PasswordFormat::class: - $node['type'] = $validator->getType(); - $node['format'] = 'password'; - $node['x-example'] = ($param['example'] ?? '') ?: 'password'; - break; - case \Appwrite\Auth\Validator\Phone::class: - $node['type'] = $validator->getType(); - $node['format'] = 'phone'; - $node['x-example'] = ($param['example'] ?? '') ?: '+12065550100'; - break; - case \Utopia\Validator\Range::class: - /** @var Range $validator */ - $node['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number' : $validator->getType(); - $node['format'] = $validator->getType() == Validator::TYPE_INTEGER ? 'int32' : 'float'; - $node['x-example'] = ($param['example'] ?? '') ?: $validator->getMin(); - break; - case \Utopia\Validator\Integer::class: - $node['type'] = $validator->getType(); - $node['format'] = $validator->getFormat(); - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - case \Utopia\Validator\Numeric::class: - case \Utopia\Validator\FloatValidator::class: - $node['type'] = 'number'; - $node['format'] = 'float'; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - case \Utopia\Validator\WhiteList::class: - if ($array) { - $validator = $validator->getValidator(); - - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => $validator->getType(), - ]; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - - if ($validator->getType() === 'string') { - $enum = $param['enum'] ?? null; - - if ($enum instanceof Enum) { - $enumValues = \array_values($validator->getList()); - - if (!empty($enum->exclude)) { - $keepIndices = []; - foreach ($enumValues as $index => $value) { - if (!\in_array($value, $enum->exclude, true)) { - $keepIndices[] = $index; - } - } - - $enumValues = \array_values(\array_intersect_key($enumValues, \array_flip($keepIndices))); - $node['description'] = $this->parseDescription($node['description'], $enum->exclude); - } - - $enumKeys = []; - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } - - $node['items']['enum'] = $enumValues; - if (!empty($enum->name)) { - $node['items']['x-enum-name'] = $enum->name; - } - $node['items']['x-enum-keys'] = $enumKeys; - } - } - if ($validator->getType() === 'integer') { - $node['items']['format'] = $validator->getFormat(); - } - } else { - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: $validator->getList()[0]; - - if ($validator->getType() === 'string') { - $enum = $param['enum'] ?? null; - - if ($enum instanceof Enum) { - $enumValues = \array_values($validator->getList()); - - if (!empty($enum->exclude)) { - $keepIndices = []; - foreach ($enumValues as $index => $value) { - if (!\in_array($value, $enum->exclude, true)) { - $keepIndices[] = $index; - } - } - - $enumValues = \array_values(\array_intersect_key($enumValues, \array_flip($keepIndices))); - $node['description'] = $this->parseDescription($node['description'], $enum->exclude); - } - - $enumKeys = []; - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } - - $node['enum'] = $enumValues; - if (!empty($enum->name)) { - $node['x-enum-name'] = $enum->name; - } - $node['x-enum-keys'] = $enumKeys; - } - } - if ($validator->getType() === 'integer') { - $node['format'] = $validator->getFormat(); - } - } - break; - case \Appwrite\Utopia\Database\Validator\CompoundUID::class: - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: ''; - break; - case \Appwrite\Utopia\Database\Validator\Operation::class: - if ($array) { - $validator = $validator->getValidator(); - } - - /** @var Operation $validator */ - $collectionIdKey = $validator->getCollectionIdKey(); - $documentIdKey = $validator->getDocumentIdKey(); - if ($array) { - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = ['type' => 'object']; - } else { - $node['type'] = 'object'; - } - if (empty($param['example'])) { - $example = [ - 'action' => 'create', - 'databaseId' => '', - $collectionIdKey => '<'.\strtoupper(Template::fromCamelCaseToSnake($collectionIdKey)).'>', - $documentIdKey => '<'.\strtoupper(Template::fromCamelCaseToSnake($documentIdKey)).'>', - 'data' => [ - 'name' => 'Walter O\'Brien', - ], - ]; - if ($array) { - $example = [$example]; - } - $node['x-example'] = \str_replace("\n", "\n\t", \json_encode($example, JSON_PRETTY_PRINT)); - } else { - $node['x-example'] = $param['example']; - } - break; - default: - $node['type'] = 'string'; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - } - - if ($parameter['emitDefault'] && $this->shouldEmitDefaultForSchema($param['default'], $node)) { // Param has default value - $node['default'] = $param['default']; - } - - $pathAliases = [$name, ...($param['aliases'] ?? [])]; - $pathAliasMap = \array_flip($pathAliases); - $isPathParam = false; - - foreach (\explode('/', $url) as $segment) { - if ($segment !== '' && $segment[0] === ':' && isset($pathAliasMap[\substr($segment, 1)])) { - $isPathParam = true; - break; - } - } - - if ($isPathParam) { // Param is in URL path (directly or through alias) - $node['in'] = 'path'; - $temp['parameters'][] = $node; - } elseif (\in_array($route->getMethod(), ['GET', 'DELETE'], true)) { // Param is in query - $node['in'] = 'query'; - $temp['parameters'][] = $node; - } else { // Param is in payload - if (\in_array('multipart/form-data', $consumes)) { - $node['in'] = 'formData'; - $temp['parameters'][] = $node; - - continue; - } - - if ($node['required']) { - $bodyRequired[] = $name; - } - - $body['schema']['properties'][$name] = [ - 'type' => $node['type'], - 'description' => $node['description'], - ]; - - if (\array_key_exists('default', $node)) { - $body['schema']['properties'][$name]['default'] = $node['default']; - } - - $body['schema']['properties'][$name]['x-example'] = $node['x-example'] ?? null; - - if (isset($node['format'])) { - $body['schema']['properties'][$name]['format'] = $node['format']; - } - - if (isset($node['enum'])) { - /// If the enum flag is Set, add the enum values to the body - $body['schema']['properties'][$name]['enum'] = $node['enum']; - $body['schema']['properties'][$name]['x-enum-name'] = $node['x-enum-name'] ?? null; - $body['schema']['properties'][$name]['x-enum-keys'] = $node['x-enum-keys']; - } - - if (isset($node['x-appwrite'])) { - $body['schema']['properties'][$name]['x-appwrite'] = $node['x-appwrite']; - } - - if ($parameter['nullable']) { - $body['schema']['properties'][$name]['x-nullable'] = true; - } - - if (\array_key_exists('items', $node)) { - $body['schema']['properties'][$name]['items'] = $node['items']; - } - } - - $segments = \explode('/', $url); - foreach ($segments as &$segment) { - if ($segment !== '' && $segment[0] === ':' && isset($pathAliasMap[\substr($segment, 1)])) { - $segment = '{' . $name . '}'; - } - } - unset($segment); - $url = \implode('/', $segments); - } - - if (!empty($bodyRequired)) { - $body['schema']['required'] = $bodyRequired; - } - - if (!empty($body['schema']['properties'])) { - $temp['parameters'][] = $body; - } - - $temp['consumes'] = $consumes; - - $output['paths'][$url][\strtolower($route->getMethod())] = $temp; - } - - foreach ($this->models as $model) { - $this->getNestedModels($model, $usedModels); - } - - foreach ($this->models as $model) { - if (!in_array($model->getType(), $usedModels)) { - continue; - } - - $required = $model->getRequired(); - $rules = $model->getRules(); - $examples = []; - - $output['definitions'][$model->getType()] = [ - 'description' => $model->getName(), - 'type' => 'object', - ]; - - if (!empty($rules)) { - $output['definitions'][$model->getType()]['properties'] = []; - } - - if ($model->isAny()) { - $output['definitions'][$model->getType()]['additionalProperties'] = true; - } - - if (!empty($required)) { - $output['definitions'][$model->getType()]['required'] = $required; - } - - foreach ($model->getRules() as $name => $rule) { - if (($rule['hidden'] ?? false) === true) { - continue; - } - - $type = ''; - $format = $rule['format'] ?? null; - $items = null; - - $examples[$name] = $rule['example'] ?? null; - - switch ($rule['type']) { - case 'string': - case 'datetime': - $type = 'string'; - break; - - case 'id': - $type = 'string'; - break; - - case 'enum': - $type = 'string'; - break; - - case 'json': - $type = 'object'; - break; - - case 'array': - $type = 'array'; - $items = $this->getArrayItemsSchema($rule['example'] ?? []); - break; - - case 'integer': - $type = 'integer'; - $format = $rule['format'] ?? 'int32'; - break; - - case 'float': - $type = 'number'; - $format = 'float'; - break; - - case 'double': - $type = 'number'; - $format = 'double'; - break; - - case 'boolean': - $type = 'boolean'; - break; - - case 'payload': - $type = 'payload'; - break; - - default: - $type = 'object'; - $rule['type'] = ($rule['type']) ?: 'none'; - - if (\is_array($rule['type'])) { - $resolvedModels = \array_map(function (string $type) { - foreach ($this->models as $model) { - if ($model->getType() === $type) { - return $model; - } - } - - throw new \RuntimeException("Unresolved model '{$type}'. Ensure the model is registered."); - }, $rule['type']); - $xDiscriminator = $this->getDiscriminator($resolvedModels, '#/definitions/'); - - if ($rule['array']) { - $items = \array_filter([ - 'x-anyOf' => \array_map(fn ($type) => ['$ref' => '#/definitions/' . $type], $rule['type']), - 'x-discriminator' => $xDiscriminator, - ]); - } else { - $items = \array_filter([ - 'x-oneOf' => \array_map(fn ($type) => ['$ref' => '#/definitions/' . $type], $rule['type']), - 'x-discriminator' => $xDiscriminator, - ]); - } - } else { - $items = [ - '$ref' => '#/definitions/' . $rule['type'], - ]; - } - break; - } - - $readOnly = $rule['readOnly'] ?? false; - if ($rule['type'] == 'json') { - $output['definitions'][$model->getType()]['properties'][$name] = [ - 'type' => $type, - 'additionalProperties' => true, - 'description' => $rule['description'] ?? '', - 'x-example' => $rule['example'] ?? null, - ]; - - if ($readOnly) { - $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; - } - continue; - } - - if ($rule['array']) { - $output['definitions'][$model->getType()]['properties'][$name] = [ - 'type' => 'array', - 'description' => $rule['description'] ?? '', - 'items' => [ - 'type' => $type, - ], - 'x-example' => $rule['example'] ?? null, - ]; - - if ($format) { - $output['definitions'][$model->getType()]['properties'][$name]['items']['format'] = $format; - } - if ($readOnly) { - $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; - } - } else { - $output['definitions'][$model->getType()]['properties'][$name] = [ - 'type' => $type, - 'description' => $rule['description'] ?? '', - 'x-example' => $rule['example'] ?? null, - ]; - - if ($format) { - $output['definitions'][$model->getType()]['properties'][$name]['format'] = $format; - } - if ($readOnly) { - $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; - } - } - if ($items) { - if ($rule['array'] || $rule['type'] === 'array') { - $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items; - } else { - if (isset($items['$ref'])) { - $items = ['allOf' => [$items]]; - } - /** @var array $property */ - $property = $output['definitions'][$model->getType()]['properties'][$name]; - $output['definitions'][$model->getType()]['properties'][$name] = [ - ...$property, - ...$items, - ]; - } - } - if ($rule['type'] === 'enum' && !empty($rule['enum'])) { - if ($rule['array']) { - $output['definitions'][$model->getType()]['properties'][$name]['items']['enum'] = \array_values($rule['enum']); - if (!empty($rule['enumSDKName'])) { - $output['definitions'][$model->getType()]['properties'][$name]['items']['x-enum-name'] = $rule['enumSDKName']; - } - } else { - $output['definitions'][$model->getType()]['properties'][$name]['enum'] = \array_values($rule['enum']); - if (!empty($rule['enumSDKName'])) { - $output['definitions'][$model->getType()]['properties'][$name]['x-enum-name'] = $rule['enumSDKName']; - } - } - } - if (!in_array($name, $required)) { - $output['definitions'][$model->getType()]['properties'][$name]['x-nullable'] = true; - } - } - - /** @var Any $model */ - if ($model->isAny() && !empty($model->getSampleData())) { - $examples = array_merge($examples, $model->getSampleData()); - } - - $output['definitions'][$model->getType()]['example'] = $examples; - } - - \ksort($output['paths']); - - return $output; - } -} diff --git a/tests/unit/SDK/Specification/FormatTest.php b/tests/unit/SDK/Specification/FormatTest.php index c70674cec6..0b9a472be3 100644 --- a/tests/unit/SDK/Specification/FormatTest.php +++ b/tests/unit/SDK/Specification/FormatTest.php @@ -7,7 +7,6 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\SDK\Specification\Format; use Appwrite\SDK\Specification\Format\OpenAPI3; -use Appwrite\SDK\Specification\Format\Swagger2; use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Response; @@ -155,7 +154,6 @@ final class FormatTest extends TestCase ->param('transactionId', null, new Nullable(new Text(256)), 'Transaction ID.', true); $openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], [], [], 0, 'console'))->parse(); $this->assertArrayNotHasKey('requestBody', $openApi['paths']['/tests/{testId}']['delete']); $this->assertCount(2, $openApi['paths']['/tests/{testId}']['delete']['parameters']); @@ -163,10 +161,6 @@ final class FormatTest extends TestCase $this->assertSame('transactionId', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['name']); $this->assertSame('query', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['in']); - $this->assertCount(2, $swagger['paths']['/tests/{testId}']['delete']['parameters']); - $this->assertSame('path', $swagger['paths']['/tests/{testId}']['delete']['parameters'][0]['in']); - $this->assertSame('transactionId', $swagger['paths']['/tests/{testId}']['delete']['parameters'][1]['name']); - $this->assertSame('query', $swagger['paths']['/tests/{testId}']['delete']['parameters'][1]['in']); } public function testModelReferencesDoNotEmitItemsOnObjectProperties(): void @@ -197,20 +191,14 @@ final class FormatTest extends TestCase ]; $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); $openApiPrefs = $openApi['components']['schemas']['team']['properties']['prefs']; - $swaggerPrefs = $swagger['definitions']['team']['properties']['prefs']; $this->assertArrayNotHasKey('items', $openApiPrefs); $this->assertArrayNotHasKey('error', $openApi['components']['schemas']); $this->assertSame('object', $openApiPrefs['type']); $this->assertSame([['$ref' => '#/components/schemas/preferences']], $openApiPrefs['allOf']); - $this->assertArrayNotHasKey('items', $swaggerPrefs); - $this->assertArrayNotHasKey('error', $swagger['definitions']); - $this->assertSame('object', $swaggerPrefs['type']); - $this->assertSame([['$ref' => '#/definitions/preferences']], $swaggerPrefs['allOf']); } public function testArrayItemsSchemaInfersTypesFromJsonStringExamples(): void @@ -278,10 +266,8 @@ final class FormatTest extends TestCase ]; $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); $openApiHashOptions = $openApi['components']['schemas']['user']['properties']['hashOptions']; - $swaggerHashOptions = $swagger['definitions']['user']['properties']['hashOptions']; $this->assertSame('object', $openApiHashOptions['type']); $this->assertArrayNotHasKey('items', $openApiHashOptions); @@ -290,10 +276,6 @@ final class FormatTest extends TestCase $this->assertCount(7, $openApiHashOptions['allOf'][0]['oneOf']); $this->assertSame(['$ref' => '#/components/schemas/algoArgon2'], $openApiHashOptions['allOf'][0]['oneOf'][0]); - $this->assertSame('object', $swaggerHashOptions['type']); - $this->assertArrayNotHasKey('items', $swaggerHashOptions); - $this->assertCount(7, $swaggerHashOptions['x-oneOf']); - $this->assertSame(['$ref' => '#/definitions/algoArgon2'], $swaggerHashOptions['x-oneOf'][0]); } public function testArraySchemasEmitItems(): void @@ -330,14 +312,11 @@ final class FormatTest extends TestCase )); $openApi = (new OpenAPI3(new Container(), [], [$requestRoute, $modelRoute], [new AttributeLine()], [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$requestRoute, $modelRoute], [new AttributeLine()], [], 0, 'console'))->parse(); $openApiRequestDefault = $openApi['paths']['/tests/spatial']['post']['requestBody']['content']['application/json']['schema']['properties']['default']; - $swaggerRequestDefault = $swagger['paths']['/tests/spatial']['post']['parameters'][0]['schema']['properties']['default']; $openApiModelDefault = $openApi['components']['schemas']['attributeLine']['properties']['default']; - $swaggerModelDefault = $swagger['definitions']['attributeLine']['properties']['default']; - foreach ([$openApiRequestDefault, $swaggerRequestDefault, $openApiModelDefault, $swaggerModelDefault] as $default) { + foreach ([$openApiRequestDefault, $openApiModelDefault] as $default) { $this->assertSame('array', $default['type']); $this->assertSame('array', $default['items']['type']); $this->assertSame('number', $default['items']['items']['type']); @@ -370,10 +349,8 @@ final class FormatTest extends TestCase ->param('name', '', new Text(256), 'Name.'); $openApi = (new OpenAPI3(new Container(), [], [$route], [new Webhook()], [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], [new Webhook()], [], 0, 'console'))->parse(); $openApiProperties = $openApi['paths']['/tests']['post']['requestBody']['content']['application/json']['schema']['properties']; - $swaggerProperties = $swagger['paths']['/tests']['post']['parameters'][0]['schema']['properties']; $this->assertSame('password', $openApiProperties['password']['format']); $this->assertSame('password', $openApiProperties['nullablePassword']['format']); @@ -381,11 +358,6 @@ final class FormatTest extends TestCase $this->assertArrayNotHasKey('format', $openApiProperties['name']); $this->assertSame('password', $openApi['components']['schemas']['webhook']['properties']['authPassword']['format']); - $this->assertSame('password', $swaggerProperties['password']['format']); - $this->assertSame('password', $swaggerProperties['nullablePassword']['format']); - $this->assertTrue($swaggerProperties['nullablePassword']['x-nullable']); - $this->assertArrayNotHasKey('format', $swaggerProperties['name']); - $this->assertSame('password', $swagger['definitions']['webhook']['properties']['authPassword']['format']); } public function testNoContentMethodsKeepProducesMetadata(): void @@ -412,13 +384,11 @@ final class FormatTest extends TestCase ->param('testId', '', new Text(256), 'Test ID.'); $openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); $openApiMethod = $openApi['paths']['/tests/{testId}']['delete']; $this->assertArrayNotHasKey('content', $openApiMethod['responses']['204']); $this->assertSame(['application/json'], $openApiMethod['x-appwrite']['produces']); - $this->assertSame(['application/json'], $swagger['paths']['/tests/{testId}']['delete']['produces']); } public function testBinaryResponsesEmitResponseContent(): void @@ -444,7 +414,6 @@ final class FormatTest extends TestCase )); $openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); $openApiMethod = $openApi['paths']['/tests/icon']['get']; @@ -453,7 +422,6 @@ final class FormatTest extends TestCase $openApiMethod['responses']['200']['content']['image/png']['schema'] ); $this->assertArrayNotHasKey('produces', $openApiMethod['x-appwrite']); - $this->assertSame(['image/png'], $swagger['paths']['/tests/icon']['get']['produces']); } public function testAdditionalParametersAreIncludedInRequestBody(): void @@ -481,13 +449,10 @@ final class FormatTest extends TestCase )); $openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], [], [], 0, 'console'))->parse(); $openApiQuery = $openApi['paths']['/tests/graphql']['post']['requestBody']['content']['application/json']['schema']['properties']['query']; - $swaggerQuery = $swagger['paths']['/tests/graphql']['post']['parameters'][0]['schema']['properties']['query']; $this->assertSame('object', $openApiQuery['type']); - $this->assertEquals($swaggerQuery, $openApiQuery); } public function testJsonModelRulesKeepAdditionalPropertiesAndSkipNullable(): void @@ -517,13 +482,10 @@ final class FormatTest extends TestCase ]; $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); - $swagger = (new Swagger2(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); $openApiOptions = $openApi['components']['schemas']['provider']['properties']['options']; - $swaggerOptions = $swagger['definitions']['provider']['properties']['options']; $this->assertTrue($openApiOptions['additionalProperties']); $this->assertArrayNotHasKey('nullable', $openApiOptions); - $this->assertEquals($swaggerOptions, $openApiOptions); } } From 25aa717712aaaf6a9ba0970116cec7f42203e24a Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 11 Jun 2026 14:33:11 +0530 Subject: [PATCH 099/151] added null checks --- app/realtime.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/realtime.php b/app/realtime.php index 4d638818f5..1061cd6b0d 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -1281,7 +1281,12 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ try { if (array_key_exists($connection, $realtime->connections)) { - $stats->decr($realtime->connections[$connection]['projectId'], 'connectionsTotal'); + // A connection can exist without a stored projectId (e.g. it was torn down + // before subscribing, or only carries an authorization entry), so guard every + // project-scoped bookkeeping call. $projectId is read defensively above. + if (!empty($projectId)) { + $stats->decr($projectId, 'connectionsTotal'); + } $register->get('telemetry.connectionCounter')->add(-1); $register->get('telemetry.workerClientCounter')->add(-1, $register->get('telemetry.workerAttributes')); $subscriptionsBeforeClose = \count($realtime->getSubscriptionMetadata($connection)); @@ -1289,12 +1294,12 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ $register->get('telemetry.workerSubscriptionCounter')->add(-$subscriptionsBeforeClose, $register->get('telemetry.workerAttributes')); } - $projectId = $realtime->connections[$connection]['projectId']; /** @var array $presencesById */ $presencesById = $realtime->connections[$connection]['presences'] ?? []; if ( !empty($presencesById) + && !empty($projectId) && $projectId !== 'console' ) { go(function () use ($presencesById, $projectId, $userId, $container, $presenceState): void { @@ -1385,9 +1390,11 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ }); } - triggerStats([ - METRIC_REALTIME_CONNECTIONS => -1, - ], $projectId); + if (!empty($projectId)) { + triggerStats([ + METRIC_REALTIME_CONNECTIONS => -1, + ], $projectId); + } } $success = true; } catch (\Throwable $th) { From 4584c3b83524a60dcf101ea6a50be36bf895d99b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 11 Jun 2026 22:09:07 +1200 Subject: [PATCH 100/151] Revert "Merge pull request #12062 from appwrite/distributed-lock" This reverts commit 53bc349e239270e68086feea1a95d4fe246828c8, reversing changes made to 2a5361018939bf1ca00c235d0a6367f393f890b5. # Conflicts: # composer.lock # tests/unit/Locking/LockTest.php --- app/config/errors.php | 5 - app/config/variables.php | 9 - app/controllers/general.php | 27 ++- app/controllers/shared/api.php | 32 ++-- app/init/resources/request.php | 6 - composer.json | 6 - composer.lock | 2 +- docker-compose.yml | 1 - src/Appwrite/Extend/Exception.php | 1 - src/Appwrite/Locking/Lock.php | 235 ------------------------- tests/unit/Locking/LockTest.php | 280 ------------------------------ 11 files changed, 29 insertions(+), 575 deletions(-) delete mode 100644 src/Appwrite/Locking/Lock.php delete mode 100644 tests/unit/Locking/LockTest.php diff --git a/app/config/errors.php b/app/config/errors.php index a51a83e529..a548d75179 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -54,11 +54,6 @@ return [ 'description' => 'Rate limit for the current endpoint has been exceeded. Please try again after some time.', 'code' => 429, ], - Exception::GENERAL_RESOURCE_LOCKED => [ - 'name' => Exception::GENERAL_RESOURCE_LOCKED, - 'description' => 'The requested resource is currently being modified by another request. Please retry after a brief delay.', - 'code' => 409, - ], Exception::GENERAL_SMTP_DISABLED => [ 'name' => Exception::GENERAL_SMTP_DISABLED, 'description' => 'SMTP is disabled on your Appwrite instance. You can learn more about setting up SMTP in our docs.', diff --git a/app/config/variables.php b/app/config/variables.php index 23d4eaf315..90df9b4518 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -34,15 +34,6 @@ return [ 'question' => '', 'filter' => '' ], - [ - 'name' => '_APP_LOCKING_ENABLED', - 'description' => 'Enable distributed locking for platform writes. Locks coordinate concurrent updates across API pods so that read-modify-write operations on shared documents do not lose updates. By default, set to \'enabled\'. Set to \'disabled\' as an emergency kill switch — locks become no-ops (fail-open) and concurrent writes will race.', - 'introduction' => '1.9.3', - 'default' => 'enabled', - 'required' => false, - 'question' => '', - 'filter' => '' - ], [ 'name' => '_APP_OPTIONS_FORCE_HTTPS', 'description' => 'Allows you to force HTTPS connection to your API. This feature redirects any HTTP call to HTTPS and adds the \'Strict-Transport-Security\' header to all HTTP responses. By default, set to \'enabled\'. To disable, set to \'disabled\'. This feature will work only when your ports are set to default 80 and 443, and you have set up wildcard certificates with DNS challenge.', diff --git a/app/controllers/general.php b/app/controllers/general.php index 9e26af3198..94caf4760d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -12,7 +12,6 @@ use Appwrite\Event\Message\Delete as DeleteMessage; use Appwrite\Event\Publisher\Certificate; use Appwrite\Event\Publisher\Delete as DeletePublisher; use Appwrite\Extend\Exception as AppwriteException; -use Appwrite\Locking\Lock; use Appwrite\Network\Cors; use Appwrite\Platform\Appwrite; use Appwrite\SDK\Method; @@ -76,7 +75,7 @@ use Utopia\Validator\Text; Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeletePublisher $publisherForDeletes, int $executionsRetentionCount, Lock $lock) +function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeletePublisher $publisherForDeletes, int $executionsRetentionCount) { $host = $request->getHostname(); if (!empty($previewHostname)) { @@ -145,7 +144,9 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S if (!$project->isEmpty() && $project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $lock->set('projects', $project->getId(), 'accessedAt', DateTime::now()); + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'accessedAt' => DateTime::now() + ]))); } /** @@ -839,9 +840,8 @@ Http::init() ->inject('authorization') ->inject('publisherForDeletes') ->inject('executionsRetentionCount') - ->inject('lock') ->inject('params') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount, Lock $lock, array $params) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, Event $queueForEvents, Bus $bus, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount, array $params) { /* * Appwrite Router */ @@ -849,7 +849,7 @@ Http::init() $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!\in_array($hostname, $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount, $lock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount)) { $utopia->match($request)?->route->label('router', true); } } @@ -1152,15 +1152,14 @@ Http::options() ->inject('authorization') ->inject('publisherForDeletes') ->inject('executionsRetentionCount') - ->inject('lock') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount, Lock $lock) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount) { /* * Appwrite Router */ $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount, $lock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount)) { $utopia->match($request)?->route->label('router', true); } } @@ -1555,14 +1554,13 @@ Http::get('/robots.txt') ->inject('authorization') ->inject('publisherForDeletes') ->inject('executionsRetentionCount') - ->inject('lock') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount, Lock $lock) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount, $lock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount)) { $utopia->match($request)?->route->label('router', true); } } @@ -1590,14 +1588,13 @@ Http::get('/humans.txt') ->inject('authorization') ->inject('publisherForDeletes') ->inject('executionsRetentionCount') - ->inject('lock') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount, Lock $lock) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, Bus $bus, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeletePublisher $publisherForDeletes, int $executionsRetentionCount) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount, $lock)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $bus, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $publisherForDeletes, $executionsRetentionCount)) { $utopia->match($request)?->route->label('router', true); } } diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index e11ba433ee..4b5f7170ff 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -16,7 +16,6 @@ use Appwrite\Event\Webhook; use Appwrite\Extend\Exception; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Functions\EventProcessor; -use Appwrite\Locking\Lock; use Appwrite\Platform\Modules\Storage\Config\CacheControl; use Appwrite\Platform\Modules\Storage\Config\StorageCacheControl; use Appwrite\SDK\Method; @@ -100,8 +99,7 @@ Http::init() ->inject('team') ->inject('apiKey') ->inject('authorization') - ->inject('lock') - ->action(function (Route $route, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization, Lock $lock) { + ->action(function (Route $route, Request $request, Database $dbForPlatform, Database $dbForProject, AuditContext $auditContext, Document $project, User $user, ?Document $session, array $servers, string $mode, Document $team, ?Key $apiKey, Authorization $authorization) { /** * Handle user authentication and session validation. @@ -242,22 +240,20 @@ Http::init() $sdks[] = $sdk; $updates->setAttribute('sdks', $sdks); - $updates->setAttribute('accessedAt', DateTime::now()); + $updates->setAttribute('accessedAt', Datetime::now()); } } if (! $updates->isEmpty()) { - $lock->run('keys', $dbKey->getId(), function () use ($dbForPlatform, $dbKey, $updates, $apiKey, $project, $user, $team) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->updateDocument('keys', $dbKey->getId(), $updates)); - if (! empty($apiKey->getProjectId())) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); - } elseif (! empty($apiKey->getUserId())) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('users', $user->getId())); - } elseif (! empty($apiKey->getTeamId())) { - $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('teams', $team->getId())); - } - }); + if (! empty($apiKey->getProjectId())) { + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('projects', $project->getId())); + } elseif (! empty($apiKey->getUserId())) { + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('users', $user->getId())); + } elseif (! empty($apiKey->getTeamId())) { + $dbForPlatform->getAuthorization()->skip(fn () => $dbForPlatform->purgeCachedDocument('teams', $team->getId())); + } } $userClone = clone $user; @@ -388,7 +384,9 @@ Http::init() if ($project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { - $lock->set('projects', $project->getId(), 'accessedAt', DateTime::now()); + $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'accessedAt' => DateTime::now() + ]))); } } @@ -405,7 +403,9 @@ Http::init() 'accessedAt' => $user->getAttribute('accessedAt') ])); } else { - $lock->set('users', $user->getId(), 'accessedAt', $user->getAttribute('accessedAt')); + $authorization->skip(fn () => $dbForPlatform->updateDocument('users', $user->getId(), new Document([ + 'accessedAt' => $user->getAttribute('accessedAt') + ]))); } } } diff --git a/app/init/resources/request.php b/app/init/resources/request.php index fa480034f0..982cd13088 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -14,7 +14,6 @@ use Appwrite\Event\Webhook; use Appwrite\Extend\Exception; use Appwrite\Functions\EventProcessor; use Appwrite\GraphQL\Schema; -use Appwrite\Locking\Lock; use Appwrite\Network\Cors; use Appwrite\Network\Platform; use Appwrite\Network\Validator\Origin; @@ -45,7 +44,6 @@ use Utopia\Domains\Domain; use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\Logger\Log; -use Utopia\Logger\Logger; use Utopia\Pools\Group; use Utopia\Queue\Publisher; use Utopia\Queue\Queue; @@ -67,10 +65,6 @@ return function (Container $context): void { $context->set('logger', fn ($register) => $register->get('logger'), ['register']); - $context->set('lock', function (\Redis $redis, Telemetry $telemetry, Database $dbForPlatform, Authorization $authorization, Log $log, ?Logger $logger, Document $project): Lock { - return new Lock($redis, $telemetry, $dbForPlatform, $authorization, $log, $logger, $project); - }, ['redis', 'telemetry', 'dbForPlatform', 'authorization', 'log', 'logger', 'project']); - $context->set('authorization', fn () => new Authorization(), []); $context->set('store', fn (): Store => new Store(), []); diff --git a/composer.json b/composer.json index 0e45b48ffe..de5a1ba601 100644 --- a/composer.json +++ b/composer.json @@ -100,12 +100,6 @@ "league/csv": "9.14.*", "enshrined/svg-sanitize": "0.22.*" }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/utopia-php/lock" - } - ], "require-dev": { "ext-fileinfo": "*", "appwrite/sdk-generator": "^2.0", diff --git a/composer.lock b/composer.lock index 5fb89d8d4c..91596d04e9 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": "9f9908fb48b239cd403e78fb9e1cdbb8", + "content-hash": "e922d0ba4d0c7d12cc24cff52b552803", "packages": [ { "name": "adhocore/jwt", diff --git a/docker-compose.yml b/docker-compose.yml index 3a954cebd1..212b0f1f47 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -212,7 +212,6 @@ services: - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_HOST - _APP_LOGGING_CONFIG - - _APP_LOCKING_ENABLED - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_CACHE diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 349cff11de..ca114550b7 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -45,7 +45,6 @@ class Exception extends \Exception public const string GENERAL_SERVICE_DISABLED = 'general_service_disabled'; public const string GENERAL_UNAUTHORIZED_SCOPE = 'general_unauthorized_scope'; public const string GENERAL_RATE_LIMIT_EXCEEDED = 'general_rate_limit_exceeded'; - public const string GENERAL_RESOURCE_LOCKED = 'general_resource_locked'; public const string GENERAL_SMTP_DISABLED = 'general_smtp_disabled'; public const string GENERAL_PHONE_DISABLED = 'general_phone_disabled'; public const string GENERAL_ARGUMENT_INVALID = 'general_argument_invalid'; diff --git a/src/Appwrite/Locking/Lock.php b/src/Appwrite/Locking/Lock.php deleted file mode 100644 index 9ef6d70c03..0000000000 --- a/src/Appwrite/Locking/Lock.php +++ /dev/null @@ -1,235 +0,0 @@ - */ - private static array $lastReportAt = []; - - public function __construct( - private readonly \Redis $redis, - Telemetry $telemetry, - private readonly Database $dbForPlatform, - private readonly Authorization $authorization, - private readonly Log $log, - private readonly ?Logger $logger, - Document $project, - ) { - $this->enabled = System::getEnv('_APP_LOCKING_ENABLED', 'enabled') !== 'disabled'; - $this->attempts = $telemetry->createCounter('lock.attempts', null, 'Distributed lock acquire outcomes'); - $sequence = $project->getSequence(); - $this->projectInternalId = ($sequence !== null && $sequence !== '') ? (string) $sequence : 'unknown'; - } - - /** - * Throttled single-attribute write under a per-attribute skip-on-contention - * lock with authorization bypass. For idempotent timestamp-style updates - * (accessedAt, mcpAccessedAt) where regional pods writing the same value - * would thrash the platform DB. - */ - public function set( - string $collection, - string $id, - string $attribute, - string $value, - ): void { - $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}:{$attribute}"; - $this->execute($key, $collection, function () use ($collection, $id, $attribute, $value) { - $this->authorization->skip(fn () => $this->dbForPlatform->updateDocument( - $collection, - $id, - new Document([$attribute => $value]) - )); - }); - } - - /** - * Skip-on-contention lock around an arbitrary callback for a platform - * document. For idempotent multi-statement writes that don't fit `set`. - */ - public function run(string $collection, string $id, Closure $fn): void - { - $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}"; - $this->execute($key, $collection, $fn); - } - - /** - * Block-then-409 lock around an arbitrary callback for a platform document. - * For read-modify-write endpoints where silently dropping a concurrent - * request would lose user data. - */ - public function runOrFail(string $collection, string $id, Closure $fn): mixed - { - $key = "lock:platform:{$this->projectInternalId}:{$collection}:{$id}"; - - return $this->execute($key, $collection, $fn, ttl: self::FAIL_TTL_SECONDS, orFail: true); - } - - /** - * Generic lock primitive with full control over key, TTL, contention - * behavior, and wait timeout. Escape hatch for non-platform keys - * (cache, queue, edge) and for unusual TTL/timeout requirements. - * - * Caller may pass `target` for telemetry; otherwise it's extracted by - * position from the key (best-effort for keys following the standard - * `lock:platform:{project}:{target}:...` shape). - */ - public function withKey( - string $key, - Closure $fn, - int $ttl = self::SKIP_TTL_SECONDS, - bool $orFail = false, - float $waitTimeout = self::FAIL_WAIT_SECONDS, - ?string $target = null, - ): mixed { - return $this->execute( - $key, - $target ?? self::inferTargetFromKey($key), - $fn, - ttl: $ttl, - orFail: $orFail, - waitTimeout: $waitTimeout, - ); - } - - private function execute( - string $key, - string $target, - Closure $fn, - int $ttl = self::SKIP_TTL_SECONDS, - bool $orFail = false, - float $waitTimeout = self::FAIL_WAIT_SECONDS, - ): mixed { - if (! $this->enabled) { - return $fn(); - } - - $lock = new DistributedLock($this->redis, $key, $ttl); - $labels = ['target' => $target, 'project' => $this->projectInternalId]; - - try { - $acquired = $orFail ? $lock->acquire($waitTimeout) : $lock->tryAcquire(); - } catch (\RedisException $e) { - $this->attempts->add(1, ['outcome' => self::OUTCOME_BACKEND_ERROR, ...$labels]); - $this->reportError(self::OUTCOME_BACKEND_ERROR, $key, $target, $e); - - return $fn(); - } - - if (! $acquired) { - if ($orFail) { - $this->attempts->add(1, ['outcome' => self::OUTCOME_CONTENDED, ...$labels]); - // No custom message — the lock key embeds collection + document id. - throw new Exception(Exception::GENERAL_RESOURCE_LOCKED); - } - $this->attempts->add(1, ['outcome' => self::OUTCOME_SKIPPED, ...$labels]); - - return null; - } - - $this->attempts->add(1, ['outcome' => self::OUTCOME_ACQUIRED, ...$labels]); - try { - return $fn(); - } finally { - try { - $lock->release(); - } catch (Throwable $e) { - $this->attempts->add(1, ['outcome' => self::OUTCOME_RELEASE_ERROR, ...$labels]); - $this->reportError(self::OUTCOME_RELEASE_ERROR, $key, $target, $e); - } - } - } - - /** - * Best-effort target extraction for telemetry. Assumes the standard - * `lock:platform:{project}:{target}:...` shape. For non-platform keys - * passed via withKey(), callers should pass `target` explicitly. - */ - private static function inferTargetFromKey(string $key): string - { - $parts = explode(':', $key, 5); - - return $parts[3] ?? 'unknown'; - } - - /** - * Rate-limited to one push per REPORT_RATE_LIMIT_SECONDS per (action, target) - * so a sustained backend outage doesn't flood Sentry across the pod fleet. - */ - private function reportError(string $action, string $key, string $target, Throwable $e): void - { - Console::warning("Lock {$action} for {$key}: {$e->getMessage()}"); - - if ($this->logger === null) { - return; - } - - $bucket = $action.':'.$target; - $now = time(); - if ((self::$lastReportAt[$bucket] ?? 0) + self::REPORT_RATE_LIMIT_SECONDS > $now) { - return; - } - self::$lastReportAt[$bucket] = $now; - - $this->log->setNamespace('http'); - $this->log->setServer(System::getEnv('_APP_LOGGING_SERVICE_IDENTIFIER', \gethostname())); - $this->log->setVersion(APP_VERSION_STABLE); - $this->log->setType(Log::TYPE_WARNING); - $this->log->setMessage('Distributed lock '.$action.': '.$e->getMessage()); - $this->log->setAction("lock.{$action}"); - $this->log->setEnvironment(System::getEnv('_APP_ENV', 'development') === 'production' - ? Log::ENVIRONMENT_PRODUCTION - : Log::ENVIRONMENT_STAGING); - $this->log->addTag('lock.target', $target); - $this->log->addTag('lock.project', $this->projectInternalId); - // Strip trailing document ID to keep aggregator cardinality bounded. - $this->log->addTag('lock.key_pattern', preg_replace('/:[^:]+$/', ':*', $key)); - $this->log->addTag('code', $e->getCode()); - $this->log->addExtra('file', $e->getFile()); - $this->log->addExtra('line', $e->getLine()); - $this->log->addExtra('trace', $e->getTraceAsString()); - - try { - $this->logger->addLog($this->log); - } catch (Throwable) { - } - } -} diff --git a/tests/unit/Locking/LockTest.php b/tests/unit/Locking/LockTest.php deleted file mode 100644 index 4a0436acb3..0000000000 --- a/tests/unit/Locking/LockTest.php +++ /dev/null @@ -1,280 +0,0 @@ -getRedisConnection(); - - $this->redis = new Redis(); - $this->redis->connect($host, $port, 1.0); - - $this->project = new Document([ - '$id' => 'test-project', - '$sequence' => self::PROJECT_SEQUENCE, - ]); - $this->authorization = new Authorization(); - $this->log = new Log(); - - $this->cleanupKeys(); - } - - /** - * @return array{0: string, 1: int} - */ - private function getRedisConnection(): array - { - $dsn = \getenv('_APP_CONNECTIONS_CACHE') ?: ''; - - if ($dsn !== '') { - $dsn = \explode(',', $dsn, 2)[0]; - $dsn = \explode('=', $dsn, 2)[1] ?? $dsn; - $parsed = new DSN($dsn); - - return [$parsed->getHost(), (int) ($parsed->getPort() ?? '6379')]; - } - - return [ - \getenv('_APP_REDIS_HOST') ?: 'redis', - (int) (\getenv('_APP_REDIS_PORT') ?: 6379), - ]; - } - - protected function tearDown(): void - { - if (isset($this->redis) && $this->redis->isConnected()) { - $this->cleanupKeys(); - } - } - - private function cleanupKeys(): void - { - foreach ($this->redis->keys(self::KEY_PREFIX.'*') as $key) { - $this->redis->del($key); - } - // also clean keys produced by withKey() tests - foreach ($this->redis->keys('lock:test:*') as $key) { - $this->redis->del($key); - } - } - - private function makeLock(?Database $db = null, ?Authorization $auth = null): Lock - { - return new Lock( - $this->redis, - new NoTelemetry(), - $db ?? $this->createStub(Database::class), - $auth ?? $this->authorization, - $this->log, - null, - $this->project, - ); - } - - public function test_set_uses_per_attribute_key_and_auth_skipped_update(): void - { - $captured = null; - $db = $this->createMock(Database::class); - $db->expects($this->once()) - ->method('updateDocument') - ->with('projects', 'p1', $this->callback(function (Document $doc) use (&$captured) { - $captured = $doc->getArrayCopy(); - - return true; - })) - ->willReturnArgument(2); - - $lock = $this->makeLock($db); - $lock->set('projects', 'p1', 'accessedAt', '2024-06-01 12:00:00'); - - $this->assertSame(['accessedAt' => '2024-06-01 12:00:00'], $captured); - $this->assertSame(0, $this->redis->exists(self::KEY_PREFIX.'projects:p1:accessedAt')); - } - - public function test_set_skips_on_contention(): void - { - $key = self::KEY_PREFIX.'projects:p1:accessedAt'; - $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); - - $db = $this->createMock(Database::class); - $db->expects($this->never())->method('updateDocument'); - - $lock = $this->makeLock($db); - $lock->set('projects', 'p1', 'accessedAt', '2024-06-01 12:00:00'); - - $this->assertSame('other-owner', $this->redis->get($key)); - } - - public function test_set_different_attributes_do_not_compete(): void - { - // Hold accessedAt - $heldKey = self::KEY_PREFIX.'projects:p1:accessedAt'; - $this->redis->set($heldKey, 'other-owner', ['NX', 'EX' => 30]); - - // mcpAccessedAt should still be acquirable - $db = $this->createMock(Database::class); - $db->expects($this->once()) - ->method('updateDocument') - ->with('projects', 'p1', $this->isInstanceOf(Document::class)) - ->willReturnArgument(2); - - $lock = $this->makeLock($db); - $lock->set('projects', 'p1', 'mcpAccessedAt', '2024-06-01 12:00:00'); - - $this->assertSame('other-owner', $this->redis->get($heldKey)); - } - - public function test_run_uses_per_document_key_and_invokes_callback(): void - { - $called = false; - $lock = $this->makeLock(); - $lock->run('keys', 'k1', function () use (&$called) { - $called = true; - }); - - $this->assertTrue($called); - $this->assertSame(0, $this->redis->exists(self::KEY_PREFIX.'keys:k1')); - } - - public function test_run_skips_on_contention(): void - { - $key = self::KEY_PREFIX.'keys:k1'; - $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); - - $called = false; - $lock = $this->makeLock(); - $lock->run('keys', 'k1', function () use (&$called) { - $called = true; - }); - - $this->assertFalse($called); - $this->assertSame('other-owner', $this->redis->get($key)); - } - - public function test_run_or_fail_throws_on_contention(): void - { - $key = self::KEY_PREFIX.'projects:p1'; - $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); - - $lock = $this->makeLock(); - - $this->expectException(Exception::class); - try { - $lock->runOrFail('projects', 'p1', fn () => 'never-runs'); - } catch (Exception $e) { - $this->assertSame(Exception::GENERAL_RESOURCE_LOCKED, $e->getType()); - throw $e; - } - } - - public function test_run_or_fail_returns_callback_value_when_uncontended(): void - { - $lock = $this->makeLock(); - $result = $lock->runOrFail('projects', 'p1', fn () => 'ok'); - - $this->assertSame('ok', $result); - $this->assertSame(0, $this->redis->exists(self::KEY_PREFIX.'projects:p1')); - } - - public function test_with_key_uses_raw_key(): void - { - $custom = 'lock:test:custom-key'; - $called = false; - $lock = $this->makeLock(); - $lock->withKey($custom, function () use (&$called) { - $called = true; - }); - - $this->assertTrue($called); - $this->assertSame(0, $this->redis->exists($custom)); - } - - public function test_with_key_or_fail_flag_throws_on_contention(): void - { - $custom = 'lock:test:contended'; - $this->redis->set($custom, 'other', ['NX', 'EX' => 30]); - - $lock = $this->makeLock(); - $this->expectException(Exception::class); - $lock->withKey($custom, fn () => null, ttl: 5, orFail: true, waitTimeout: 0.1); - } - - public function test_disabled_mode_runs_callback_unlocked(): void - { - $previous = \getenv('_APP_LOCKING_ENABLED'); - \putenv('_APP_LOCKING_ENABLED=disabled'); - try { - // Even when the key is already held, the callback must still run. - $key = self::KEY_PREFIX.'keys:k1'; - $this->redis->set($key, 'other-owner', ['NX', 'EX' => 30]); - - $called = false; - $lock = $this->makeLock(); - $lock->run('keys', 'k1', function () use (&$called) { - $called = true; - }); - - $this->assertTrue($called); - $this->assertSame('other-owner', $this->redis->get($key)); - } finally { - $previous === false ? \putenv('_APP_LOCKING_ENABLED') : \putenv('_APP_LOCKING_ENABLED='.$previous); - } - } - - public function test_project_without_sequence_falls_back_to_unknown(): void - { - $emptyProject = new Document(); - $lock = new Lock( - $this->redis, - new NoTelemetry(), - $this->createStub(Database::class), - $this->authorization, - $this->log, - null, - $emptyProject, - ); - - // Pre-acquire the lock at the 'unknown' projectInternalId path. - $key = 'lock:platform:unknown:keys:k1'; - $this->redis->set($key, 'held', ['NX', 'EX' => 30]); - - $called = false; - $lock->run('keys', 'k1', function () use (&$called) { - $called = true; - }); - $this->assertFalse($called, 'Lock without project sequence should hash to the unknown bucket'); - - $this->redis->del($key); - } -} From 3e5e3b6c628218b8053264f63b1dd18d0c61fbbf Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 11 Jun 2026 16:19:08 +0530 Subject: [PATCH 101/151] Refactor realtime connection handling to sanitize user data and improve telemetry metrics --- app/realtime.php | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/app/realtime.php b/app/realtime.php index 1061cd6b0d..191d2419b5 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -915,7 +915,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $channels = Realtime::convertChannels($request->getQuery('channels', []), $user->getId()); $channelCount = \count($channels); - $updateStats = static function (string $projectId, ?string $teamId, string $payloadJson) use ($register, $stats): void { + $updateStats = static function (string $projectId, ?string $teamId) use ($register, $stats): void { $register->get('telemetry.connectionCounter')->add(1); $register->get('telemetry.workerClientCounter')->add(1, $register->get('telemetry.workerAttributes')); $register->get('telemetry.connectionCreatedCounter')->add(1); @@ -929,7 +929,6 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, triggerStats([ METRIC_REALTIME_CONNECTIONS => 1, - METRIC_REALTIME_OUTBOUND => \strlen($payloadJson), ], $projectId); }; @@ -950,9 +949,12 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $realtime->subscribe($project->getId(), $connection, '', $roles, [], [], $user->getId()); $realtime->connections[$connection]['authorization'] = $authorization; + $updateStats($project->getId(), $project->getAttribute('teamId')); $server->send([$connection], $connectedPayloadJson); $outboundBytes += \strlen($connectedPayloadJson); - $updateStats($project->getId(), $project->getAttribute('teamId'), $connectedPayloadJson); + triggerStats([ + METRIC_REALTIME_OUTBOUND => \strlen($connectedPayloadJson), + ], $project->getId()); $subscriptionMode = 'message'; $success = true; return; @@ -970,6 +972,8 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, throw new Exception(Exception::REALTIME_POLICY_VIOLATION, $e->getMessage()); } + $sanitizedUser = empty($user->getId()) ? null : $response->output($user, Response::MODEL_ACCOUNT); + $mapping = []; foreach ($subscriptions as $index => $subscription) { $subscriptionId = ID::unique(); @@ -986,27 +990,29 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $mapping[$index] = $subscriptionId; } + + $realtime->connections[$connection]['authorization'] = $authorization; + $updateStats($project->getId(), $project->getAttribute('teamId')); + $subscriptionCount = \count($subscriptions); if (!empty($subscriptions)) { $register->get('telemetry.workerSubscriptionCounter')->add(\count($subscriptions), $register->get('telemetry.workerAttributes')); } - $realtime->connections[$connection]['authorization'] = $authorization; - - $user = empty($user->getId()) ? null : $response->output($user, Response::MODEL_ACCOUNT); - $connectedPayloadJson = json_encode([ 'type' => 'connected', 'data' => [ 'channels' => $names, 'subscriptions' => $mapping, - 'user' => $user + 'user' => $sanitizedUser ] ]); $server->send([$connection], $connectedPayloadJson); $outboundBytes += \strlen($connectedPayloadJson); - $updateStats($project->getId(), $project->getAttribute('teamId'), $connectedPayloadJson); + triggerStats([ + METRIC_REALTIME_OUTBOUND => \strlen($connectedPayloadJson), + ], $project->getId()); $success = true; } catch (Throwable $th) { @@ -1281,14 +1287,16 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ try { if (array_key_exists($connection, $realtime->connections)) { - // A connection can exist without a stored projectId (e.g. it was torn down - // before subscribing, or only carries an authorization entry), so guard every - // project-scoped bookkeeping call. $projectId is read defensively above. + // These decrements are symmetric with the increments in updateStats (onOpen), + // which run when the connection enters $realtime->connections — the same gate as the + // array_key_exists check above. The connectionsTotal stat is keyed by project, so it's + // additionally guarded: a connection can exist without a stored projectId (e.g. only an + // authorization entry left after an orphaning re-subscribe). + $register->get('telemetry.connectionCounter')->add(-1); + $register->get('telemetry.workerClientCounter')->add(-1, $register->get('telemetry.workerAttributes')); if (!empty($projectId)) { $stats->decr($projectId, 'connectionsTotal'); } - $register->get('telemetry.connectionCounter')->add(-1); - $register->get('telemetry.workerClientCounter')->add(-1, $register->get('telemetry.workerAttributes')); $subscriptionsBeforeClose = \count($realtime->getSubscriptionMetadata($connection)); if ($subscriptionsBeforeClose > 0) { $register->get('telemetry.workerSubscriptionCounter')->add(-$subscriptionsBeforeClose, $register->get('telemetry.workerAttributes')); From 1427e22c552b49f082a19cd4ed9958ba6ad74406 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 11 Jun 2026 16:32:44 +0530 Subject: [PATCH 102/151] Fix builds worker overwriting canceled deployment status (#12569) * (fix): prevent builds worker from overwriting canceled deployment status * (chore): refresh composer lock content hash --- composer.lock | 2 +- .../Modules/Functions/Workers/Builds.php | 46 +++++++++++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/composer.lock b/composer.lock index 91596d04e9..1e57ede67b 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": "e922d0ba4d0c7d12cc24cff52b552803", + "content-hash": "1842adc3102a8d4af14a013751acd366", "packages": [ { "name": "adhocore/jwt", diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 77ba3c89b9..fae32bf76a 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -249,19 +249,28 @@ class Builds extends Action if ($deployment->getAttribute('status') === 'canceled') { $resource = $this->updateLatestDeployment($dbForProject, $resource); - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } $deploymentId = $deployment->getId(); - $deployment->setAttribute('buildStartedAt', $startTime); - $deployment->setAttribute('status', 'processing'); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + $updated = $dbForProject->updateDocuments('deployments', new Document([ 'buildStartedAt' => $startTime, 'status' => 'processing', - ])); + ]), [ + Query::equal('$id', [$deploymentId]), + Query::notEqual('status', 'canceled'), + ]); + + if ($updated === 0) { + $resource = $this->updateLatestDeployment($dbForProject, $resource); + $this->finalizeCanceledDeployment($deploymentId, $dbForProject, $queueForRealtime); + return; + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); $resource = $this->updateLatestDeployment($dbForProject, $resource); @@ -389,7 +398,7 @@ class Builds extends Action Console::execute('mkdir -p ' . \escapeshellarg('/tmp/builds/' . $deploymentId), '', $stdout, $stderr); if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -531,10 +540,19 @@ class Builds extends Action } /** Request the executor to build the code... */ - $deployment->setAttribute('status', 'building'); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + $updated = $dbForProject->updateDocuments('deployments', new Document([ 'status' => 'building', - ])); + ]), [ + Query::equal('$id', [$deploymentId]), + Query::notEqual('status', 'canceled'), + ]); + + if ($updated === 0) { + $this->finalizeCanceledDeployment($deploymentId, $dbForProject, $queueForRealtime); + return; + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); Span::add('deployment.status', 'building'); $resource = $this->updateLatestDeployment($dbForProject, $resource); @@ -672,7 +690,7 @@ class Builds extends Action $err = null; if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -827,7 +845,7 @@ class Builds extends Action $latestDeployment = $dbForProject->getDocument('deployments', $deploymentId); if ($latestDeployment->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -1073,7 +1091,7 @@ class Builds extends Action ->trigger(); if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -1105,7 +1123,7 @@ class Builds extends Action } } catch (\Throwable $th) { if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -1521,7 +1539,7 @@ class Builds extends Action ); } - private function cancelDeployment(string $deploymentId, Database $dbForProject, Realtime $queueForRealtime) + private function finalizeCanceledDeployment(string $deploymentId, Database $dbForProject, Realtime $queueForRealtime) { Span::add('deployment.status', 'canceled'); From 53b09dc51686d0900eb06a80566aee9e61804ab2 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 11 Jun 2026 17:00:35 +0530 Subject: [PATCH 103/151] Enhance subscription logic to handle empty meta and improve connection management --- app/realtime.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/realtime.php b/app/realtime.php index 191d2419b5..8fb33723a4 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -699,8 +699,15 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats, ); } + // Restore authorization after subscribe - if ($authorization !== null) { + // meta can be empty as well as the channels are not required query param to connect + // channels and queries can be sent via message later on + // so if meta is empty we are not subscribing above to the projectId + if (!isset($realtime->connections[$connection])) { + $realtime->subscribe($projectId, $connection, '', $roles, [], [], $userId); + } + if ($authorization !== null && isset($realtime->connections[$connection])) { $realtime->connections[$connection]['authorization'] = $authorization; } From 36ab95f1c843f7bda38299c370a9e1b511331db0 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 11 Jun 2026 17:38:45 +0530 Subject: [PATCH 104/151] Update Utopia platform and HTTP RCs (#12570) --- composer.json | 6 +- composer.lock | 248 ++++++++++++++++++++++---------------------------- 2 files changed, 112 insertions(+), 142 deletions(-) diff --git a/composer.json b/composer.json index de5a1ba601..73224761c4 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,7 @@ "utopia-php/audit": "^2.4", "utopia-php/auth": "0.5.*", "utopia-php/cache": "^3.0", - "utopia-php/cli": "0.23.*", + "utopia-php/cli": "^0.24", "utopia-php/compression": "0.1.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", @@ -78,11 +78,11 @@ "utopia-php/logger": "0.8.*", "utopia-php/messaging": "1.0.*", "utopia-php/migration": "1.*", - "utopia-php/platform": "1.0.0-rc5", + "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "1.*", "utopia-php/span": "3.0.*", "utopia-php/preloader": "0.2.*", - "utopia-php/queue": "0.20.*", + "utopia-php/queue": "^0.21", "utopia-php/servers": "0.4.*", "utopia-php/registry": "0.5.*", "utopia-php/storage": "2.*", diff --git a/composer.lock b/composer.lock index 1e57ede67b..3d198418c9 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": "1842adc3102a8d4af14a013751acd366", + "content-hash": "c8e8a31556be2ad12d15a25969c4d59f", "packages": [ { "name": "adhocore/jwt", @@ -2654,16 +2654,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.38.1", + "version": "v1.38.2", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92" + "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/14c5439eec4ccff081ac14eca2dc57feb2a66d92", - "reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", + "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", "shasum": "" }, "require": { @@ -2715,7 +2715,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.2" }, "funding": [ { @@ -2735,7 +2735,7 @@ "type": "tidelift" } ], - "time": "2026-05-26T12:51:13+00:00" + "time": "2026-05-27T06:59:30+00:00" }, { "name": "symfony/polyfill-php82", @@ -2819,16 +2819,16 @@ }, { "name": "symfony/polyfill-php83", - "version": "v1.38.1", + "version": "v1.38.2", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "8339098cae28673c15cce00d80734af0453054e2" + "reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/8339098cae28673c15cce00d80734af0453054e2", - "reference": "8339098cae28673c15cce00d80734af0453054e2", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/796a26abb75ce49f3a84433cd81bf1009d73d5f8", + "reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8", "shasum": "" }, "require": { @@ -2875,7 +2875,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.38.1" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.38.2" }, "funding": [ { @@ -2895,7 +2895,7 @@ "type": "tidelift" } ], - "time": "2026-05-26T12:51:13+00:00" + "time": "2026-05-27T06:51:48+00:00" }, { "name": "symfony/polyfill-php85", @@ -3491,27 +3491,23 @@ }, { "name": "utopia-php/cli", - "version": "0.23.4", + "version": "0.24.1", "source": { "type": "git", "url": "https://github.com/utopia-php/cli.git", - "reference": "59f66e72ec1f8350968d8b95c0039faaac7a6d6d" + "reference": "ba1eabbbfa56f0936de7455a26dcd1afc3246636" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cli/zipball/59f66e72ec1f8350968d8b95c0039faaac7a6d6d", - "reference": "59f66e72ec1f8350968d8b95c0039faaac7a6d6d", + "url": "https://api.github.com/repos/utopia-php/cli/zipball/ba1eabbbfa56f0936de7455a26dcd1afc3246636", + "reference": "ba1eabbbfa56f0936de7455a26dcd1afc3246636", "shasum": "" }, "require": { "php": ">=7.4", - "utopia-php/servers": "0.4.*" + "utopia-php/servers": "^0.4" }, "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.6", "swoole/ide-helper": "4.8.8", "utopia-php/console": "0.0.*" }, @@ -3536,31 +3532,34 @@ ], "support": { "issues": "https://github.com/utopia-php/cli/issues", - "source": "https://github.com/utopia-php/cli/tree/0.23.4" + "source": "https://github.com/utopia-php/cli/tree/0.24.1" }, - "time": "2026-05-21T14:42:15+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/compression", - "version": "0.1.4", + "version": "0.1.5", "source": { "type": "git", "url": "https://github.com/utopia-php/compression.git", - "reference": "68045cb9d714c1259582d2dfd0e76bd34f83e713" + "reference": "d39208e3f0f3ad0a793e8023046eb2e69b57bae3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/compression/zipball/68045cb9d714c1259582d2dfd0e76bd34f83e713", - "reference": "68045cb9d714c1259582d2dfd0e76bd34f83e713", + "url": "https://api.github.com/repos/utopia-php/compression/zipball/d39208e3f0f3ad0a793e8023046eb2e69b57bae3", + "reference": "d39208e3f0f3ad0a793e8023046eb2e69b57bae3", "shasum": "" }, "require": { "php": ">=8.1" }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" + "suggest": { + "ext-brotli": "Required for the Brotli algorithm", + "ext-lz4": "Required for the LZ4 algorithm", + "ext-snappy": "Required for the Snappy algorithm", + "ext-xz": "Required for the XZ algorithm", + "ext-zlib": "Required for the GZIP and Deflate algorithms", + "ext-zstd": "Required for the Zstd algorithm" }, "type": "library", "autoload": { @@ -3582,9 +3581,9 @@ ], "support": { "issues": "https://github.com/utopia-php/compression/issues", - "source": "https://github.com/utopia-php/compression/tree/0.1.4" + "source": "https://github.com/utopia-php/compression/tree/0.1.5" }, - "time": "2026-02-17T05:53:40+00:00" + "time": "2026-06-10T15:38:47+00:00" }, { "name": "utopia-php/config", @@ -3788,16 +3787,16 @@ }, { "name": "utopia-php/di", - "version": "0.3.2", + "version": "0.3.3", "source": { "type": "git", "url": "https://github.com/utopia-php/di.git", - "reference": "07025d721ed5d9be27932e8e640acf1467fc4b9d" + "reference": "a0cee7ff9976bb6b596619aeac524948a8ee3dfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/di/zipball/07025d721ed5d9be27932e8e640acf1467fc4b9d", - "reference": "07025d721ed5d9be27932e8e640acf1467fc4b9d", + "url": "https://api.github.com/repos/utopia-php/di/zipball/a0cee7ff9976bb6b596619aeac524948a8ee3dfb", + "reference": "a0cee7ff9976bb6b596619aeac524948a8ee3dfb", "shasum": "" }, "require": { @@ -3805,10 +3804,7 @@ "psr/container": "^2.0" }, "require-dev": { - "laravel/pint": "^1.27", "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^9.5.25", "swoole/ide-helper": "4.8.3" }, "type": "library", @@ -3833,9 +3829,9 @@ ], "support": { "issues": "https://github.com/utopia-php/di/issues", - "source": "https://github.com/utopia-php/di/tree/0.3.2" + "source": "https://github.com/utopia-php/di/tree/0.3.3" }, - "time": "2026-03-21T07:42:10+00:00" + "time": "2026-06-10T14:22:41+00:00" }, { "name": "utopia-php/dns", @@ -4106,32 +4102,27 @@ }, { "name": "utopia-php/http", - "version": "2.0.0-rc5", + "version": "2.0.0-rc9", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "ec968c1fd7a4281d8febb3ed771207be0b852b14" + "reference": "e4fdbc57ac6dc7cad1604eb904d3c95a31226ba9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/ec968c1fd7a4281d8febb3ed771207be0b852b14", - "reference": "ec968c1fd7a4281d8febb3ed771207be0b852b14", + "url": "https://api.github.com/repos/utopia-php/http/zipball/e4fdbc57ac6dc7cad1604eb904d3c95a31226ba9", + "reference": "e4fdbc57ac6dc7cad1604eb904d3c95a31226ba9", "shasum": "" }, "require": { "php": ">=8.3", - "utopia-php/compression": "0.1.*", - "utopia-php/di": "0.3.*", - "utopia-php/servers": "0.4.*", + "utopia-php/compression": "^0.1", + "utopia-php/di": "^0.3", + "utopia-php/servers": "^0.4", "utopia-php/telemetry": "^0.4", - "utopia-php/validators": "0.2.*" + "utopia-php/validators": "^0.2" }, "require-dev": { - "doctrine/instantiator": "^1.5", - "laravel/pint": "1.*", - "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^12.0", - "rector/rector": "^2.4", "swoole/ide-helper": "4.8.3" }, "suggest": { @@ -4156,9 +4147,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/2.0.0-rc5" + "source": "https://github.com/utopia-php/http/tree/2.0.0-rc9" }, - "time": "2026-06-04T13:35:09+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/image", @@ -4260,25 +4251,22 @@ }, { "name": "utopia-php/lock", - "version": "0.2.0", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/lock.git", - "reference": "49317c9493d8f747e4299aa24c22862aa5f6e106" + "reference": "9ef48d7094f5c68d1736f664f6e9b4b1ec656f21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/lock/zipball/49317c9493d8f747e4299aa24c22862aa5f6e106", - "reference": "49317c9493d8f747e4299aa24c22862aa5f6e106", + "url": "https://api.github.com/repos/utopia-php/lock/zipball/9ef48d7094f5c68d1736f664f6e9b4b1ec656f21", + "reference": "9ef48d7094f5c68d1736f664f6e9b4b1ec656f21", "shasum": "" }, "require": { "php": ">=8.3" }, "require-dev": { - "laravel/pint": "1.*", - "phpstan/phpstan": "2.*", - "phpunit/phpunit": "11.*", "swoole/ide-helper": "*" }, "suggest": { @@ -4302,12 +4290,12 @@ "email": "team@appwrite.io" } ], - "description": "Mutex, semaphore, file and distributed locks for PHP — one interface, four backends.", + "description": "A simple lock library to coordinate access to shared resources across coroutines, processes and hosts", "support": { "issues": "https://github.com/utopia-php/lock/issues", - "source": "https://github.com/utopia-php/lock/tree/0.2.0" + "source": "https://github.com/utopia-php/lock/tree/0.2.1" }, - "time": "2026-04-24T10:47:56+00:00" + "time": "2026-06-10T15:55:36+00:00" }, { "name": "utopia-php/logger", @@ -4533,30 +4521,26 @@ }, { "name": "utopia-php/platform", - "version": "1.0.0-rc5", + "version": "1.0.0-rc9", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "edf46c6e9c62af1cec1cbd1386a84c730d76a9f8" + "reference": "5ae1fba6d797ba617816a1a582d9c1b1d188a1bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/edf46c6e9c62af1cec1cbd1386a84c730d76a9f8", - "reference": "edf46c6e9c62af1cec1cbd1386a84c730d76a9f8", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/5ae1fba6d797ba617816a1a582d9c1b1d188a1bc", + "reference": "5ae1fba6d797ba617816a1a582d9c1b1d188a1bc", "shasum": "" }, "require": { "ext-json": "*", "ext-redis": "*", "php": ">=8.3", - "utopia-php/cli": "0.23.*", + "utopia-php/cli": "^0.24", "utopia-php/http": "^2.0@RC", - "utopia-php/queue": "^0.20", - "utopia-php/servers": "0.4.*" - }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpunit/phpunit": "^9.3" + "utopia-php/queue": "^0.21", + "utopia-php/servers": "^0.4" }, "type": "library", "autoload": { @@ -4578,22 +4562,22 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/1.0.0-rc5" + "source": "https://github.com/utopia-php/platform/tree/1.0.0-rc9" }, - "time": "2026-06-04T13:00:46+00:00" + "time": "2026-06-11T10:36:26+00:00" }, { "name": "utopia-php/pools", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/utopia-php/pools.git", - "reference": "19d8b82f6772a901eb1e16aa7c0e7dfba0ba711b" + "reference": "e66e498d59cf3ac48c1f4c70be46f7eb6df7a63b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/pools/zipball/19d8b82f6772a901eb1e16aa7c0e7dfba0ba711b", - "reference": "19d8b82f6772a901eb1e16aa7c0e7dfba0ba711b", + "url": "https://api.github.com/repos/utopia-php/pools/zipball/e66e498d59cf3ac48c1f4c70be46f7eb6df7a63b", + "reference": "e66e498d59cf3ac48c1f4c70be46f7eb6df7a63b", "shasum": "" }, "require": { @@ -4601,11 +4585,11 @@ "utopia-php/telemetry": "^0.4" }, "require-dev": { - "laravel/pint": "1.*", - "phpstan/phpstan": "1.*", - "phpunit/phpunit": "11.*", "swoole/ide-helper": "6.*" }, + "suggest": { + "ext-swoole": "Required to use the Swoole pool adapter" + }, "type": "library", "autoload": { "psr-4": { @@ -4631,9 +4615,9 @@ ], "support": { "issues": "https://github.com/utopia-php/pools/issues", - "source": "https://github.com/utopia-php/pools/tree/1.0.4" + "source": "https://github.com/utopia-php/pools/tree/1.0.5" }, - "time": "2026-06-03T05:20:57+00:00" + "time": "2026-06-10T15:14:31+00:00" }, { "name": "utopia-php/preloader", @@ -4736,32 +4720,29 @@ }, { "name": "utopia-php/queue", - "version": "0.20.0", + "version": "0.21.1", "source": { "type": "git", "url": "https://github.com/utopia-php/queue.git", - "reference": "d4da9e8d4a8879eb529ec1cda6b93cad2cf8d940" + "reference": "abc5173ff7079118ebf5a22cb8008e8cf0a150e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/queue/zipball/d4da9e8d4a8879eb529ec1cda6b93cad2cf8d940", - "reference": "d4da9e8d4a8879eb529ec1cda6b93cad2cf8d940", + "url": "https://api.github.com/repos/utopia-php/queue/zipball/abc5173ff7079118ebf5a22cb8008e8cf0a150e4", + "reference": "abc5173ff7079118ebf5a22cb8008e8cf0a150e4", "shasum": "" }, "require": { "php": ">=8.4", - "utopia-php/di": "0.3.*", - "utopia-php/lock": "0.2.*", - "utopia-php/pools": "1.*", - "utopia-php/servers": "0.4.*", - "utopia-php/telemetry": "0.4.*", - "utopia-php/validators": "0.2.*" + "utopia-php/di": "^0.3", + "utopia-php/lock": "^0.2", + "utopia-php/pools": "^1.0", + "utopia-php/servers": "^0.4", + "utopia-php/telemetry": "^0.4", + "utopia-php/validators": "^0.2" }, "require-dev": { "ext-redis": "*", - "laravel/pint": "^1.0", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^11.0", "swoole/ide-helper": "4.8.8", "workerman/workerman": "^4.0" }, @@ -4796,9 +4777,9 @@ ], "support": { "issues": "https://github.com/utopia-php/queue/issues", - "source": "https://github.com/utopia-php/queue/tree/0.20.0" + "source": "https://github.com/utopia-php/queue/tree/0.21.1" }, - "time": "2026-06-04T12:33:31+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/registry", @@ -4854,27 +4835,22 @@ }, { "name": "utopia-php/servers", - "version": "0.4.1", + "version": "0.4.3", "source": { "type": "git", "url": "https://github.com/utopia-php/servers.git", - "reference": "6e9241f587a19c0e9e7a3587fe3b15ffb2d4c2a4" + "reference": "a160268a804ae1a6d8a6ee41aed8dda1d2553da8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/servers/zipball/6e9241f587a19c0e9e7a3587fe3b15ffb2d4c2a4", - "reference": "6e9241f587a19c0e9e7a3587fe3b15ffb2d4c2a4", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/a160268a804ae1a6d8a6ee41aed8dda1d2553da8", + "reference": "a160268a804ae1a6d8a6ee41aed8dda1d2553da8", "shasum": "" }, "require": { "php": ">=8.2", - "utopia-php/di": "0.3.*", - "utopia-php/validators": "0.*" - }, - "require-dev": { - "laravel/pint": "^0.2.3", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.5.5" + "utopia-php/di": "^0.3", + "utopia-php/validators": "^0.2" }, "type": "library", "autoload": { @@ -4902,9 +4878,9 @@ ], "support": { "issues": "https://github.com/utopia-php/servers/issues", - "source": "https://github.com/utopia-php/servers/tree/0.4.1" + "source": "https://github.com/utopia-php/servers/tree/0.4.3" }, - "time": "2026-05-21T13:08:45+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/span", @@ -5060,16 +5036,16 @@ }, { "name": "utopia-php/telemetry", - "version": "0.4.0", + "version": "0.4.1", "source": { "type": "git", "url": "https://github.com/utopia-php/telemetry.git", - "reference": "e0630df7d8176833cd4882f78814a5b893dcb0e0" + "reference": "028f3a85bb987b1e9357fb1632aa40f020d1b86e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/e0630df7d8176833cd4882f78814a5b893dcb0e0", - "reference": "e0630df7d8176833cd4882f78814a5b893dcb0e0", + "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/028f3a85bb987b1e9357fb1632aa40f020d1b86e", + "reference": "028f3a85bb987b1e9357fb1632aa40f020d1b86e", "shasum": "" }, "require": { @@ -5082,10 +5058,7 @@ "symfony/http-client": "7.*" }, "require-dev": { - "laravel/pint": "1.*", "phpbench/phpbench": "1.*", - "phpstan/phpstan": "2.*", - "phpunit/phpunit": "11.*", "swoole/ide-helper": "6.*" }, "suggest": { @@ -5102,6 +5075,7 @@ "license": [ "MIT" ], + "description": "A lite & fast telemetry library, with adapters for OpenTelemetry", "keywords": [ "framework", "php", @@ -5109,32 +5083,27 @@ ], "support": { "issues": "https://github.com/utopia-php/telemetry/issues", - "source": "https://github.com/utopia-php/telemetry/tree/0.4.0" + "source": "https://github.com/utopia-php/telemetry/tree/0.4.1" }, - "time": "2026-05-29T11:57:04+00:00" + "time": "2026-06-10T15:48:26+00:00" }, { "name": "utopia-php/validators", - "version": "0.2.4", + "version": "0.2.6", "source": { "type": "git", "url": "https://github.com/utopia-php/validators.git", - "reference": "b4ee60db4dbae5ffbe53968d01f69b6941251576" + "reference": "f1ac4f08d6876daf117a1d9af53a4c7b752c2c0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/validators/zipball/b4ee60db4dbae5ffbe53968d01f69b6941251576", - "reference": "b4ee60db4dbae5ffbe53968d01f69b6941251576", + "url": "https://api.github.com/repos/utopia-php/validators/zipball/f1ac4f08d6876daf117a1d9af53a4c7b752c2c0b", + "reference": "f1ac4f08d6876daf117a1d9af53a4c7b752c2c0b", "shasum": "" }, "require": { "php": ">=8.0" }, - "require-dev": { - "laravel/pint": "1.*", - "phpstan/phpstan": "2.*", - "phpunit/phpunit": "11.*" - }, "type": "library", "autoload": { "psr-4": { @@ -5154,9 +5123,9 @@ ], "support": { "issues": "https://github.com/utopia-php/validators/issues", - "source": "https://github.com/utopia-php/validators/tree/0.2.4" + "source": "https://github.com/utopia-php/validators/tree/0.2.6" }, - "time": "2026-05-21T12:47:43+00:00" + "time": "2026-06-10T14:45:13+00:00" }, { "name": "utopia-php/vcs", @@ -8393,7 +8362,8 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { - "utopia-php/http": 5 + "utopia-php/http": 5, + "utopia-php/platform": 5 }, "prefer-stable": true, "prefer-lowest": false, From 8791964e2b83ca234f2c5eeb86efcaaed5ff530b Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 11 Jun 2026 18:10:29 +0400 Subject: [PATCH 105/151] Remove node modules cache debug build logs --- .../Modules/Functions/Workers/Builds.php | 44 +------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index c945fedb6a..69c64e4df9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -673,9 +673,6 @@ class Builds extends Action Span::add('build.node_modules_cache.enabled', $cacheKey !== ''); Span::add('build.node_modules_cache.key', $cacheKey); - $cacheDebugLogs = $this->getNodeModulesCacheDebugLog($cacheKey, $runtime, $version, $command, $source); - $deployment = $this->appendBuildLog($dbForProject, $queueForRealtime, $deployment, $cacheDebugLogs); - $response = null; $err = null; @@ -866,7 +863,7 @@ class Builds extends Action ['logs' => $logs, 'detectionLogs' => $detectionLogs] = $this->splitSiteDetectionLogs($logs); - $deployment->setAttribute('buildLogs', $cacheDebugLogs . $logs); + $deployment->setAttribute('buildLogs', $logs); $adapter = null; if ($resource->getCollection() === 'sites' && ! empty($detectionLogs)) { @@ -1323,45 +1320,6 @@ class Builds extends Action return \substr(\hash('sha256', \json_encode($hashContext, JSON_THROW_ON_ERROR)), 0, 48); } - protected function getNodeModulesCacheDebugLog(string $cacheKey, array $runtime, string $version, string $command, string $source): string - { - $date = \date('H:i:s'); - $runtimeKey = $runtime['key'] ?? ''; - $prefix = "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[36m"; - - if ($cacheKey !== '') { - return $prefix . " build cache requested. key={$cacheKey} source={$source} \033[0m\n"; - } - - $reason = match (true) { - $version !== 'v5' => 'runtime version is not v5', - $command === '' || $command === '0' => 'build command is empty', - default => 'cache key unavailable', - }; - - return $prefix . " build cache not requested. reason={$reason} runtime={$runtimeKey} version={$version} source={$source} \033[0m\n"; - } - - protected function appendBuildLog(Database $dbForProject, Realtime $queueForRealtime, Document $deployment, string $log): Document - { - if ($log === '') { - return $deployment; - } - - $logs = $deployment->getAttribute('buildLogs', '') . $log; - $deployment->setAttribute('buildLogs', $logs); - - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildLogs' => $logs, - ])); - - $queueForRealtime - ->setPayload($deployment->getArrayCopy()) - ->trigger(); - - return $deployment; - } - protected function prepareSiteBuildCommand(string $command, string $outputDirectory): string { $listFilesCommand = 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build'; From 9c90f4040bc2355e445fc6b360346bf778c503a2 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 11 Jun 2026 20:00:13 +0530 Subject: [PATCH 106/151] Fix parallel deployment chunk uploads on S3 devices (#12574) --- .../Functions/Http/Deployments/Create.php | 96 ++++++---- .../Modules/Sites/Http/Deployments/Create.php | 167 ++++++++++-------- 2 files changed, 156 insertions(+), 107 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index 1679a1cc64..0269c3df19 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -202,8 +202,27 @@ class Create extends Action $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; $completed = false; + $mergeUploadMetadata = function (array $stored, array $current): array { + $merged = \array_merge($stored, $current); + + if (isset($stored['parts']) || isset($current['parts'])) { + $parts = $stored['parts'] ?? []; + foreach (($current['parts'] ?? []) as $part => $value) { + $parts[(int) $part] = $value; + } + \ksort($parts); + + $merged['parts'] = $parts; + $merged['chunks'] = \count($parts); + } + + return $merged; + }; + + $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + try { - $locks($lockKey, 600, function () use (&$chunks, $dbForProject, $deploymentId, &$metadata, &$completed, $response): void { + $locks($lockKey, 600, function () use ($activate, &$chunks, $commands, $contentRange, $dbForProject, $deploymentId, $deviceForFunctions, $entrypoint, $fileSize, &$function, &$metadata, $path, $type, &$completed, $response): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); if (!$deployment->isEmpty()) { @@ -220,6 +239,35 @@ class Create extends Action return; } } + + if ($deployment->isEmpty()) { + $deviceForFunctions->prepareUpload($path, $metadata['content_type'] ?? '', $chunks, $metadata); + + if (!empty($contentRange)) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $function->getSequence(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', + 'entrypoint' => $entrypoint, + 'buildCommands' => $commands, + 'startCommand' => $function->getAttribute('startCommand', ''), + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'sourceChunksTotal' => $chunks, + 'sourceChunksUploaded' => 0, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type + ])); + } + } }, timeout: 120.0); } catch (LockContention) { $response->addHeader('Retry-After', '5'); @@ -231,23 +279,21 @@ class Create extends Action return; } - $chunksUploaded = $deviceForFunctions->upload($fileTmpName, $path, $chunk, $chunks, $metadata); + $chunksUploaded = $deviceForFunctions->uploadChunk($fileTmpName, $path, $chunk, $chunks, $metadata); if (empty($chunksUploaded)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); } - $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; - try { - $locks($lockKey, 600, function () use ($activate, &$chunks, $chunksUploaded, $commands, $dbForProject, $deploymentId, $deviceForFunctions, $entrypoint, $fileSize, &$function, $functionId, $path, &$metadata, $platform, $project, $publisherForBuilds, $queueForEvents, $response, $type): void { + $locks($lockKey, 600, function () use ($activate, &$chunks, $chunksUploaded, $commands, $dbForProject, $deploymentId, $deviceForFunctions, $entrypoint, $fileSize, &$function, $functionId, $path, &$metadata, $mergeUploadMetadata, $platform, $project, $publisherForBuilds, $queueForEvents, $response, $type): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); $uploaded = 0; if (!$deployment->isEmpty()) { $chunks = $deployment->getAttribute('sourceChunksTotal', 1); $uploaded = $deployment->getAttribute('sourceChunksUploaded', 0); - $metadata = \array_merge($deployment->getAttribute('sourceMetadata', []), $metadata); + $metadata = $mergeUploadMetadata($deployment->getAttribute('sourceMetadata', []), $metadata); if ($uploaded === $chunks) { $queueForEvents->reset(); @@ -259,9 +305,11 @@ class Create extends Action } } - $chunksUploaded = max($uploaded, $chunksUploaded); + $chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0)); if ($chunksUploaded === $chunks && $uploaded < $chunks) { + $deviceForFunctions->finalizeUpload($path, $chunks, $metadata); + if ($activate) { // Remove deploy for all other deployments. $activeDeployments = $dbForProject->find('deployments', [ @@ -320,36 +368,10 @@ class Create extends Action platform: $platform, )); } else { - if ($deployment->isEmpty()) { - $deployment = $dbForProject->createDocument('deployments', new Document([ - '$id' => $deploymentId, - '$permissions' => [ - Permission::read(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'resourceInternalId' => $function->getSequence(), - 'resourceId' => $function->getId(), - 'resourceType' => 'functions', - 'entrypoint' => $entrypoint, - 'buildCommands' => $commands, - 'startCommand' => $function->getAttribute('startCommand', ''), - 'sourcePath' => $path, - 'sourceSize' => $fileSize, - 'totalSize' => $fileSize, - 'sourceChunksTotal' => $chunks, - 'sourceChunksUploaded' => $chunksUploaded, - 'activate' => $activate, - 'sourceMetadata' => $metadata, - 'type' => $type - ])); - - } else { - $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ - 'sourceChunksUploaded' => $chunksUploaded, - 'sourceMetadata' => $metadata, - ])); - } + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ + 'sourceChunksUploaded' => $chunksUploaded, + 'sourceMetadata' => $metadata, + ])); } $metadata = null; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 2ac71376ed..253abbb495 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -202,8 +202,35 @@ class Create extends Action $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; $completed = false; + $mergeUploadMetadata = function (array $stored, array $current): array { + $merged = \array_merge($stored, $current); + + if (isset($stored['parts']) || isset($current['parts'])) { + $parts = $stored['parts'] ?? []; + foreach (($current['parts'] ?? []) as $part => $value) { + $parts[(int) $part] = $value; + } + \ksort($parts); + + $merged['parts'] = $parts; + $merged['chunks'] = \count($parts); + } + + return $merged; + }; + + $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + + $commands = []; + if (!empty($installCommand)) { + $commands[] = $installCommand; + } + if (!empty($buildCommand)) { + $commands[] = $buildCommand; + } + try { - $locks($lockKey, 600, function () use (&$chunks, $dbForProject, $deploymentId, &$metadata, &$completed, $response): void { + $locks($lockKey, 600, function () use ($activate, $authorization, &$chunks, $commands, $contentRange, $dbForPlatform, $dbForProject, $deploymentId, $deviceForSites, $fileSize, &$metadata, $outputDirectory, $path, $platform, $project, &$site, $type, &$completed, $response): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); if (!$deployment->isEmpty()) { @@ -220,6 +247,65 @@ class Create extends Action return; } } + + if ($deployment->isEmpty()) { + $deviceForSites->prepareUpload($path, $metadata['content_type'] ?? '', $chunks, $metadata); + + if (!empty($contentRange)) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $site->getSequence(), + 'resourceId' => $site->getId(), + 'resourceType' => 'sites', + 'buildCommands' => \implode(' && ', $commands), + 'startCommand' => $site->getAttribute('startCommand', ''), + 'buildOutput' => $outputDirectory, + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'sourceChunksTotal' => $chunks, + 'sourceChunksUploaded' => 0, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type, + ])); + + $sitesDomain = $platform['sitesDomain']; + $domain = ID::unique() . "." . $sitesDomain; + + // TODO: (@Meldiron) Remove after 1.7.x migration + $isMd5 = System::getEnv('_APP_RULES_FORMAT') === 'md5'; + $ruleId = $isMd5 ? md5($domain) : ID::unique(); + + $authorization->skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getSequence(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), + 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getSequence(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getSequence(), + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + } + } }, timeout: 120.0); } catch (LockContention) { $response->addHeader('Retry-After', '5'); @@ -231,31 +317,21 @@ class Create extends Action return; } - $chunksUploaded = $deviceForSites->upload($fileTmpName, $path, $chunk, $chunks, $metadata); + $chunksUploaded = $deviceForSites->uploadChunk($fileTmpName, $path, $chunk, $chunks, $metadata); if (empty($chunksUploaded)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); } - $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; - - $commands = []; - if (!empty($installCommand)) { - $commands[] = $installCommand; - } - if (!empty($buildCommand)) { - $commands[] = $buildCommand; - } - try { - $locks($lockKey, 600, function () use ($activate, $authorization, $commands, &$chunks, $chunksUploaded, $dbForPlatform, $dbForProject, $deploymentId, $deviceForSites, $fileSize, &$metadata, $outputDirectory, $path, $platform, $project, $publisherForBuilds, $queueForEvents, $response, &$site, $siteId, $type): void { + $locks($lockKey, 600, function () use ($activate, $authorization, $commands, &$chunks, $chunksUploaded, $dbForPlatform, $dbForProject, $deploymentId, $deviceForSites, $fileSize, &$metadata, $mergeUploadMetadata, $outputDirectory, $path, $platform, $project, $publisherForBuilds, $queueForEvents, $response, &$site, $siteId, $type): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); $uploaded = 0; if (!$deployment->isEmpty()) { $chunks = $deployment->getAttribute('sourceChunksTotal', 1); $uploaded = $deployment->getAttribute('sourceChunksUploaded', 0); - $metadata = \array_merge($deployment->getAttribute('sourceMetadata', []), $metadata); + $metadata = $mergeUploadMetadata($deployment->getAttribute('sourceMetadata', []), $metadata); if ($uploaded === $chunks) { $queueForEvents->reset(); @@ -267,9 +343,11 @@ class Create extends Action } } - $chunksUploaded = max($uploaded, $chunksUploaded); + $chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0)); if ($chunksUploaded === $chunks && $uploaded < $chunks) { + $deviceForSites->finalizeUpload($path, $chunks, $metadata); + if ($activate) { // Remove deploy for all other deployments. $activeDeployments = $dbForProject->find('deployments', [ @@ -355,61 +433,10 @@ class Create extends Action platform: $platform, )); } else { - if ($deployment->isEmpty()) { - $deployment = $dbForProject->createDocument('deployments', new Document([ - '$id' => $deploymentId, - '$permissions' => [ - Permission::read(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'resourceInternalId' => $site->getSequence(), - 'resourceId' => $site->getId(), - 'resourceType' => 'sites', - 'buildCommands' => \implode(' && ', $commands), - 'startCommand' => $site->getAttribute('startCommand', ''), - 'buildOutput' => $outputDirectory, - 'adapter' => $site->getAttribute('adapter', ''), - 'fallbackFile' => $site->getAttribute('fallbackFile', ''), - 'sourcePath' => $path, - 'sourceSize' => $fileSize, - 'totalSize' => $fileSize, - 'sourceChunksTotal' => $chunks, - 'sourceChunksUploaded' => $chunksUploaded, - 'activate' => $activate, - 'sourceMetadata' => $metadata, - 'type' => $type, - ])); - - $sitesDomain = $platform['sitesDomain']; - $domain = ID::unique() . "." . $sitesDomain; - $ruleId = md5($domain); - $authorization->skip( - fn () => $dbForPlatform->createDocument('rules', new Document([ - '$id' => $ruleId, - 'projectId' => $project->getId(), - 'projectInternalId' => $project->getSequence(), - 'domain' => $domain, - 'type' => 'deployment', - 'trigger' => 'deployment', - 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), - 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getSequence(), - 'deploymentResourceType' => 'site', - 'deploymentResourceId' => $site->getId(), - 'deploymentResourceInternalId' => $site->getSequence(), - 'status' => 'verified', - 'certificateId' => '', - 'search' => implode(' ', [$ruleId, $domain]), - 'owner' => 'Appwrite', - 'region' => $project->getAttribute('region') - ])) - ); - } else { - $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ - 'sourceChunksUploaded' => $chunksUploaded, - 'sourceMetadata' => $metadata, - ])); - } + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ + 'sourceChunksUploaded' => $chunksUploaded, + 'sourceMetadata' => $metadata, + ])); } $metadata = null; From 8e4429b6dcffc06efbfd2eb21e2eb264a24a1f17 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 11 Jun 2026 20:19:35 +0530 Subject: [PATCH 107/151] Fix race between rule creation and async orphaned rule cleanup (#12571) * (fix): retry rule creation when orphaned rule is deleted concurrently * (fix): retry mongod startup when init port bind race causes exit 48 * Revert MongoDB startup retry --- src/Appwrite/Platform/Modules/Proxy/Action.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Proxy/Action.php b/src/Appwrite/Platform/Modules/Proxy/Action.php index f2ffc58568..959a27b48b 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Action.php +++ b/src/Appwrite/Platform/Modules/Proxy/Action.php @@ -54,10 +54,11 @@ class Action extends PlatformAction return $dbForPlatform->getDocument('rules', $rule->getId()); }); - if ( - $existingRule->isEmpty() || - $existingRule->getAttribute('domain', '') !== $rule->getAttribute('domain', '') - ) { + if ($existingRule->isEmpty()) { + return true; + } + + if ($existingRule->getAttribute('domain', '') !== $rule->getAttribute('domain', '')) { return false; } From 0987b03e70c8e03e9e1c59e29bcc5397c5779e3f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 12 Jun 2026 09:37:06 +0530 Subject: [PATCH 108/151] Accept multipart ETag signatures for chunked uploads on S3 devices (#12585) * (test): accept multipart ETag signatures for chunked uploads on S3 devices * (test): guard against fopen failure in chunked signature helper --- tests/e2e/Services/Storage/StorageBase.php | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index d5a9765c60..3f823c38e9 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -24,6 +24,38 @@ trait StorageBase */ private static array $cachedZstdBucket = []; + /** + * Valid signatures for a chunk-uploaded file: the content MD5 on local + * devices, or the composite multipart ETag (md5 of part MD5s suffixed + * with the part count) on S3 devices. + */ + protected function getChunkedFileSignatures(string $path, int $chunkSize = 5 * 1024 * 1024): array + { + $signatures = [\md5_file($path)]; + + $handle = \fopen($path, 'rb'); + if ($handle === false) { + return $signatures; + } + $binary = ''; + $parts = 0; + while (!\feof($handle)) { + $chunk = \fread($handle, $chunkSize); + if ($chunk === '' || $chunk === false) { + break; + } + $binary .= \md5($chunk, true); + $parts++; + } + \fclose($handle); + + if ($parts > 1) { + $signatures[] = \md5($binary) . '-' . $parts; + } + + return $signatures; + } + /** * Helper method to set up bucket and file data for tests. * Uses static caching to avoid recreating resources. @@ -287,7 +319,7 @@ trait StorageBase $this->assertEquals('large-file.mp4', $largeFile['body']['name']); $this->assertEquals('video/mp4', $largeFile['body']['mimeType']); $this->assertEquals($totalSize, $largeFile['body']['sizeOriginal']); - $this->assertEquals(md5_file(realpath(__DIR__ . '/../../../resources/disk-a/large-file.mp4')), $largeFile['body']['signature']); // should validate that the file is not encrypted + $this->assertContains($largeFile['body']['signature'], $this->getChunkedFileSignatures(realpath(__DIR__ . '/../../../resources/disk-a/large-file.mp4'))); // should validate that the file is not encrypted /** * Failure From b242caa32bed7df16f5a41bd916ab14dd08159b9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 12 Jun 2026 12:19:28 +0530 Subject: [PATCH 109/151] Update utopia-php/dns to ^1.8 (#12586) --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 73224761c4..af7575c671 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,7 @@ "utopia-php/detector": "0.2.*", "utopia-php/domains": "^2.2", "utopia-php/emails": "0.7.*", - "utopia-php/dns": "1.7.*", + "utopia-php/dns": "^1.8", "utopia-php/dsn": "0.2.1", "utopia-php/http": "^2.0@RC", "utopia-php/fetch": "^1.1", diff --git a/composer.lock b/composer.lock index 3d198418c9..d886034bd3 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": "c8e8a31556be2ad12d15a25969c4d59f", + "content-hash": "fe6368e3d42f385c63d7e5e2e911febd", "packages": [ { "name": "adhocore/jwt", @@ -3835,16 +3835,16 @@ }, { "name": "utopia-php/dns", - "version": "1.7.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/utopia-php/dns.git", - "reference": "5ee1c165b381c05fea1ad9dd62263a5a854786f8" + "reference": "c09469c396c6f95888789151a3157fd0928e740b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/dns/zipball/5ee1c165b381c05fea1ad9dd62263a5a854786f8", - "reference": "5ee1c165b381c05fea1ad9dd62263a5a854786f8", + "url": "https://api.github.com/repos/utopia-php/dns/zipball/c09469c396c6f95888789151a3157fd0928e740b", + "reference": "c09469c396c6f95888789151a3157fd0928e740b", "shasum": "" }, "require": { @@ -3886,9 +3886,9 @@ ], "support": { "issues": "https://github.com/utopia-php/dns/issues", - "source": "https://github.com/utopia-php/dns/tree/1.7.3" + "source": "https://github.com/utopia-php/dns/tree/1.8.0" }, - "time": "2026-06-07T14:02:16+00:00" + "time": "2026-06-12T04:44:06+00:00" }, { "name": "utopia-php/domains", From 0197f4576df6c29fd3fa0e2e6e4f4b7269bd9d5b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 12 Jun 2026 13:08:05 +0530 Subject: [PATCH 110/151] bug: added the message increment in the message path as well --- app/realtime.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/realtime.php b/app/realtime.php index 8fb33723a4..39bdf103fe 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -1222,7 +1222,10 @@ $server->onMessage(function (int $connection, string $message) use ($container, $outboundBytes += $bytes; if ($project !== null && !$project->isEmpty()) { - triggerStats([METRIC_REALTIME_OUTBOUND => $bytes], $project->getId()); + triggerStats([ + METRIC_REALTIME_OUTBOUND => $bytes, + METRIC_REALTIME_CONNECTIONS_MESSAGES_SENT => 1, + ], $project->getId()); } } From a553db94b55839659000eeb2160a249c97362f78 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 12 Jun 2026 15:14:34 +0530 Subject: [PATCH 111/151] fix: preserve VCS repository record when providerRepositoryId is omitted in updateFunction/updateSite --- .../Functions/Http/Functions/Update.php | 10 ++++ .../Modules/Sites/Http/Sites/Update.php | 10 ++++ .../Functions/FunctionsCustomServerTest.php | 55 +++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 5fbe010f05..7b8e16d083 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -182,6 +182,16 @@ class Update extends Base $isConnected = !empty($function->getAttribute('providerRepositoryId', '')); + // If providerRepositoryId is omitted (null) and function is already connected, preserve existing VCS values + if ($isConnected && $providerRepositoryId === null) { + $providerRepositoryId = $function->getAttribute('providerRepositoryId', ''); + $installationId = $function->getAttribute('installationId', ''); + $providerBranch = $providerBranch ?: $function->getAttribute('providerBranch', ''); + $providerRootDirectory = $providerRootDirectory ?: $function->getAttribute('providerRootDirectory', ''); + $repositoryId = $function->getAttribute('repositoryId', ''); + $repositoryInternalId = $function->getAttribute('repositoryInternalId', ''); + } + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 6cb1905550..38374f036b 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -182,6 +182,16 @@ class Update extends Base $isConnected = !empty($site->getAttribute('providerRepositoryId', '')); + // If providerRepositoryId is omitted (null) and site is already connected, preserve existing VCS values + if ($isConnected && $providerRepositoryId === null) { + $providerRepositoryId = $site->getAttribute('providerRepositoryId', ''); + $installationId = $site->getAttribute('installationId', ''); + $providerBranch = $providerBranch ?: $site->getAttribute('providerBranch', ''); + $providerRootDirectory = $providerRootDirectory ?: $site->getAttribute('providerRootDirectory', ''); + $repositoryId = $site->getAttribute('repositoryId', ''); + $repositoryInternalId = $site->getAttribute('repositoryInternalId', ''); + } + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 726e73931c..0b6691ba7c 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -3311,4 +3311,59 @@ final class FunctionsCustomServerTest extends Scope $this->cleanupFunction($functionId); } } + + /** + * Regression test for: omitting providerRepositoryId in updateFunction must not silently + * clear the VCS connection while leaving the platform repository record intact. + * + * Before the fix, calling updateFunction without providerRepositoryId on a connected + * function would write null/empty to the function document (making it look disconnected + * in the console) but would NOT delete the repositories record in the platform DB, so + * GitHub webhooks would keep finding the record and keep triggering builds. + * + * This test covers the API-observable side: + * 1. Omitting providerRepositoryId on a non-connected function keeps the field empty. + * 2. Passing providerRepositoryId="" (explicit disconnect) on a non-connected function + * is a no-op and does not cause errors. + * + * The full scenario (connected function + omit providerRepositoryId) requires a live + * VCS installation and is validated in VCSCustomServerTest. + */ + public function testUpdateFunctionPreservesVcsOnOmittedProviderRepositoryId(): void + { + $functionId = $this->setupFunction([ + 'functionId' => ID::unique(), + 'name' => 'VCS Preserve Test', + 'runtime' => 'node-22', + 'entrypoint' => 'index.js', + 'commands' => '', + ]); + + // 1. Update without providerRepositoryId — field should stay empty, no error + $response = $this->updateFunction($functionId, [ + 'name' => 'VCS Preserve Test', + 'runtime' => 'node-22', + ]); + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame('', $response['body']['providerRepositoryId']); + $this->assertSame('', $response['body']['installationId']); + $this->assertSame('', $response['body']['providerBranch']); + + // 2. Update with providerRepositoryId="" explicit on non-connected function — no-op, no error + $response = $this->updateFunction($functionId, [ + 'name' => 'VCS Preserve Test', + 'runtime' => 'node-22', + 'providerRepositoryId' => '', + ]); + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame('', $response['body']['providerRepositoryId']); + + // 3. Verify GET also reflects the unchanged state + $response = $this->getFunction($functionId); + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame('', $response['body']['providerRepositoryId']); + $this->assertSame('', $response['body']['installationId']); + + $this->cleanupFunction($functionId); + } } From 6e581014054103b94a043aae7849dcbdd34fe0e8 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 12 Jun 2026 15:15:25 +0530 Subject: [PATCH 112/151] chore: trim comments --- .../Modules/Functions/Http/Functions/Update.php | 2 +- .../Modules/Sites/Http/Sites/Update.php | 2 +- .../Functions/FunctionsCustomServerTest.php | 17 ++--------------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 7b8e16d083..d1b5d21728 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -182,7 +182,7 @@ class Update extends Base $isConnected = !empty($function->getAttribute('providerRepositoryId', '')); - // If providerRepositoryId is omitted (null) and function is already connected, preserve existing VCS values + // Omitted providerRepositoryId (null) on a connected function — preserve existing VCS values if ($isConnected && $providerRepositoryId === null) { $providerRepositoryId = $function->getAttribute('providerRepositoryId', ''); $installationId = $function->getAttribute('installationId', ''); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 38374f036b..0e22fe8343 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -182,7 +182,7 @@ class Update extends Base $isConnected = !empty($site->getAttribute('providerRepositoryId', '')); - // If providerRepositoryId is omitted (null) and site is already connected, preserve existing VCS values + // Omitted providerRepositoryId (null) on a connected site — preserve existing VCS values if ($isConnected && $providerRepositoryId === null) { $providerRepositoryId = $site->getAttribute('providerRepositoryId', ''); $installationId = $site->getAttribute('installationId', ''); diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 0b6691ba7c..bfa8396615 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -3313,21 +3313,8 @@ final class FunctionsCustomServerTest extends Scope } /** - * Regression test for: omitting providerRepositoryId in updateFunction must not silently - * clear the VCS connection while leaving the platform repository record intact. - * - * Before the fix, calling updateFunction without providerRepositoryId on a connected - * function would write null/empty to the function document (making it look disconnected - * in the console) but would NOT delete the repositories record in the platform DB, so - * GitHub webhooks would keep finding the record and keep triggering builds. - * - * This test covers the API-observable side: - * 1. Omitting providerRepositoryId on a non-connected function keeps the field empty. - * 2. Passing providerRepositoryId="" (explicit disconnect) on a non-connected function - * is a no-op and does not cause errors. - * - * The full scenario (connected function + omit providerRepositoryId) requires a live - * VCS installation and is validated in VCSCustomServerTest. + * Regression: omitting providerRepositoryId must not clear VCS fields or leave + * the platform repository record orphaned (causing ghost GitHub builds). */ public function testUpdateFunctionPreservesVcsOnOmittedProviderRepositoryId(): void { From 7bff6e98825c573f2f944c7978cce7d141914832 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 12 Jun 2026 15:19:52 +0530 Subject: [PATCH 113/151] fix: re-fetch installation document after preserving VCS values, remove untestable test --- .../Functions/Http/Functions/Update.php | 1 + .../Modules/Sites/Http/Sites/Update.php | 1 + .../Functions/FunctionsCustomServerTest.php | 41 ------------------- 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index d1b5d21728..fd89651800 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -190,6 +190,7 @@ class Update extends Base $providerRootDirectory = $providerRootDirectory ?: $function->getAttribute('providerRootDirectory', ''); $repositoryId = $function->getAttribute('repositoryId', ''); $repositoryInternalId = $function->getAttribute('repositoryInternalId', ''); + $installation = $dbForPlatform->getDocument('installations', $installationId); } // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 0e22fe8343..be585ffdab 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -190,6 +190,7 @@ class Update extends Base $providerRootDirectory = $providerRootDirectory ?: $site->getAttribute('providerRootDirectory', ''); $repositoryId = $site->getAttribute('repositoryId', ''); $repositoryInternalId = $site->getAttribute('repositoryInternalId', ''); + $installation = $dbForPlatform->getDocument('installations', $installationId); } // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index bfa8396615..1aba466944 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -3312,45 +3312,4 @@ final class FunctionsCustomServerTest extends Scope } } - /** - * Regression: omitting providerRepositoryId must not clear VCS fields or leave - * the platform repository record orphaned (causing ghost GitHub builds). - */ - public function testUpdateFunctionPreservesVcsOnOmittedProviderRepositoryId(): void - { - $functionId = $this->setupFunction([ - 'functionId' => ID::unique(), - 'name' => 'VCS Preserve Test', - 'runtime' => 'node-22', - 'entrypoint' => 'index.js', - 'commands' => '', - ]); - - // 1. Update without providerRepositoryId — field should stay empty, no error - $response = $this->updateFunction($functionId, [ - 'name' => 'VCS Preserve Test', - 'runtime' => 'node-22', - ]); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['providerRepositoryId']); - $this->assertSame('', $response['body']['installationId']); - $this->assertSame('', $response['body']['providerBranch']); - - // 2. Update with providerRepositoryId="" explicit on non-connected function — no-op, no error - $response = $this->updateFunction($functionId, [ - 'name' => 'VCS Preserve Test', - 'runtime' => 'node-22', - 'providerRepositoryId' => '', - ]); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['providerRepositoryId']); - - // 3. Verify GET also reflects the unchanged state - $response = $this->getFunction($functionId); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['providerRepositoryId']); - $this->assertSame('', $response['body']['installationId']); - - $this->cleanupFunction($functionId); - } } From fb336e2c04128fc7a988aab95cf00479433bbb42 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 12 Jun 2026 15:22:30 +0530 Subject: [PATCH 114/151] test: add real VCS e2e test for omitted providerRepositoryId preserving connection --- .../e2e/Services/VCS/VCSConsoleClientTest.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index 513d2c1824..2d7e71ab28 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -653,6 +653,27 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals('main', $function['body']['providerBranch']); } + public function testUpdateFunctionOmitProviderRepositoryIdPreservesVcs(): void + { + $data = $this->setupFunctionUsingVCS(); + + // Omit providerRepositoryId entirely — should preserve VCS connection, not clear it + $function = $this->client->call(Client::METHOD_PUT, '/functions/' . $data['functionId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Test', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'timeout' => 10, + ]); + + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertNotEmpty($function['body']['providerRepositoryId']); + $this->assertNotEmpty($function['body']['installationId']); + $this->assertNotEmpty($function['body']['providerBranch']); + } + public function testCreateRepository(): void { $installationId = $this->setupInstallation(); From 802c47c0e7945152317b1c52b3d73d68053fa30f Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 12 Jun 2026 15:24:25 +0530 Subject: [PATCH 115/151] test: add real VCS e2e test for sites omitted providerRepositoryId preserving connection --- .../e2e/Services/VCS/VCSConsoleClientTest.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index 2d7e71ab28..041f825cee 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -674,6 +674,47 @@ final class VCSConsoleClientTest extends Scope $this->assertNotEmpty($function['body']['providerBranch']); } + public function testUpdateSiteOmitProviderRepositoryIdPreservesVcs(): void + { + $installationId = $this->setupInstallation(); + + $site = $this->client->call(Client::METHOD_POST, '/sites', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'siteId' => ID::unique(), + 'name' => 'Test Site VCS', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId3, + 'providerBranch' => 'main', + ]); + + $this->assertEquals(201, $site['headers']['status-code']); + $siteId = $site['body']['$id']; + + // Omit providerRepositoryId — should preserve VCS connection, not clear it + $updated = $this->client->call(Client::METHOD_PUT, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Test Site VCS', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + ]); + + $this->assertEquals(200, $updated['headers']['status-code']); + $this->assertNotEmpty($updated['body']['providerRepositoryId']); + $this->assertNotEmpty($updated['body']['installationId']); + $this->assertNotEmpty($updated['body']['providerBranch']); + + $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + } + public function testCreateRepository(): void { $installationId = $this->setupInstallation(); From 81a20a514578ffa8eb7c691592718c62f232938e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 12 Jun 2026 15:49:56 +0530 Subject: [PATCH 116/151] Update utopia-php/database to 5.9.2 (#12587) * (test): use utopia-php/database write-conflict retry branch for CI validation * (chore): update utopia-php/database to 5.9.2 * (test): fix flaky executor health check in Sites deployment polling The docker inspect health check in waitDeploymentReady treated empty stdout as an executor crash. When proc_open transiently fails under paratest load, Console::execute returns empty stdout/stderr, which threw a Critical and aborted the retry loop while the deployment was still building. Only throw when the inspect command itself succeeded and reported a non-zero exit code. --- composer.lock | 12 ++++++------ tests/e2e/Services/Sites/SitesBase.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index d886034bd3..703189e5f9 100644 --- a/composer.lock +++ b/composer.lock @@ -3682,16 +3682,16 @@ }, { "name": "utopia-php/database", - "version": "5.9.0", + "version": "5.9.2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "477bae83e27631f78c159f45b0441c0c7dc69050" + "reference": "698952455dd645ff41057621c90a4cea977fb1bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/477bae83e27631f78c159f45b0441c0c7dc69050", - "reference": "477bae83e27631f78c159f45b0441c0c7dc69050", + "url": "https://api.github.com/repos/utopia-php/database/zipball/698952455dd645ff41057621c90a4cea977fb1bf", + "reference": "698952455dd645ff41057621c90a4cea977fb1bf", "shasum": "" }, "require": { @@ -3736,9 +3736,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/5.9.0" + "source": "https://github.com/utopia-php/database/tree/5.9.2" }, - "time": "2026-05-17T15:57:21+00:00" + "time": "2026-06-12T08:33:14+00:00" }, { "name": "utopia-php/detector", diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 7ce6772c90..1f27ff45de 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -72,8 +72,8 @@ trait SitesBase throw new Critical('Deployment failed: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); } - Console::execute("docker inspect openruntimes-executor --format='{{.State.ExitCode}}'", '', $this->stdout, $this->stderr); - if (\trim($this->stdout) !== '0') { + $code = Console::execute("docker inspect openruntimes-executor --format='{{.State.ExitCode}}'", '', $this->stdout, $this->stderr); + if ($code === 0 && \trim($this->stdout) !== '' && \trim($this->stdout) !== '0') { $msg = 'Executor has a problem: ' . $this->stderr . ' (' . $this->stdout . '), current status: '; Console::execute("docker compose logs openruntimes-executor", '', $this->stdout, $this->stderr); From c6314d52a6d3637f99dfe3e8310ea491bce30b18 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 12 Jun 2026 14:41:09 +0400 Subject: [PATCH 117/151] Update executor to 0.24.1 --- .github/workflows/ci.yml | 6 +++--- app/views/install/compose.phtml | 2 +- docker-compose.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78e1ea5255..96b579c006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -429,7 +429,7 @@ jobs: - name: Wait for Open Runtimes timeout-minutes: 3 run: | - while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + while ! docker logs exc1 | grep -q "Executor is ready."; do echo "Waiting for Executor to come online" sleep 1 done @@ -525,7 +525,7 @@ jobs: - name: Wait for Open Runtimes timeout-minutes: 3 run: | - while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + while ! docker logs exc1 | grep -q "Executor is ready."; do echo "Waiting for Executor to come online" sleep 1 done @@ -678,7 +678,7 @@ jobs: - name: Wait for Open Runtimes timeout-minutes: 3 run: | - while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + while ! docker logs exc1 | grep -q "Executor is ready."; do echo "Waiting for Executor to come online" sleep 1 done diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index d401db9ce0..d71ccff0b4 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -988,7 +988,7 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); <<: *x-logging restart: unless-stopped stop_signal: SIGINT - image: openruntimes/executor:0.24.0 + image: openruntimes/executor:0.24.1 networks: - appwrite - runtimes diff --git a/docker-compose.yml b/docker-compose.yml index 3e05c90104..d4b2aacd03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1249,7 +1249,7 @@ services: hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.24.0 + image: openruntimes/executor:0.24.1 restart: unless-stopped networks: - appwrite From 5f23b0e8049f5239a079483ee7784dd7c4523b22 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 12 Jun 2026 23:22:02 +1200 Subject: [PATCH 118/151] fix: resolve data-plane database before writing collection metadata For a dedicated product database (documentsdb/vectorsdb on Cloud), the data-plane resolver throws while the database is still provisioning (the DSN is not published yet). Both collection create paths wrote the control-plane metadata row before resolving the data plane, so every create attempted against a provisioning database returned 409 but still persisted a collection row with no backing collection. The orphan lists fine in the API and console, but every document operation against it fails with 'Invalid document structure: Missing collection attribute $collection'. Resolve the data-plane database first so a provisioning (or otherwise unreachable) backend rejects the request before any metadata is written. Co-Authored-By: Claude Fable 5 --- .../Http/Databases/Collections/Create.php | 14 +++++++++----- .../Http/VectorsDB/Collections/Create.php | 9 +++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index a0ee24db87..b2e783bccd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -103,6 +103,15 @@ class Create extends Action // Map aggregate permissions into the multiple permissions they represent. $permissions = Permission::aggregate($permissions) ?? []; + // Resolve the data-plane database BEFORE writing the metadata row. For a + // dedicated product database this throws while provisioning (no DSN yet); + // writing the row first would leave an orphaned collection with no backing + // collection, which lists fine but fails every document operation. + /** + * @var Database $dbForDatabases + */ + $dbForDatabases = $getDatabasesDB($database); + try { $collection = $dbForProject->createDocument('database_' . $database->getSequence(), new Document([ '$id' => $collectionId, @@ -122,11 +131,6 @@ class Create extends Action throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } - /** - * @var Database $dbForDatabases - */ - $dbForDatabases = $getDatabasesDB($database); - $collectionKey = 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(); $databaseKey = 'database_' . $database->getSequence(); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php index 58433c7deb..3b346bb7c0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php @@ -94,6 +94,13 @@ class Create extends CollectionAction // Map aggregate permissions into the multiple permissions they represent. $permissions = Permission::aggregate($permissions) ?? []; + // Resolve the data-plane database BEFORE writing the metadata row. For a + // dedicated product database this throws while provisioning (no DSN yet); + // writing the row first would leave an orphaned collection with no backing + // collection, which lists fine but fails every document operation. + /** @var Database $dbForDatabases */ + $dbForDatabases = $getDatabasesDB($database); + try { $collection = $dbForProject->createDocument('database_' . $database->getSequence(), new Document([ '$id' => $collectionId, @@ -114,8 +121,6 @@ class Create extends CollectionAction } catch (NotFoundException) { throw new Exception(Exception::DATABASE_NOT_FOUND); } - /** @var Database $dbForDatabases */ - $dbForDatabases = $getDatabasesDB($database); $attributes = []; $indexes = []; From 7d785e7963eee062036c5cbdadea1d729088fc9b Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 15 Jun 2026 19:12:27 +0400 Subject: [PATCH 119/151] fix: disable build cache --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 2550db36e2..d01d82e2e7 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -732,7 +732,8 @@ class Builds extends Action variables: $vars, command: $command, outputDirectory: $outputDirectory ?? '', - cacheKey: $cacheKey + // temporarily disable build cache + // cacheKey: $cacheKey ); } catch (ExecutorTimeout $error) { From 4a9e9e050895ab4025c67a2d99ba1ee5a811ee3c Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 15 Jun 2026 19:29:45 +0400 Subject: [PATCH 120/151] fix: remove unused build cache capture --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index d01d82e2e7..3c8219cdf5 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -704,7 +704,7 @@ class Builds extends Action $span = Span::current(); Co::join([ - Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cacheKey, $cpus, $memory, $timeout, &$err, $version, $span) { + Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cpus, $memory, $timeout, &$err, $version, $span) { try { if ($version === 'v2') { $command = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh'; From fac754c6560876c560907694e5c29a5795fcdb73 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 16 Jun 2026 12:27:41 +0530 Subject: [PATCH 121/151] Add mails and messaging telemetry: send counters and span attributes (#12590) * (feat): add mails and messaging send telemetry counters and span attributes * (fix): address review - optional telemetry injection, cached counter, snake_case metric attribute * Update messaging telemetry integration * Move mails telemetry to messaging library * Restore mails worker spacing * Use constants for mail templates --- app/controllers/api/account.php | 4 ++ app/init/constants.php | 11 ++++ composer.json | 2 +- composer.lock | 17 ++++--- src/Appwrite/Bus/Listeners/Mails.php | 1 + src/Appwrite/Event/Message/Mail.php | 3 ++ .../Http/Account/MFA/Challenges/Create.php | 1 + .../Http/Project/SMTP/Tests/Create.php | 1 + .../Modules/Teams/Http/Memberships/Create.php | 1 + .../Platform/Workers/Certificates.php | 1 + src/Appwrite/Platform/Workers/Mails.php | 18 ++++++- src/Appwrite/Platform/Workers/Messaging.php | 50 +++++++++++++++++-- src/Appwrite/Platform/Workers/Migrations.php | 1 + src/Appwrite/Platform/Workers/Webhooks.php | 1 + tests/unit/Messaging/MessagingFanoutTest.php | 1 + 15 files changed, 98 insertions(+), 15 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index a050e97b17..5ecae9c635 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -2405,6 +2405,7 @@ Http::post('/v1/account/tokens/magic-url') project: $project, recipient: $email, subject: $subject, + template: MAIL_TEMPLATE_MAGIC_URL, body: $body, preview: $preview, smtp: $smtpConfig, @@ -2751,6 +2752,7 @@ Http::post('/v1/account/tokens/email') project: $project, recipient: $email, subject: $subject, + template: MAIL_TEMPLATE_OTP, bodyTemplate: $bodyTemplate, body: $body, preview: $preview, @@ -3868,6 +3870,7 @@ Http::post('/v1/account/recovery') recipient: $profile->getAttribute('email', ''), name: $profile->getAttribute('name', ''), subject: $subject, + template: MAIL_TEMPLATE_RECOVERY, body: $body, preview: $preview, smtp: $smtpConfig, @@ -4222,6 +4225,7 @@ Http::post('/v1/account/verifications/email') recipient: $user->getAttribute('email'), name: $user->getAttribute('name') ?? '', subject: $subject, + template: MAIL_TEMPLATE_VERIFICATION, bodyTemplate: $bodyTemplate, body: $body, preview: $preview, diff --git a/app/init/constants.php b/app/init/constants.php index 4fe7c418a9..66d56a321c 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -271,6 +271,17 @@ const FUNCTION_ALLOWLIST_HEADERS_RESPONSE = ['content-type', 'content-length']; const MESSAGE_TYPE_EMAIL = 'email'; const MESSAGE_TYPE_SMS = 'sms'; const MESSAGE_TYPE_PUSH = 'push'; +const MAIL_TEMPLATE_CERTIFICATE_FAILED = 'certificate-failed'; +const MAIL_TEMPLATE_DATA_EXPORT = 'data-export'; +const MAIL_TEMPLATE_INVITATION = 'invitation'; +const MAIL_TEMPLATE_MAGIC_URL = 'magic-url'; +const MAIL_TEMPLATE_MFA_CHALLENGE = 'mfa-challenge'; +const MAIL_TEMPLATE_OTP = 'otp'; +const MAIL_TEMPLATE_RECOVERY = 'recovery'; +const MAIL_TEMPLATE_SESSION_ALERT = 'session-alert'; +const MAIL_TEMPLATE_SMTP_TEST = 'smtp-test'; +const MAIL_TEMPLATE_VERIFICATION = 'verification'; +const MAIL_TEMPLATE_WEBHOOK_FAILED = 'webhook-failed'; // API key types const API_KEY_STANDARD = 'standard'; const API_KEY_EPHEMERAL = 'ephemeral'; diff --git a/composer.json b/composer.json index af7575c671..f6e2a35066 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,7 @@ "utopia-php/locale": "0.8.*", "utopia-php/lock": "0.2.*", "utopia-php/logger": "0.8.*", - "utopia-php/messaging": "1.0.*", + "utopia-php/messaging": "^1.1", "utopia-php/migration": "1.*", "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "1.*", diff --git a/composer.lock b/composer.lock index 703189e5f9..97674ae904 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": "fe6368e3d42f385c63d7e5e2e911febd", + "content-hash": "2dfcf2f234c0ef563a0ee4b47534ddc5", "packages": [ { "name": "adhocore/jwt", @@ -4354,16 +4354,16 @@ }, { "name": "utopia-php/messaging", - "version": "1.0.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "1aca8968c3bf3c78c428a399dfe97cbe9b366ec4" + "reference": "2a8e82cda89b373833e10923ae959f56466300a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/1aca8968c3bf3c78c428a399dfe97cbe9b366ec4", - "reference": "1aca8968c3bf3c78c428a399dfe97cbe9b366ec4", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/2a8e82cda89b373833e10923ae959f56466300a3", + "reference": "2a8e82cda89b373833e10923ae959f56466300a3", "shasum": "" }, "require": { @@ -4371,7 +4371,8 @@ "ext-openssl": "*", "giggsey/libphonenumber-for-php-lite": "9.0.23", "php": ">=8.1.0", - "phpmailer/phpmailer": "6.9.1" + "phpmailer/phpmailer": "6.9.1", + "utopia-php/telemetry": "^0.4" }, "require-dev": { "laravel/pint": "1.*", @@ -4399,9 +4400,9 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/1.0.0" + "source": "https://github.com/utopia-php/messaging/tree/1.1.0" }, - "time": "2026-06-02T14:54:22+00:00" + "time": "2026-06-16T03:44:58+00:00" }, { "name": "utopia-php/migration", diff --git a/src/Appwrite/Bus/Listeners/Mails.php b/src/Appwrite/Bus/Listeners/Mails.php index eb36e0d394..948394d8b6 100644 --- a/src/Appwrite/Bus/Listeners/Mails.php +++ b/src/Appwrite/Bus/Listeners/Mails.php @@ -143,6 +143,7 @@ class Mails extends Listener project: $project, recipient: $event->user['email'], subject: $subject, + template: MAIL_TEMPLATE_SESSION_ALERT, bodyTemplate: __DIR__ . '/../../../../app/config/locale/templates/' . $smtpBaseTemplate . '.tpl', body: $body, preview: $preview, diff --git a/src/Appwrite/Event/Message/Mail.php b/src/Appwrite/Event/Message/Mail.php index aeeea8a616..b823f107da 100644 --- a/src/Appwrite/Event/Message/Mail.php +++ b/src/Appwrite/Event/Message/Mail.php @@ -12,6 +12,7 @@ final class Mail extends Base public readonly string $recipient = '', public readonly string $name = '', public readonly string $subject = '', + public readonly string $template = '', public readonly string $bodyTemplate = '', public readonly string $body = '', public readonly string $preview = '', @@ -33,6 +34,7 @@ final class Mail extends Base 'recipient' => $this->recipient, 'name' => $this->name, 'subject' => $this->subject, + 'template' => $this->template, 'bodyTemplate' => $this->bodyTemplate, 'body' => $this->body, 'preview' => $this->preview, @@ -52,6 +54,7 @@ final class Mail extends Base recipient: $data['recipient'] ?? '', name: $data['name'] ?? '', subject: $data['subject'] ?? '', + template: $data['template'] ?? '', bodyTemplate: $data['bodyTemplate'] ?? '', body: $data['body'] ?? '', preview: $data['preview'] ?? '', diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php index 27d6f3e088..da6055fffd 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php @@ -336,6 +336,7 @@ class Create extends Action project: $project, recipient: $user->getAttribute('email'), subject: $subject, + template: MAIL_TEMPLATE_MFA_CHALLENGE, bodyTemplate: $bodyTemplate, body: $body, preview: $preview, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php index df5b650d5d..689ebcb097 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php @@ -152,6 +152,7 @@ class Create extends Action project: $project, recipient: $email, subject: $subject, + template: MAIL_TEMPLATE_SMTP_TEST, bodyTemplate: APP_CE_CONFIG_DIR . '/locale/templates/email-base-styled.tpl', body: $template->render(), smtp: [ diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php index 19d9237ff1..92db118c46 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php @@ -418,6 +418,7 @@ class Create extends Action recipient: $invitee->getAttribute('email'), name: $invitee->getAttribute('name', ''), subject: $subject, + template: MAIL_TEMPLATE_INVITATION, body: $body, preview: $preview, smtp: $smtpConfig, diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 4a31216599..89da7d01de 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -572,6 +572,7 @@ class Certificates extends Action recipient: System::getEnv('_APP_EMAIL_CERTIFICATES', System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS')), name: 'Appwrite Administrator', subject: $subject, + template: MAIL_TEMPLATE_CERTIFICATE_FAILED, bodyTemplate: __DIR__ . '/../../../../app/config/locale/templates/email-base-styled.tpl', body: $body, preview: $preview, diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 5cd4639988..48cb58722d 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -14,7 +14,9 @@ use Utopia\Messaging\Messages\Email\Attachment; use Utopia\Platform\Action; use Utopia\Queue\Message; use Utopia\Registry\Registry; +use Utopia\Span\Span; use Utopia\System\System; +use Utopia\Telemetry\Adapter as Telemetry; class Mails extends Action { @@ -39,6 +41,7 @@ class Mails extends Action ->inject('project') ->inject('register') ->inject('log') + ->inject('telemetry') ->callback($this->action(...)); } @@ -55,10 +58,11 @@ class Mails extends Action * @param Document $project * @param Registry $register * @param Log $log + * @param Telemetry $telemetry * @return void * @throws Exception */ - public function action(Message $message, Document $project, Registry $register, Log $log): void + public function action(Message $message, Document $project, Registry $register, Log $log, Telemetry $telemetry): void { Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); $payload = $message->getPayload(); @@ -81,6 +85,12 @@ class Mails extends Action $recipient = $payload['recipient']; $subject = $payload['subject']; + $template = $payload['template'] ?? 'unknown'; + $recipientDomain = \strtolower(\substr(\strrchr($recipient, '@') ?: '', 1)); + + Span::add('mail.template', $template); + Span::add('mail.smtp_type', $type); + Span::add('mail.recipient_domain', $recipientDomain); $variables = $payload['variables']; $variables['host'] = $protocol . '://' . $hostname; $name = $payload['name']; @@ -150,6 +160,7 @@ class Mails extends Action keepAlive: true, timelimit: 30, ); + $adapter->setTelemetry($telemetry); // Resolve from/replyTo using fallback hierarchy: Custom options > SMTP config > Defaults $defaultFromEmail = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); @@ -202,14 +213,19 @@ class Mails extends Action attachments: $attachments, html: true, ); + $emailMessage->setOrigin(MESSAGE_SEND_TYPE_INTERNAL); try { $adapter->send($emailMessage); } catch (\Throwable $error) { + Span::add('mail.status', 'failure'); + if ($type === 'smtp') { throw new Exception('Error sending mail: ' . $error->getMessage(), 401); } throw new Exception('Error sending mail: ' . $error->getMessage(), 500); } + + Span::add('mail.status', 'success'); } } diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index ddd7edf641..2a827f82cb 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -49,6 +49,7 @@ use Utopia\Storage\Device; use Utopia\Storage\Device\Local; use Utopia\Storage\Storage; use Utopia\System\System; +use Utopia\Telemetry\Adapter as Telemetry; use function Swoole\Coroutine\batch; @@ -56,6 +57,8 @@ class Messaging extends Action { private ?SMSAdapter $adapter = null; + private Telemetry $telemetry; + public static function getName(): string { return 'messaging'; @@ -74,6 +77,7 @@ class Messaging extends Action ->inject('dbForProject') ->inject('deviceForFiles') ->inject('publisherForUsage') + ->inject('telemetry') ->callback($this->action(...)); } @@ -84,6 +88,7 @@ class Messaging extends Action * @param Database $dbForProject * @param Device $deviceForFiles * @param UsagePublisher $publisherForUsage + * @param Telemetry $telemetry * @return void * @throws \Exception */ @@ -93,9 +98,12 @@ class Messaging extends Action Log $log, Database $dbForProject, Device $deviceForFiles, - UsagePublisher $publisherForUsage + UsagePublisher $publisherForUsage, + Telemetry $telemetry ): void { Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); + + $this->telemetry = $telemetry; $payload = $message->getPayload(); if (empty($payload)) { @@ -143,6 +151,8 @@ class Messaging extends Action $userIds = $message->getAttribute('users', []); $providerType = $message->getAttribute('providerType'); + Span::add('message.provider_type', $providerType); + $default = $dbForProject->findOne('providers', [ Query::equal('enabled', [true]), Query::equal('type', [$providerType]), @@ -268,6 +278,11 @@ class Messaging extends Action $message->setAttribute('search', "{$message->getAttribute('search')} {$provider->getAttribute('name')} {$provider->getAttribute('provider')} {$provider->getAttribute('type')}"); } + Span::add('message.providers', \implode(',', \array_unique(\array_map( + fn (Document $provider) => $provider->getAttribute('provider'), + \array_values($providers) + )))); + $message->setAttribute('deliveredTotal', $deliveredTotal); $message->setAttribute('deliveredAt', DateTime::now()); @@ -533,6 +548,7 @@ class Messaging extends Action ] = $this->retrySend($batch, $message, $provider, $providerType, $adapter, $dbForProject, $deviceForFiles, $project); $failed = $recipients - $delivered; + $usage = new UsageContext(); $usage ->addMetric(METRIC_MESSAGES, $recipients) @@ -758,12 +774,16 @@ class Messaging extends Action $messageData = clone $message; $messageData->setAttribute('to', $to); - return match ($providerType) { + $data = match ($providerType) { MESSAGE_TYPE_SMS => $this->buildSmsMessage($messageData, $provider), MESSAGE_TYPE_PUSH => $this->buildPushMessage($messageData), MESSAGE_TYPE_EMAIL => $this->buildEmailMessage($dbForProject, $messageData, $provider, $deviceForFiles, $project), default => throw new \Exception('Provider with the requested ID is of the incorrect type') }; + + $data->setOrigin(MESSAGE_SEND_TYPE_EXTERNAL); + + return $data; } private function sendInternalSMSMessage(Document $message, Document $project, array $recipients, Log $log): void @@ -802,6 +822,7 @@ class Messaging extends Action $message->getAttribute('data')['content'], $from ); + $sms->setOrigin(MESSAGE_SEND_TYPE_INTERNAL); $this->adapter->send($sms); } @@ -811,7 +832,7 @@ class Messaging extends Action { $credentials = $provider->getAttribute('credentials'); - return match ($provider->getAttribute('provider')) { + $adapter = match ($provider->getAttribute('provider')) { 'mock' => (new Mock('username', 'password'))->setEndpoint('http://request-catcher-sms:5000/'), 'twilio' => new Twilio( $credentials['accountSid'] ?? '', @@ -848,6 +869,12 @@ class Messaging extends Action ), default => null }; + + if ($adapter !== null) { + $adapter->setTelemetry($this->telemetry); + } + + return $adapter; } protected function getPushAdapter(Document $provider): ?PushAdapter @@ -855,7 +882,7 @@ class Messaging extends Action $credentials = $provider->getAttribute('credentials'); $options = $provider->getAttribute('options'); - return match ($provider->getAttribute('provider')) { + $adapter = match ($provider->getAttribute('provider')) { 'mock' => new Mock('username', 'password'), 'apns' => new APNS( $credentials['authKey'] ?? '', @@ -867,6 +894,12 @@ class Messaging extends Action 'fcm' => new FCM(\json_encode($credentials['serviceAccountJSON'])), default => null }; + + if ($adapter !== null) { + $adapter->setTelemetry($this->telemetry); + } + + return $adapter; } protected function getEmailAdapter(Document $provider): ?EmailAdapter @@ -875,7 +908,7 @@ class Messaging extends Action $options = $provider->getAttribute('options', []); $apiKey = $credentials['apiKey'] ?? ''; - return match ($provider->getAttribute('provider')) { + $adapter = match ($provider->getAttribute('provider')) { 'mock' => new Mock('username', 'password'), 'smtp' => new SMTP( $credentials['host'] ?? '', @@ -901,6 +934,12 @@ class Messaging extends Action ), default => null }; + + if ($adapter !== null) { + $adapter->setTelemetry($this->telemetry); + } + + return $adapter; } private function buildEmailMessage( @@ -1117,6 +1156,7 @@ class Messaging extends Action $defaultProvider = $this->createProviderFromDSN($defaultDSN); $adapter = $this->getSmsAdapter($defaultProvider); $geosms = new GEOSMS($adapter); + $geosms->setTelemetry($this->telemetry); /** @var DSN $localDSN */ foreach ($localDSNs as $localDSN) { diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index a6f65fc742..825caf764d 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -947,6 +947,7 @@ class Migrations extends Action recipient: $user->getAttribute('email'), name: $user->getAttribute('name', $user->getAttribute('email')), subject: $subject, + template: MAIL_TEMPLATE_DATA_EXPORT, bodyTemplate: __DIR__ . '/../../../../app/config/locale/templates/email-base-styled.tpl', body: $emailBody, preview: $preview, diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index d91425d59b..593fd39767 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -272,6 +272,7 @@ class Webhooks extends Action recipient: $user->getAttribute('email'), name: $user->getAttribute('name', ''), subject: $subject, + template: MAIL_TEMPLATE_WEBHOOK_FAILED, body: $body->render(), preview: $preview, variables: ['user' => $user->getAttribute('name', '')], diff --git a/tests/unit/Messaging/MessagingFanoutTest.php b/tests/unit/Messaging/MessagingFanoutTest.php index 78172a5a0e..75f01b902b 100644 --- a/tests/unit/Messaging/MessagingFanoutTest.php +++ b/tests/unit/Messaging/MessagingFanoutTest.php @@ -558,6 +558,7 @@ class ScriptedEmailAdapter extends EmailAdapter */ public function __construct(private readonly array $script = []) { + parent::__construct(); } public function getName(): string From c9f0719783f323798a24b0d2a351fadc43ff08d5 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 16 Jun 2026 12:31:41 +0530 Subject: [PATCH 122/151] test: add e2e test for cross-project installation validation --- .../e2e/Services/VCS/VCSConsoleClientTest.php | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index 041f825cee..f3d41ebda4 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -715,6 +715,98 @@ final class VCSConsoleClientTest extends Scope ], $this->getHeaders())); } + public function testCrossProjectInstallationRejected(): void + { + $installationId = $this->setupInstallation(); + + // Create a second project + $team = $this->client->call(Client::METHOD_POST, '/teams', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'x-appwrite-project' => 'console', + ], ['teamId' => ID::unique(), 'name' => 'Cross Project Team']); + + $project2 = $this->client->call(Client::METHOD_POST, '/projects', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'x-appwrite-project' => 'console', + ], [ + 'projectId' => ID::unique(), + 'name' => 'Cross Project Test', + 'teamId' => $team['body']['$id'], + 'region' => System::getEnv('_APP_REGION', 'default'), + ]); + + $this->assertEquals(201, $project2['headers']['status-code']); + $project2Id = $project2['body']['$id']; + + $key = $this->client->call(Client::METHOD_POST, '/projects/' . $project2Id . '/keys', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'x-appwrite-project' => 'console', + ], [ + 'keyId' => ID::unique(), + 'name' => 'Test Key', + 'scopes' => ['functions.write', 'sites.write'], + ]); + + $headers2 = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $project2Id, + 'x-appwrite-key' => $key['body']['secret'], + ]; + + // createFunction with installation from project 1 → should fail + $function = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ + 'functionId' => ID::unique(), + 'name' => 'Test Cross', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId, + 'providerBranch' => 'main', + ]); + + $this->assertEquals(404, $function['headers']['status-code']); + + // createSite with installation from project 1 → should fail + $site = $this->client->call(Client::METHOD_POST, '/sites', $headers2, [ + 'siteId' => ID::unique(), + 'name' => 'Test Cross Site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId3, + 'providerBranch' => 'main', + ]); + + $this->assertEquals(404, $site['headers']['status-code']); + + // Create a function in project 2 (no VCS), then try updateFunction with cross-project installation + $fn = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ + 'functionId' => ID::unique(), + 'name' => 'Test No VCS', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + ]); + + $this->assertEquals(201, $fn['headers']['status-code']); + + $updated = $this->client->call(Client::METHOD_PUT, '/functions/' . $fn['body']['$id'], $headers2, [ + 'name' => 'Test No VCS', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId, + 'providerBranch' => 'main', + ]); + + $this->assertEquals(404, $updated['headers']['status-code']); + } + public function testCreateRepository(): void { $installationId = $this->setupInstallation(); From 9a14d9b441972bb90350b40c536ac9d19f49d3d9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 16 Jun 2026 12:39:00 +0530 Subject: [PATCH 123/151] Expose ping in SDK specs (#12604) --- app/controllers/general.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 94caf4760d..9ff704ca20 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -14,6 +14,7 @@ use Appwrite\Event\Publisher\Delete as DeletePublisher; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Network\Cors; use Appwrite\Platform\Appwrite; +use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Transformation\Adapter\Preview; @@ -1662,11 +1663,10 @@ Http::get('/v1/ping') namespace: 'ping', group: null, name: 'get', - hide: true, description: << Date: Tue, 16 Jun 2026 12:50:33 +0530 Subject: [PATCH 124/151] test: fix cross-project installation test setup and coverage --- .../e2e/Services/VCS/VCSConsoleClientTest.php | 130 ++++++++++-------- 1 file changed, 72 insertions(+), 58 deletions(-) diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index f3d41ebda4..e936013a90 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -718,40 +718,34 @@ final class VCSConsoleClientTest extends Scope public function testCrossProjectInstallationRejected(): void { $installationId = $this->setupInstallation(); - - // Create a second project - $team = $this->client->call(Client::METHOD_POST, '/teams', [ + $consoleHeaders = [ 'origin' => 'http://localhost', 'content-type' => 'application/json', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], 'x-appwrite-project' => 'console', - ], ['teamId' => ID::unique(), 'name' => 'Cross Project Team']); + ]; - $project2 = $this->client->call(Client::METHOD_POST, '/projects', [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - 'x-appwrite-project' => 'console', - ], [ + $team = $this->client->call(Client::METHOD_POST, '/teams', $consoleHeaders, [ + 'teamId' => ID::unique(), + 'name' => 'Cross Project Team', + ]); + $this->assertEquals(201, $team['headers']['status-code']); + + $project2 = $this->client->call(Client::METHOD_POST, '/projects', $consoleHeaders, [ 'projectId' => ID::unique(), 'name' => 'Cross Project Test', 'teamId' => $team['body']['$id'], 'region' => System::getEnv('_APP_REGION', 'default'), ]); - $this->assertEquals(201, $project2['headers']['status-code']); $project2Id = $project2['body']['$id']; - $key = $this->client->call(Client::METHOD_POST, '/projects/' . $project2Id . '/keys', [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - 'x-appwrite-project' => 'console', - ], [ + $key = $this->client->call(Client::METHOD_POST, '/projects/' . $project2Id . '/keys', $consoleHeaders, [ 'keyId' => ID::unique(), 'name' => 'Test Key', 'scopes' => ['functions.write', 'sites.write'], ]); + $this->assertEquals(201, $key['headers']['status-code']); $headers2 = [ 'content-type' => 'application/json', @@ -759,52 +753,72 @@ final class VCSConsoleClientTest extends Scope 'x-appwrite-key' => $key['body']['secret'], ]; - // createFunction with installation from project 1 → should fail - $function = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ - 'functionId' => ID::unique(), - 'name' => 'Test Cross', - 'runtime' => 'php-8.0', - 'entrypoint' => 'index.php', - 'installationId' => $installationId, - 'providerRepositoryId' => $this->providerRepositoryId, - 'providerBranch' => 'main', - ]); + try { + // createFunction with installation from project 1 → should fail + $function = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ + 'functionId' => ID::unique(), + 'name' => 'Test Cross', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId, + 'providerBranch' => 'main', + ]); + $this->assertEquals(404, $function['headers']['status-code']); - $this->assertEquals(404, $function['headers']['status-code']); + // createSite with installation from project 1 → should fail + $site = $this->client->call(Client::METHOD_POST, '/sites', $headers2, [ + 'siteId' => ID::unique(), + 'name' => 'Test Cross Site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId3, + 'providerBranch' => 'main', + ]); + $this->assertEquals(404, $site['headers']['status-code']); - // createSite with installation from project 1 → should fail - $site = $this->client->call(Client::METHOD_POST, '/sites', $headers2, [ - 'siteId' => ID::unique(), - 'name' => 'Test Cross Site', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'installationId' => $installationId, - 'providerRepositoryId' => $this->providerRepositoryId3, - 'providerBranch' => 'main', - ]); + // updateFunction with cross-project installation → should fail + $fn = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ + 'functionId' => ID::unique(), + 'name' => 'Test No VCS', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + ]); + $this->assertEquals(201, $fn['headers']['status-code']); - $this->assertEquals(404, $site['headers']['status-code']); + $updated = $this->client->call(Client::METHOD_PUT, '/functions/' . $fn['body']['$id'], $headers2, [ + 'name' => 'Test No VCS', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId, + 'providerBranch' => 'main', + ]); + $this->assertEquals(404, $updated['headers']['status-code']); - // Create a function in project 2 (no VCS), then try updateFunction with cross-project installation - $fn = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ - 'functionId' => ID::unique(), - 'name' => 'Test No VCS', - 'runtime' => 'php-8.0', - 'entrypoint' => 'index.php', - ]); + // updateSite with cross-project installation → should fail + $siteNoVcs = $this->client->call(Client::METHOD_POST, '/sites', $headers2, [ + 'siteId' => ID::unique(), + 'name' => 'Test No VCS Site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + ]); + $this->assertEquals(201, $siteNoVcs['headers']['status-code']); - $this->assertEquals(201, $fn['headers']['status-code']); - - $updated = $this->client->call(Client::METHOD_PUT, '/functions/' . $fn['body']['$id'], $headers2, [ - 'name' => 'Test No VCS', - 'runtime' => 'php-8.0', - 'entrypoint' => 'index.php', - 'installationId' => $installationId, - 'providerRepositoryId' => $this->providerRepositoryId, - 'providerBranch' => 'main', - ]); - - $this->assertEquals(404, $updated['headers']['status-code']); + $updatedSite = $this->client->call(Client::METHOD_PUT, '/sites/' . $siteNoVcs['body']['$id'], $headers2, [ + 'name' => 'Test No VCS Site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId3, + 'providerBranch' => 'main', + ]); + $this->assertEquals(404, $updatedSite['headers']['status-code']); + } finally { + $this->client->call(Client::METHOD_DELETE, '/projects/' . $project2Id, $consoleHeaders); + $this->client->call(Client::METHOD_DELETE, '/teams/' . $team['body']['$id'], $consoleHeaders); + } } public function testCreateRepository(): void From b2ae1eaf6f5151686b7273871d87a73797f8f8cb Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 16 Jun 2026 12:59:00 +0530 Subject: [PATCH 125/151] fix: reject cross-project installationId on VCS attach --- .../Functions/Http/Functions/Create.php | 4 ++ .../Functions/Http/Functions/Update.php | 4 ++ .../Modules/Sites/Http/Sites/Create.php | 4 ++ .../Modules/Sites/Http/Sites/Update.php | 4 ++ .../e2e/Services/VCS/VCSConsoleClientTest.php | 66 +++++++++++-------- 5 files changed, 53 insertions(+), 29 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 601025c794..2692eaf630 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -218,6 +218,10 @@ class Create extends Base throw new Exception(Exception::INSTALLATION_NOT_FOUND); } + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); } diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index fd89651800..323d460aab 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -165,6 +165,10 @@ class Update extends Base throw new Exception(Exception::INSTALLATION_NOT_FOUND); } + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); } diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php index e167c88af2..a774c31a0f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -150,6 +150,10 @@ class Create extends Base throw new Exception(Exception::INSTALLATION_NOT_FOUND); } + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); } diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index be585ffdab..bda471886a 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -169,6 +169,10 @@ class Update extends Base throw new Exception(Exception::INSTALLATION_NOT_FOUND); } + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); } diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index e936013a90..f0942771ea 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -725,35 +725,39 @@ final class VCSConsoleClientTest extends Scope 'x-appwrite-project' => 'console', ]; - $team = $this->client->call(Client::METHOD_POST, '/teams', $consoleHeaders, [ - 'teamId' => ID::unique(), - 'name' => 'Cross Project Team', - ]); - $this->assertEquals(201, $team['headers']['status-code']); - - $project2 = $this->client->call(Client::METHOD_POST, '/projects', $consoleHeaders, [ - 'projectId' => ID::unique(), - 'name' => 'Cross Project Test', - 'teamId' => $team['body']['$id'], - 'region' => System::getEnv('_APP_REGION', 'default'), - ]); - $this->assertEquals(201, $project2['headers']['status-code']); - $project2Id = $project2['body']['$id']; - - $key = $this->client->call(Client::METHOD_POST, '/projects/' . $project2Id . '/keys', $consoleHeaders, [ - 'keyId' => ID::unique(), - 'name' => 'Test Key', - 'scopes' => ['functions.write', 'sites.write'], - ]); - $this->assertEquals(201, $key['headers']['status-code']); - - $headers2 = [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $project2Id, - 'x-appwrite-key' => $key['body']['secret'], - ]; + $teamId = null; + $project2Id = null; try { + $team = $this->client->call(Client::METHOD_POST, '/teams', $consoleHeaders, [ + 'teamId' => ID::unique(), + 'name' => 'Cross Project Team', + ]); + $this->assertEquals(201, $team['headers']['status-code']); + $teamId = $team['body']['$id']; + + $project2 = $this->client->call(Client::METHOD_POST, '/projects', $consoleHeaders, [ + 'projectId' => ID::unique(), + 'name' => 'Cross Project Test', + 'teamId' => $teamId, + 'region' => System::getEnv('_APP_REGION', 'default'), + ]); + $this->assertEquals(201, $project2['headers']['status-code']); + $project2Id = $project2['body']['$id']; + + $key = $this->client->call(Client::METHOD_POST, '/projects/' . $project2Id . '/keys', $consoleHeaders, [ + 'keyId' => ID::unique(), + 'name' => 'Test Key', + 'scopes' => ['functions.write', 'sites.write'], + ]); + $this->assertEquals(201, $key['headers']['status-code']); + + $headers2 = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $project2Id, + 'x-appwrite-key' => $key['body']['secret'], + ]; + // createFunction with installation from project 1 → should fail $function = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ 'functionId' => ID::unique(), @@ -816,8 +820,12 @@ final class VCSConsoleClientTest extends Scope ]); $this->assertEquals(404, $updatedSite['headers']['status-code']); } finally { - $this->client->call(Client::METHOD_DELETE, '/projects/' . $project2Id, $consoleHeaders); - $this->client->call(Client::METHOD_DELETE, '/teams/' . $team['body']['$id'], $consoleHeaders); + if ($project2Id !== null) { + $this->client->call(Client::METHOD_DELETE, '/projects/' . $project2Id, $consoleHeaders); + } + if ($teamId !== null) { + $this->client->call(Client::METHOD_DELETE, '/teams/' . $teamId, $consoleHeaders); + } } } From ec9383e8c1fa514c02ec5f39ad3c779141198353 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 16 Jun 2026 13:26:13 +0530 Subject: [PATCH 126/151] ci: trigger VCS tests with credentials From 5b999ea2fa66acf0c2e08d7a019061dfc01bdd42 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 16 Jun 2026 14:01:04 +0530 Subject: [PATCH 127/151] fix: validate preserved installation ownership in update paths --- .../Functions/Http/Functions/Update.php | 12 ++++--- .../Modules/Sites/Http/Sites/Update.php | 12 ++++--- .../e2e/Services/VCS/VCSConsoleClientTest.php | 32 +++++++++---------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 323d460aab..52943d7ab9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -165,10 +165,6 @@ class Update extends Base throw new Exception(Exception::INSTALLATION_NOT_FOUND); } - if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { - throw new Exception(Exception::INSTALLATION_NOT_FOUND); - } - if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); } @@ -186,6 +182,10 @@ class Update extends Base $isConnected = !empty($function->getAttribute('providerRepositoryId', '')); + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + // Omitted providerRepositoryId (null) on a connected function — preserve existing VCS values if ($isConnected && $providerRepositoryId === null) { $providerRepositoryId = $function->getAttribute('providerRepositoryId', ''); @@ -197,6 +197,10 @@ class Update extends Base $installation = $dbForPlatform->getDocument('installations', $installationId); } + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index bda471886a..4b1e030be0 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -169,10 +169,6 @@ class Update extends Base throw new Exception(Exception::INSTALLATION_NOT_FOUND); } - if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { - throw new Exception(Exception::INSTALLATION_NOT_FOUND); - } - if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); } @@ -186,6 +182,10 @@ class Update extends Base $isConnected = !empty($site->getAttribute('providerRepositoryId', '')); + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + // Omitted providerRepositoryId (null) on a connected site — preserve existing VCS values if ($isConnected && $providerRepositoryId === null) { $providerRepositoryId = $site->getAttribute('providerRepositoryId', ''); @@ -197,6 +197,10 @@ class Update extends Base $installation = $dbForPlatform->getDocument('installations', $installationId); } + if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index f0942771ea..b553a59ebd 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -22,11 +22,11 @@ final class VCSConsoleClientTest extends Scope use ProjectCustom; use SideConsole; - public string $providerInstallationId = '42954928'; // appwrite-test - public string $providerRepositoryId = '705764267'; // ruby-starter (public) - public string $providerRepositoryId2 = '708688544'; // function1.4 (private) - public string $providerRepositoryId3 = '943139433'; // svelte-starter (public) - public string $providerRepositoryId4 = '943245292'; // templates-for-sites (public) + public string $providerInstallationId = '140618770'; // appwrite-test + public string $providerRepositoryId = '1263962253'; // ruby-starter (public) + public string $providerRepositoryId2 = '1263962253'; // function1.4 (private) + public string $providerRepositoryId3 = '1263962253'; // svelte-starter (public) + public string $providerRepositoryId4 = '1263962253'; // templates-for-sites (public) private static array $cachedInstallationId = []; private static array $cachedFunctionData = []; @@ -75,7 +75,7 @@ final class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'node-22', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -600,7 +600,7 @@ final class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'node-22', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -615,9 +615,9 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); $this->assertEquals('Test', $function['body']['name']); - $this->assertEquals('php-8.0', $function['body']['runtime']); + $this->assertEquals('node-22', $function['body']['runtime']); $this->assertEquals('index.php', $function['body']['entrypoint']); - $this->assertEquals('705764267', $function['body']['providerRepositoryId']); + $this->assertEquals('1263962253', $function['body']['providerRepositoryId']); $this->assertEquals('main', $function['body']['providerBranch']); } @@ -632,7 +632,7 @@ final class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'node-22', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -647,9 +647,9 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals(200, $function['headers']['status-code']); $this->assertEquals('Test', $function['body']['name']); - $this->assertEquals('php-8.0', $function['body']['runtime']); + $this->assertEquals('node-22', $function['body']['runtime']); $this->assertEquals('index.php', $function['body']['entrypoint']); - $this->assertEquals('708688544', $function['body']['providerRepositoryId']); + $this->assertEquals('1263962253', $function['body']['providerRepositoryId']); $this->assertEquals('main', $function['body']['providerBranch']); } @@ -663,7 +663,7 @@ final class VCSConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'node-22', 'entrypoint' => 'index.php', 'timeout' => 10, ]); @@ -762,7 +762,7 @@ final class VCSConsoleClientTest extends Scope $function = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ 'functionId' => ID::unique(), 'name' => 'Test Cross', - 'runtime' => 'php-8.0', + 'runtime' => 'node-22', 'entrypoint' => 'index.php', 'installationId' => $installationId, 'providerRepositoryId' => $this->providerRepositoryId, @@ -786,14 +786,14 @@ final class VCSConsoleClientTest extends Scope $fn = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ 'functionId' => ID::unique(), 'name' => 'Test No VCS', - 'runtime' => 'php-8.0', + 'runtime' => 'node-22', 'entrypoint' => 'index.php', ]); $this->assertEquals(201, $fn['headers']['status-code']); $updated = $this->client->call(Client::METHOD_PUT, '/functions/' . $fn['body']['$id'], $headers2, [ 'name' => 'Test No VCS', - 'runtime' => 'php-8.0', + 'runtime' => 'node-22', 'entrypoint' => 'index.php', 'installationId' => $installationId, 'providerRepositoryId' => $this->providerRepositoryId, From a9edcd74bd1509688a300d295139442c9e542b98 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 16 Jun 2026 14:02:33 +0530 Subject: [PATCH 128/151] fix: remove redundant post-preservation ownership check --- .../Platform/Modules/Functions/Http/Functions/Update.php | 4 ---- src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 52943d7ab9..e9e14a6e22 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -197,10 +197,6 @@ class Update extends Base $installation = $dbForPlatform->getDocument('installations', $installationId); } - if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { - throw new Exception(Exception::INSTALLATION_NOT_FOUND); - } - // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 4b1e030be0..1edc5ce87c 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -197,10 +197,6 @@ class Update extends Base $installation = $dbForPlatform->getDocument('installations', $installationId); } - if (!empty($installationId) && $installation->getAttribute('projectId') !== $project->getId()) { - throw new Exception(Exception::INSTALLATION_NOT_FOUND); - } - // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ From a7cb1148e910293b7e72531bc88e4e03d6ab1901 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 16 Jun 2026 14:07:34 +0530 Subject: [PATCH 129/151] test: restore original CI credentials in VCS test file --- .../e2e/Services/VCS/VCSConsoleClientTest.php | 98 +++++++++---------- 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index b553a59ebd..e936013a90 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -22,11 +22,11 @@ final class VCSConsoleClientTest extends Scope use ProjectCustom; use SideConsole; - public string $providerInstallationId = '140618770'; // appwrite-test - public string $providerRepositoryId = '1263962253'; // ruby-starter (public) - public string $providerRepositoryId2 = '1263962253'; // function1.4 (private) - public string $providerRepositoryId3 = '1263962253'; // svelte-starter (public) - public string $providerRepositoryId4 = '1263962253'; // templates-for-sites (public) + public string $providerInstallationId = '42954928'; // appwrite-test + public string $providerRepositoryId = '705764267'; // ruby-starter (public) + public string $providerRepositoryId2 = '708688544'; // function1.4 (private) + public string $providerRepositoryId3 = '943139433'; // svelte-starter (public) + public string $providerRepositoryId4 = '943245292'; // templates-for-sites (public) private static array $cachedInstallationId = []; private static array $cachedFunctionData = []; @@ -75,7 +75,7 @@ final class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'node-22', + 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -600,7 +600,7 @@ final class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'node-22', + 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -615,9 +615,9 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); $this->assertEquals('Test', $function['body']['name']); - $this->assertEquals('node-22', $function['body']['runtime']); + $this->assertEquals('php-8.0', $function['body']['runtime']); $this->assertEquals('index.php', $function['body']['entrypoint']); - $this->assertEquals('1263962253', $function['body']['providerRepositoryId']); + $this->assertEquals('705764267', $function['body']['providerRepositoryId']); $this->assertEquals('main', $function['body']['providerBranch']); } @@ -632,7 +632,7 @@ final class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'node-22', + 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -647,9 +647,9 @@ final class VCSConsoleClientTest extends Scope $this->assertEquals(200, $function['headers']['status-code']); $this->assertEquals('Test', $function['body']['name']); - $this->assertEquals('node-22', $function['body']['runtime']); + $this->assertEquals('php-8.0', $function['body']['runtime']); $this->assertEquals('index.php', $function['body']['entrypoint']); - $this->assertEquals('1263962253', $function['body']['providerRepositoryId']); + $this->assertEquals('708688544', $function['body']['providerRepositoryId']); $this->assertEquals('main', $function['body']['providerBranch']); } @@ -663,7 +663,7 @@ final class VCSConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'name' => 'Test', - 'runtime' => 'node-22', + 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'timeout' => 10, ]); @@ -725,44 +725,40 @@ final class VCSConsoleClientTest extends Scope 'x-appwrite-project' => 'console', ]; - $teamId = null; - $project2Id = null; + $team = $this->client->call(Client::METHOD_POST, '/teams', $consoleHeaders, [ + 'teamId' => ID::unique(), + 'name' => 'Cross Project Team', + ]); + $this->assertEquals(201, $team['headers']['status-code']); + + $project2 = $this->client->call(Client::METHOD_POST, '/projects', $consoleHeaders, [ + 'projectId' => ID::unique(), + 'name' => 'Cross Project Test', + 'teamId' => $team['body']['$id'], + 'region' => System::getEnv('_APP_REGION', 'default'), + ]); + $this->assertEquals(201, $project2['headers']['status-code']); + $project2Id = $project2['body']['$id']; + + $key = $this->client->call(Client::METHOD_POST, '/projects/' . $project2Id . '/keys', $consoleHeaders, [ + 'keyId' => ID::unique(), + 'name' => 'Test Key', + 'scopes' => ['functions.write', 'sites.write'], + ]); + $this->assertEquals(201, $key['headers']['status-code']); + + $headers2 = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $project2Id, + 'x-appwrite-key' => $key['body']['secret'], + ]; try { - $team = $this->client->call(Client::METHOD_POST, '/teams', $consoleHeaders, [ - 'teamId' => ID::unique(), - 'name' => 'Cross Project Team', - ]); - $this->assertEquals(201, $team['headers']['status-code']); - $teamId = $team['body']['$id']; - - $project2 = $this->client->call(Client::METHOD_POST, '/projects', $consoleHeaders, [ - 'projectId' => ID::unique(), - 'name' => 'Cross Project Test', - 'teamId' => $teamId, - 'region' => System::getEnv('_APP_REGION', 'default'), - ]); - $this->assertEquals(201, $project2['headers']['status-code']); - $project2Id = $project2['body']['$id']; - - $key = $this->client->call(Client::METHOD_POST, '/projects/' . $project2Id . '/keys', $consoleHeaders, [ - 'keyId' => ID::unique(), - 'name' => 'Test Key', - 'scopes' => ['functions.write', 'sites.write'], - ]); - $this->assertEquals(201, $key['headers']['status-code']); - - $headers2 = [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $project2Id, - 'x-appwrite-key' => $key['body']['secret'], - ]; - // createFunction with installation from project 1 → should fail $function = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ 'functionId' => ID::unique(), 'name' => 'Test Cross', - 'runtime' => 'node-22', + 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'installationId' => $installationId, 'providerRepositoryId' => $this->providerRepositoryId, @@ -786,14 +782,14 @@ final class VCSConsoleClientTest extends Scope $fn = $this->client->call(Client::METHOD_POST, '/functions', $headers2, [ 'functionId' => ID::unique(), 'name' => 'Test No VCS', - 'runtime' => 'node-22', + 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', ]); $this->assertEquals(201, $fn['headers']['status-code']); $updated = $this->client->call(Client::METHOD_PUT, '/functions/' . $fn['body']['$id'], $headers2, [ 'name' => 'Test No VCS', - 'runtime' => 'node-22', + 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'installationId' => $installationId, 'providerRepositoryId' => $this->providerRepositoryId, @@ -820,12 +816,8 @@ final class VCSConsoleClientTest extends Scope ]); $this->assertEquals(404, $updatedSite['headers']['status-code']); } finally { - if ($project2Id !== null) { - $this->client->call(Client::METHOD_DELETE, '/projects/' . $project2Id, $consoleHeaders); - } - if ($teamId !== null) { - $this->client->call(Client::METHOD_DELETE, '/teams/' . $teamId, $consoleHeaders); - } + $this->client->call(Client::METHOD_DELETE, '/projects/' . $project2Id, $consoleHeaders); + $this->client->call(Client::METHOD_DELETE, '/teams/' . $team['body']['$id'], $consoleHeaders); } } From 0a6c7e0d2ea6d9b1f9928753cbdc4eb50fbe5f9e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 16 Jun 2026 14:34:21 +0530 Subject: [PATCH 130/151] Run CI on merged PRs (#12606) --- .github/workflows/ci.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96b579c006..c2bd7ea4a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,9 @@ env: on: pull_request: + push: + branches: + - 1.9.x workflow_dispatch: inputs: response_format: @@ -705,7 +708,7 @@ jobs: benchmark: name: Benchmark - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.event_name == 'push' runs-on: ubuntu-latest needs: build permissions: @@ -747,9 +750,11 @@ jobs: - name: Prepare benchmark before id: benchmark_before_prepare continue-on-error: true + env: + BENCHMARK_BEFORE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} run: | - git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }} - git worktree add --detach /tmp/appwrite-benchmark-before ${{ github.event.pull_request.base.sha }} + git fetch --depth=1 origin "${BENCHMARK_BEFORE_SHA}" + git worktree add --detach /tmp/appwrite-benchmark-before "${BENCHMARK_BEFORE_SHA}" docker build \ --cache-from ${{ env.IMAGE }}:after \ --target development \ @@ -871,8 +876,8 @@ jobs: if: always() uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: - BENCHMARK_BASE_REF: ${{ github.event.pull_request.base.ref }} - BENCHMARK_HEAD_REF: ${{ github.event.pull_request.head.ref }} + BENCHMARK_BASE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.before }} + BENCHMARK_HEAD_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.sha }} with: script: | const comment = require('./.github/workflows/benchmark-comment.js'); From 2540732ac0e14976ef0715b213d9997f55c43072 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 16 Jun 2026 18:42:50 +0530 Subject: [PATCH 131/151] fix: bump utopia-php/vcs to 4.2.3 --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 97674ae904..484402325d 100644 --- a/composer.lock +++ b/composer.lock @@ -5130,16 +5130,16 @@ }, { "name": "utopia-php/vcs", - "version": "4.2.2", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "bb42584d3efb95ff4eb241605bb15165c56974de" + "reference": "598cbd2793a5a6394493f1046743e75ec6544a57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/bb42584d3efb95ff4eb241605bb15165c56974de", - "reference": "bb42584d3efb95ff4eb241605bb15165c56974de", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/598cbd2793a5a6394493f1046743e75ec6544a57", + "reference": "598cbd2793a5a6394493f1046743e75ec6544a57", "shasum": "" }, "require": { @@ -5173,9 +5173,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/4.2.2" + "source": "https://github.com/utopia-php/vcs/tree/4.2.3" }, - "time": "2026-06-10T08:08:48+00:00" + "time": "2026-06-16T12:14:08+00:00" }, { "name": "utopia-php/websocket", From c38c8e1f4d8cd49ab1381fb4cb90a4ceb800a45f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 17 Jun 2026 09:25:56 +0530 Subject: [PATCH 132/151] fix: refine impersonation security scheme definitions (#12610) Compact the X-Appwrite-Impersonate-User-{Id,Email,Phone} header descriptions to a short phrase matching the other security schemes (they previously carried a multi-sentence paragraph that rendered poorly in the docs). Mark the impersonation schemes with a new x-appwrite.optional flag. Location methods (downloads, previews, views, avatars) include these schemes so impersonation can pass through as a URL query param, but they are optional; the flag lets SDK doc generation skip them in examples instead of showing setImpersonateUserId('') as required auth. --- src/Appwrite/Platform/Tasks/Specs.php | 45 +++++++++++++++++++++------ 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index bd2a03ecf0..e7f5167611 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -180,20 +180,29 @@ class Specs extends Action 'ImpersonateUserId' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Id', - 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by ID', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', - 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by email', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', - 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by phone', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], ], APP_SDK_PLATFORM_SERVER => [ @@ -258,20 +267,29 @@ class Specs extends Action 'ImpersonateUserId' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Id', - 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by ID', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', - 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by email', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', - 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by phone', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], ], APP_SDK_PLATFORM_CONSOLE => [ @@ -336,20 +354,29 @@ class Specs extends Action 'ImpersonateUserId' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Id', - 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by ID', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', - 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by email', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', - 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', + 'description' => 'Impersonate a user by phone', 'in' => 'header', + 'x-appwrite' => [ + 'optional' => true, + ], ], ], ]; From 53b2dea1243d8c9aa82af7e5a43989588ad776f7 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 17 Jun 2026 13:23:44 +0530 Subject: [PATCH 133/151] Add batch execution upserts (#12611) --- src/Appwrite/Event/Message/Executions.php | 39 ++++++++++++++++++++ src/Appwrite/Event/Publisher/Execution.php | 3 +- src/Appwrite/Platform/Workers/Executions.php | 38 ++++++++++++++----- 3 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 src/Appwrite/Event/Message/Executions.php diff --git a/src/Appwrite/Event/Message/Executions.php b/src/Appwrite/Event/Message/Executions.php new file mode 100644 index 0000000000..b6fbf64b91 --- /dev/null +++ b/src/Appwrite/Event/Message/Executions.php @@ -0,0 +1,39 @@ + $executions + */ + public function __construct( + public readonly Document $project, + public readonly array $executions, + ) { + } + + public function toArray(): array + { + return [ + 'project' => $this->project->getArrayCopy(), + 'executions' => \array_map( + fn (Document $execution) => $execution->getArrayCopy(), + $this->executions + ), + ]; + } + + public static function fromArray(array $data): static + { + return new self( + project: new Document($data['project'] ?? []), + executions: \array_map( + fn (array $execution) => new Document($execution), + $data['executions'] ?? [] + ), + ); + } +} diff --git a/src/Appwrite/Event/Publisher/Execution.php b/src/Appwrite/Event/Publisher/Execution.php index 05ea28d540..60470fcb9d 100644 --- a/src/Appwrite/Event/Publisher/Execution.php +++ b/src/Appwrite/Event/Publisher/Execution.php @@ -3,6 +3,7 @@ namespace Appwrite\Event\Publisher; use Appwrite\Event\Message\Execution as ExecutionMessage; +use Appwrite\Event\Message\Executions as ExecutionsMessage; use Utopia\Queue\Publisher; use Utopia\Queue\Queue; @@ -15,7 +16,7 @@ readonly class Execution extends Base parent::__construct($publisher); } - public function enqueue(ExecutionMessage $message): string|bool + public function enqueue(ExecutionMessage|ExecutionsMessage $message): string|bool { return $this->publish($this->queue, $message); } diff --git a/src/Appwrite/Platform/Workers/Executions.php b/src/Appwrite/Platform/Workers/Executions.php index 8dbf10cae6..30b4a43a55 100644 --- a/src/Appwrite/Platform/Workers/Executions.php +++ b/src/Appwrite/Platform/Workers/Executions.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Workers; use Appwrite\Event\Message\Execution; +use Appwrite\Event\Message\Executions as ExecutionsMessage; use Exception; use Utopia\Database\Database; use Utopia\Platform\Action; @@ -11,6 +12,8 @@ use Utopia\Span\Span; class Executions extends Action { + private const int UPSERT_BATCH_SIZE = 100; + public static function getName(): string { return 'executions'; @@ -33,19 +36,36 @@ class Executions extends Action Message $message, Database $dbForProject, ): void { - $executionMessage = Execution::fromArray($message->getPayload()); - $execution = $executionMessage->execution; + $payload = $message->getPayload(); + $isBatch = isset($payload['executions']) && \is_array($payload['executions']); - if ($execution->isEmpty()) { - throw new Exception('Missing execution'); + if ($isBatch) { + $executionMessage = ExecutionsMessage::fromArray($payload); + $executions = \array_values(\array_filter( + $executionMessage->executions, + fn ($execution) => !$execution->isEmpty() + )); + } else { + $executionMessage = Execution::fromArray($payload); + $executions = [$executionMessage->execution]; + } + + if (empty($executions)) { + throw new Exception($isBatch ? 'Missing executions' : 'Missing execution'); } Span::add('project.id', $executionMessage->project->getId()); - Span::add('function.id', $execution->getAttribute('resourceId', '')); - Span::add('execution.id', $execution->getId()); - Span::add('deployment.id', $execution->getAttribute('deploymentId', '')); - Span::add('resource.type', $execution->getAttribute('resourceType', '')); - $dbForProject->upsertDocument('executions', $execution); + if ($isBatch) { + Span::add('executions.count', \count($executions)); + $dbForProject->upsertDocuments('executions', $executions, self::UPSERT_BATCH_SIZE); + } else { + $execution = $executions[0]; + Span::add('function.id', $execution->getAttribute('resourceId', '')); + Span::add('execution.id', $execution->getId()); + Span::add('deployment.id', $execution->getAttribute('deploymentId', '')); + Span::add('resource.type', $execution->getAttribute('resourceType', '')); + $dbForProject->upsertDocument('executions', $execution); + } } } From c7c17862fd3a2cde2d7cf4d0d09c704ed04e0acd Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 17 Jun 2026 15:26:35 +0400 Subject: [PATCH 134/151] Revert "fix: remove unused build cache capture" This reverts commit 4a9e9e050895ab4025c67a2d99ba1ee5a811ee3c. --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 3c8219cdf5..d01d82e2e7 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -704,7 +704,7 @@ class Builds extends Action $span = Span::current(); Co::join([ - Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cpus, $memory, $timeout, &$err, $version, $span) { + Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cacheKey, $cpus, $memory, $timeout, &$err, $version, $span) { try { if ($version === 'v2') { $command = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh'; From 8cf7846733ffed5f47ae015f260497436c5f90af Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 17 Jun 2026 15:26:35 +0400 Subject: [PATCH 135/151] Revert "fix: disable build cache" This reverts commit 7d785e7963eee062036c5cbdadea1d729088fc9b. --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index d01d82e2e7..2550db36e2 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -732,8 +732,7 @@ class Builds extends Action variables: $vars, command: $command, outputDirectory: $outputDirectory ?? '', - // temporarily disable build cache - // cacheKey: $cacheKey + cacheKey: $cacheKey ); } catch (ExecutorTimeout $error) { From edd633de6e5e2455df520f8cc12b5e39f2f072c5 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 18 Jun 2026 12:03:28 +0530 Subject: [PATCH 136/151] Fix legacy database SDK deprecation metadata (#12615) --- .../Databases/Collections/Attributes/Longtext/Create.php | 5 +++++ .../Databases/Collections/Attributes/Longtext/Update.php | 5 +++++ .../Databases/Collections/Attributes/Mediumtext/Create.php | 5 +++++ .../Databases/Collections/Attributes/Mediumtext/Update.php | 5 +++++ .../Http/Databases/Collections/Attributes/Text/Create.php | 5 +++++ .../Http/Databases/Collections/Attributes/Text/Update.php | 5 +++++ .../Databases/Collections/Attributes/Varchar/Create.php | 5 +++++ .../Databases/Collections/Attributes/Varchar/Update.php | 5 +++++ .../Databases/Http/Databases/Transactions/Create.php | 7 ++++++- .../Databases/Http/Databases/Transactions/Delete.php | 7 ++++++- .../Modules/Databases/Http/Databases/Transactions/Get.php | 7 ++++++- .../Http/Databases/Transactions/Operations/Create.php | 7 ++++++- .../Databases/Http/Databases/Transactions/Update.php | 7 ++++++- .../Databases/Http/Databases/Transactions/XList.php | 7 ++++++- 14 files changed, 76 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php index 90591b43fb..6dd7492ce9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php @@ -7,6 +7,7 @@ use Appwrite\Event\Publisher\Database as DatabasePublisher; use Appwrite\Extend\Exception; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -57,6 +58,10 @@ class Create extends Action model: $this->getResponseModel() ) ], + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.createLongtextColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php index 26e3f0ef8f..6af0578891 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php @@ -6,6 +6,7 @@ use Appwrite\Event\Event; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -55,6 +56,10 @@ class Update extends Action ) ], contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.updateLongtextColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php index 0f7b386fd5..5e49243481 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php @@ -7,6 +7,7 @@ use Appwrite\Event\Publisher\Database as DatabasePublisher; use Appwrite\Extend\Exception; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -57,6 +58,10 @@ class Create extends Action model: $this->getResponseModel() ) ], + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.createMediumtextColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php index 45feb7aa9a..1672131123 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php @@ -6,6 +6,7 @@ use Appwrite\Event\Event; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -55,6 +56,10 @@ class Update extends Action ) ], contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.updateMediumtextColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php index 79968d0feb..8943c05339 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php @@ -7,6 +7,7 @@ use Appwrite\Event\Publisher\Database as DatabasePublisher; use Appwrite\Extend\Exception; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -57,6 +58,10 @@ class Create extends Action model: $this->getResponseModel() ) ], + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.createTextColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php index ec9b2979f7..f86e47f36d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php @@ -6,6 +6,7 @@ use Appwrite\Event\Event; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -55,6 +56,10 @@ class Update extends Action ) ], contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.updateTextColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php index 89690de4e9..e45b3fed28 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php @@ -7,6 +7,7 @@ use Appwrite\Event\Publisher\Database as DatabasePublisher; use Appwrite\Extend\Exception; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -59,6 +60,10 @@ class Create extends Action model: $this->getResponseModel() ) ], + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.createVarcharColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php index 0ce20abd2d..1aacd92fd5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php @@ -6,6 +6,7 @@ use Appwrite\Event\Event; use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Attributes\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -57,6 +58,10 @@ class Update extends Action ) ], contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.updateVarcharColumn', + ), )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') 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 f2b351fa6a..1e0c7af49b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Transactions; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -49,7 +50,11 @@ class Create extends Action model: UtopiaResponse::MODEL_TRANSACTION, ) ], - contentType: ContentType::JSON + contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.createTransaction', + ) )) ->param('ttl', APP_DATABASE_TXN_TTL_DEFAULT, new Range(min: APP_DATABASE_TXN_TTL_MIN, max: APP_DATABASE_TXN_TTL_MAX), 'Seconds before the transaction expires.', true) ->inject('response') 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 072cb21bbc..9130929162 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php @@ -7,6 +7,7 @@ use Appwrite\Event\Publisher\Delete as DeletePublisher; use Appwrite\Extend\Exception; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -48,7 +49,11 @@ class Delete extends Action model: UtopiaResponse::MODEL_NONE, ) ], - contentType: ContentType::NONE + contentType: ContentType::NONE, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.deleteTransaction', + ) )) ->param('transactionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Transaction ID.', false, ['dbForProject']) ->inject('response') 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 af0f7cdc10..dc20349e7c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Transactions; use Appwrite\Extend\Exception; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; @@ -45,7 +46,11 @@ class Get extends Action model: UtopiaResponse::MODEL_TRANSACTION, ) ], - contentType: ContentType::JSON + contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.getTransaction', + ) )) ->param('transactionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Transaction ID.', false, ['dbForProject']) ->inject('response') 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 8e085a9481..4b9cf20b9c 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 @@ -7,6 +7,7 @@ use Appwrite\Extend\Exception; use Appwrite\Platform\Modules\Databases\Http\Databases\Transactions\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Documents\User; @@ -56,7 +57,11 @@ class Create extends Action model: UtopiaResponse::MODEL_TRANSACTION, ) ], - contentType: ContentType::JSON + contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.createOperations', + ) )) ->param('transactionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Transaction ID.', false, ['dbForProject']) ->param('operations', [], new ArrayList(new Operation(type: 'legacy')), 'Array of staged operations.', true) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php index de057ae15e..a757f0079e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php @@ -12,6 +12,7 @@ use Appwrite\Extend\Exception; use Appwrite\Functions\EventProcessor; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Usage\Context; @@ -65,7 +66,11 @@ class Update extends Action model: UtopiaResponse::MODEL_TRANSACTION, ) ], - contentType: ContentType::JSON + contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.updateTransaction', + ) )) ->param('transactionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Transaction ID.', false, ['dbForProject']) ->param('commit', false, new Boolean(), 'Commit transaction?', true) 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 b10972ad64..22a7da97aa 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Transactions; use Appwrite\Extend\Exception; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Transactions; @@ -48,7 +49,11 @@ class XList extends Action model: UtopiaResponse::MODEL_TRANSACTION_LIST, ) ], - contentType: ContentType::JSON + contentType: ContentType::JSON, + deprecated: new Deprecated( + since: '1.8.0', + replaceWith: 'tablesDB.listTransactions', + ) )) ->param('queries', [], new Transactions(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).', true) ->inject('response') From 84d4b566e29de6d533d0e22f857b87ca03c9babd Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 19 Jun 2026 18:33:58 +1200 Subject: [PATCH 137/151] fix: address pdoproxy review comments --- app/init/registers.php | 35 +++++++------- composer.json | 8 ++-- composer.lock | 74 +++++++++++++++--------------- tests/unit/Utopia/ResponseTest.php | 52 +++++++++++++++++++++ 4 files changed, 109 insertions(+), 60 deletions(-) diff --git a/app/init/registers.php b/app/init/registers.php index e7ede8b025..43ae64bc53 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -6,7 +6,6 @@ use Appwrite\Hooks\Hooks; use Appwrite\PubSub\Adapter\Redis as PubSub; use Appwrite\URL\URL as AppwriteURL; use MaxMind\Db\Reader; -use Swoole\Database\PDOProxy; use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\Config\Config; use Utopia\Console; @@ -291,15 +290,14 @@ $register->set('pools', function () { $resource = match ($dsnScheme) { 'mysql', 'mariadb' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { - return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { - return new PDO("mysql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};charset=utf8mb4", $dsnUser, $dsnPass, [ - \PDO::ATTR_TIMEOUT => 3, // Seconds - \PDO::ATTR_PERSISTENT => false, - \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, - \PDO::ATTR_EMULATE_PREPARES => true, - \PDO::ATTR_STRINGIFY_FETCHES => true - ]); - }); + return new PDO("mysql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};charset=utf8mb4", $dsnUser, $dsnPass, [ + \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, + \PDO::ATTR_TIMEOUT => 3, // Seconds + \PDO::ATTR_PERSISTENT => false, + \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, + \PDO::ATTR_EMULATE_PREPARES => true, + \PDO::ATTR_STRINGIFY_FETCHES => true + ]); }, 'mongodb' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { try { @@ -312,15 +310,14 @@ $register->set('pools', function () { } }, 'postgresql' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { - return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { - return new PDO("pgsql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};connect_timeout=3", $dsnUser, $dsnPass, array( - \PDO::ATTR_TIMEOUT => 3, // Seconds - \PDO::ATTR_PERSISTENT => false, - \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, - \PDO::ATTR_EMULATE_PREPARES => true, - \PDO::ATTR_STRINGIFY_FETCHES => true - )); - }); + return new PDO("pgsql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};connect_timeout=3", $dsnUser, $dsnPass, array( + \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, + \PDO::ATTR_TIMEOUT => 3, // Seconds + \PDO::ATTR_PERSISTENT => false, + \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, + \PDO::ATTR_EMULATE_PREPARES => true, + \PDO::ATTR_STRINGIFY_FETCHES => true + )); }, default => function () use ($dsnHost, $dsnPort, $dsnPass) { $redis = new \Redis(); diff --git a/composer.json b/composer.json index f6e2a35066..5d75f38d4b 100644 --- a/composer.json +++ b/composer.json @@ -53,17 +53,17 @@ "ext-sockets": "*", "appwrite/php-runtimes": "0.20.*", "appwrite/php-clamav": "2.0.*", - "utopia-php/abuse": "1.3.*", + "utopia-php/abuse": "1.4.*", "utopia-php/agents": "2.*", "utopia-php/analytics": "0.15.*", - "utopia-php/audit": "^2.4", + "utopia-php/audit": "2.5.*", "utopia-php/auth": "0.5.*", "utopia-php/cache": "^3.0", "utopia-php/cli": "^0.24", "utopia-php/compression": "0.1.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", - "utopia-php/database": "5.*", + "utopia-php/database": "6.0.*", "utopia-php/detector": "0.2.*", "utopia-php/domains": "^2.2", "utopia-php/emails": "0.7.*", @@ -77,7 +77,7 @@ "utopia-php/lock": "0.2.*", "utopia-php/logger": "0.8.*", "utopia-php/messaging": "^1.1", - "utopia-php/migration": "1.*", + "utopia-php/migration": "1.14.*", "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "1.*", "utopia-php/span": "3.0.*", diff --git a/composer.lock b/composer.lock index 484402325d..a43b5016da 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": "2dfcf2f234c0ef563a0ee4b47534ddc5", + "content-hash": "264c11d2628eeebe5722497eca10e576", "packages": [ { "name": "adhocore/jwt", @@ -69,16 +69,16 @@ }, { "name": "appwrite/appwrite", - "version": "24.2.0", + "version": "26.1.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-for-php.git", - "reference": "d3217b6524b9d174ab91fb7ffc555c68bfa1da97" + "reference": "533865f24f306cf6ac6f1737965553a5c54672e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/d3217b6524b9d174ab91fb7ffc555c68bfa1da97", - "reference": "d3217b6524b9d174ab91fb7ffc555c68bfa1da97", + "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/533865f24f306cf6ac6f1737965553a5c54672e0", + "reference": "533865f24f306cf6ac6f1737965553a5c54672e0", "shasum": "" }, "require": { @@ -88,7 +88,7 @@ }, "require-dev": { "mockery/mockery": "1.6.12", - "phpunit/phpunit": "^10" + "phpunit/phpunit": "^12" }, "type": "library", "autoload": { @@ -104,10 +104,10 @@ "support": { "email": "team@appwrite.io", "issues": "https://github.com/appwrite/sdk-for-php/issues", - "source": "https://github.com/appwrite/sdk-for-php/tree/24.2.0", + "source": "https://github.com/appwrite/sdk-for-php/tree/26.1.0", "url": "https://appwrite.io/support" }, - "time": "2026-05-21T18:56:51+00:00" + "time": "2026-06-19T08:16:32+00:00" }, { "name": "appwrite/php-clamav", @@ -3118,25 +3118,25 @@ }, { "name": "utopia-php/abuse", - "version": "1.3.1", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "00e59c89a1ac5f4ad771695e5dbee020b3c7ac44" + "reference": "8f5df0274869cf9022eea7d8030ca1a0d458b3b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/00e59c89a1ac5f4ad771695e5dbee020b3c7ac44", - "reference": "00e59c89a1ac5f4ad771695e5dbee020b3c7ac44", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8f5df0274869cf9022eea7d8030ca1a0d458b3b2", + "reference": "8f5df0274869cf9022eea7d8030ca1a0d458b3b2", "shasum": "" }, "require": { - "appwrite/appwrite": "24.*", + "appwrite/appwrite": "^26.0", "ext-curl": "*", "ext-pdo": "*", "ext-redis": "*", "php": ">=8.2", - "utopia-php/database": "5.*" + "utopia-php/database": "^6.0.0" }, "require-dev": { "laravel/pint": "1.*", @@ -3164,9 +3164,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/1.3.1" + "source": "https://github.com/utopia-php/abuse/tree/1.4.1" }, - "time": "2026-06-03T07:30:05+00:00" + "time": "2026-06-18T11:18:52+00:00" }, { "name": "utopia-php/agents", @@ -3269,21 +3269,21 @@ }, { "name": "utopia-php/audit", - "version": "2.4.2", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "6f15caaac5455c98cec06e02fe8da3af9477ff38" + "reference": "d9e9bb50f2150e0a7ccbe24668ff7230e7cb7a20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/6f15caaac5455c98cec06e02fe8da3af9477ff38", - "reference": "6f15caaac5455c98cec06e02fe8da3af9477ff38", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/d9e9bb50f2150e0a7ccbe24668ff7230e7cb7a20", + "reference": "d9e9bb50f2150e0a7ccbe24668ff7230e7cb7a20", "shasum": "" }, "require": { "php": ">=8.4", - "utopia-php/database": "5.*", + "utopia-php/database": "^6.0.0", "utopia-php/fetch": "^1.1", "utopia-php/query": "0.1.*", "utopia-php/validators": "0.2.*" @@ -3313,9 +3313,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/2.4.2" + "source": "https://github.com/utopia-php/audit/tree/2.5.0" }, - "time": "2026-06-03T03:42:22+00:00" + "time": "2026-06-18T11:19:26+00:00" }, { "name": "utopia-php/auth", @@ -3682,16 +3682,16 @@ }, { "name": "utopia-php/database", - "version": "5.9.2", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "698952455dd645ff41057621c90a4cea977fb1bf" + "reference": "fff9f0effbd40359ff925741ff9424856d8b4fde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/698952455dd645ff41057621c90a4cea977fb1bf", - "reference": "698952455dd645ff41057621c90a4cea977fb1bf", + "url": "https://api.github.com/repos/utopia-php/database/zipball/fff9f0effbd40359ff925741ff9424856d8b4fde", + "reference": "fff9f0effbd40359ff925741ff9424856d8b4fde", "shasum": "" }, "require": { @@ -3736,9 +3736,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/5.9.2" + "source": "https://github.com/utopia-php/database/tree/6.0.0" }, - "time": "2026-06-12T08:33:14+00:00" + "time": "2026-06-18T10:37:40+00:00" }, { "name": "utopia-php/detector", @@ -4406,25 +4406,25 @@ }, { "name": "utopia-php/migration", - "version": "1.13.2", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "50526e121efcf73e11309446f194623a431d7e32" + "reference": "f70dba326f1499d1ff4dd18b218b26a858aff1dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/50526e121efcf73e11309446f194623a431d7e32", - "reference": "50526e121efcf73e11309446f194623a431d7e32", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/f70dba326f1499d1ff4dd18b218b26a858aff1dd", + "reference": "f70dba326f1499d1ff4dd18b218b26a858aff1dd", "shasum": "" }, "require": { - "appwrite/appwrite": "24.*", + "appwrite/appwrite": "^26.0", "ext-curl": "*", "ext-openssl": "*", "halaxa/json-machine": "^1.2", "php": ">=8.2", - "utopia-php/database": "5.*", + "utopia-php/database": "^6.0.0", "utopia-php/dsn": "0.2.*", "utopia-php/storage": "2.*" }, @@ -4455,9 +4455,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.13.2" + "source": "https://github.com/utopia-php/migration/tree/1.14.0" }, - "time": "2026-06-04T05:09:07+00:00" + "time": "2026-06-18T11:19:06+00:00" }, { "name": "utopia-php/mongo", diff --git a/tests/unit/Utopia/ResponseTest.php b/tests/unit/Utopia/ResponseTest.php index 80c59ee2f8..e00809ce26 100644 --- a/tests/unit/Utopia/ResponseTest.php +++ b/tests/unit/Utopia/ResponseTest.php @@ -4,7 +4,9 @@ declare(strict_types=1); namespace Tests\Unit\Utopia; +use Appwrite\Models\Project as GeneratedProject; use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model\Project as ProjectModel; use Exception; use PHPUnit\Framework\TestCase; use ReflectionProperty; @@ -110,6 +112,56 @@ final class ResponseTest extends TestCase ]), 'single'); } + public function testProjectResponseCanHydrateGeneratedSdkProjectWithoutOAuth2Fields(): void + { + $this->response->setModel(new ProjectModel()); + + $project = $this->response->output(new Document([ + '$id' => 'project', + '$createdAt' => '2026-06-19T00:00:00.000+00:00', + '$updatedAt' => '2026-06-19T00:00:00.000+00:00', + 'name' => 'Project', + 'teamId' => 'team', + 'region' => 'default', + ]), Response::MODEL_PROJECT); + + $generated = GeneratedProject::from($project); + + foreach ([ + 'oAuth2ServerEnabled', + 'oAuth2ServerAuthorizationUrl', + 'oAuth2ServerScopes', + 'oAuth2ServerAuthorizationDetailsTypes', + 'oAuth2ServerAccessTokenDuration', + 'oAuth2ServerRefreshTokenDuration', + 'oAuth2ServerPublicAccessTokenDuration', + 'oAuth2ServerPublicRefreshTokenDuration', + 'oAuth2ServerConfidentialPkce', + 'oAuth2ServerVerificationUrl', + 'oAuth2ServerUserCodeLength', + 'oAuth2ServerUserCodeFormat', + 'oAuth2ServerDeviceCodeDuration', + 'oAuth2ServerDiscoveryUrl', + ] as $key) { + $this->assertArrayNotHasKey($key, $project); + } + + $this->assertNull($generated->oAuth2ServerEnabled); + $this->assertNull($generated->oAuth2ServerAuthorizationUrl); + $this->assertNull($generated->oAuth2ServerScopes); + $this->assertNull($generated->oAuth2ServerAuthorizationDetailsTypes); + $this->assertNull($generated->oAuth2ServerAccessTokenDuration); + $this->assertNull($generated->oAuth2ServerRefreshTokenDuration); + $this->assertNull($generated->oAuth2ServerPublicAccessTokenDuration); + $this->assertNull($generated->oAuth2ServerPublicRefreshTokenDuration); + $this->assertNull($generated->oAuth2ServerConfidentialPkce); + $this->assertNull($generated->oAuth2ServerVerificationUrl); + $this->assertNull($generated->oAuth2ServerUserCodeLength); + $this->assertNull($generated->oAuth2ServerUserCodeFormat); + $this->assertNull($generated->oAuth2ServerDeviceCodeDuration); + $this->assertNull($generated->oAuth2ServerDiscoveryUrl); + } + public function testResponseModelLists(): void { $output = $this->response->output(new Document([ From e09d0b0ac8cbccbba71e21f63b6ff430650625b7 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 19 Jun 2026 13:43:45 +0400 Subject: [PATCH 138/151] fix: bump executor to 0.25.1 --- app/views/install/compose.phtml | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index d71ccff0b4..abda3a650c 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -988,7 +988,7 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); <<: *x-logging restart: unless-stopped stop_signal: SIGINT - image: openruntimes/executor:0.24.1 + image: openruntimes/executor:0.25.1 networks: - appwrite - runtimes diff --git a/docker-compose.yml b/docker-compose.yml index d4b2aacd03..4341698653 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1249,7 +1249,7 @@ services: hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.24.1 + image: openruntimes/executor:0.25.1 restart: unless-stopped networks: - appwrite From 0cf472259712c8c458ae5f05cc72aa7ee0345592 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 19 Jun 2026 18:11:25 +0530 Subject: [PATCH 139/151] Handle missing resource token collection (#12625) --- app/init/resources/request.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 982cd13088..958f1a211a 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -1108,7 +1108,11 @@ return function (Container $context): void { return new Document([]); } - $token = $authorization->skip(fn () => $dbForProject->getDocument('resourceTokens', $tokenId)); + try { + $token = $authorization->skip(fn () => $dbForProject->getDocument('resourceTokens', $tokenId)); + } catch (\Utopia\Database\Exception\NotFound) { + return new Document([]); + } if ($token->isEmpty()) { return new Document([]); From 283bd1c9992b3a06263679a6d5a1d2af4773af0e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 20 Jun 2026 14:04:32 +1200 Subject: [PATCH 140/151] fix(databases): 404 (not 500) for a wrong-type database id on product-DB APIs Product-DB routes (tablesdb/documentsdb/vectorsdb) resolved a database by id with only an isEmpty() check, so a database of the wrong type (e.g. a documentsdb id on the tablesdb path) proceeded to a type-mismatched backend op that surfaced as an opaque 500 instead of a clean 404. Centralise the per-path "allowed database types" in one source (Action::getAllowedDatabaseTypes), used by BOTH the list filter (getDatabaseTypeQueryFilters) and the by-id guard (isDatabaseTypeMismatch), so the two cannot diverge. TablesDB keeps legacy compatibility (mirrors listTablesDatabases); documentsdb/vectorsdb are scoped to their own type; the legacy /v1/databases API is not type-guarded. Every database carries a non-null type (set on create, backfilled to 'legacy' by migration V23), so the filter is a plain Query::equal and the redundant TablesDB list-filter override is removed. Apply the guard at every database-resolution site in the module, and make the remaining handlers type-aware so they can use it: re-base Databases Get/Update/Delete and the Databases/TablesDB log lists onto the type-aware base, and re-base the Collections Attributes/Indexes Action bases and Usage/Get onto it as well (with covariant setHttpPath signatures). Co-Authored-By: Claude Opus 4.8 --- .../Databases/Http/Databases/Action.php | 35 ++++++ .../Collections/Attributes/Action.php | 14 +-- .../Collections/Attributes/Delete.php | 2 +- .../Databases/Collections/Attributes/Get.php | 2 +- .../Attributes/Relationship/Create.php | 2 +- .../Collections/Attributes/XList.php | 2 +- .../Http/Databases/Collections/Create.php | 2 +- .../Http/Databases/Collections/Delete.php | 2 +- .../Documents/Attribute/Decrement.php | 2 +- .../Documents/Attribute/Increment.php | 2 +- .../Collections/Documents/Bulk/Delete.php | 2 +- .../Collections/Documents/Bulk/Update.php | 2 +- .../Collections/Documents/Bulk/Upsert.php | 2 +- .../Collections/Documents/Create.php | 2 +- .../Collections/Documents/Delete.php | 2 +- .../Databases/Collections/Documents/Get.php | 2 +- .../Collections/Documents/Logs/XList.php | 2 +- .../Collections/Documents/Update.php | 2 +- .../Collections/Documents/Upsert.php | 2 +- .../Databases/Collections/Documents/XList.php | 2 +- .../Http/Databases/Collections/Get.php | 2 +- .../Databases/Collections/Indexes/Action.php | 10 +- .../Databases/Collections/Indexes/Create.php | 2 +- .../Databases/Collections/Indexes/Delete.php | 2 +- .../Databases/Collections/Indexes/Get.php | 2 +- .../Databases/Collections/Indexes/XList.php | 2 +- .../Http/Databases/Collections/Logs/XList.php | 2 +- .../Http/Databases/Collections/Update.php | 2 +- .../Http/Databases/Collections/XList.php | 2 +- .../Databases/Http/Databases/Delete.php | 3 +- .../Modules/Databases/Http/Databases/Get.php | 3 +- .../Databases/Http/Databases/Logs/XList.php | 4 +- .../Transactions/Operations/Create.php | 2 +- .../Databases/Http/Databases/Update.php | 3 +- .../Databases/Http/Databases/Usage/Get.php | 8 +- .../Databases/Http/Databases/XList.php | 2 +- .../Databases/Http/TablesDB/Logs/XList.php | 4 +- .../Modules/Databases/Http/TablesDB/XList.php | 11 -- .../Http/VectorsDB/Collections/Create.php | 2 +- .../Http/VectorsDB/Collections/Update.php | 2 +- .../Databases/DatabaseTypeMismatchTest.php | 102 ++++++++++++++++++ 41 files changed, 192 insertions(+), 65 deletions(-) create mode 100644 tests/unit/Platform/Modules/Databases/DatabaseTypeMismatchTest.php diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php index 7893a70753..9ea4f11ccb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php @@ -21,6 +21,41 @@ class Action extends AppwriteAction return $this->context; } + /** + * Database types this path may operate on. Single source of truth shared by + * the list filter ({@see getDatabaseTypeQueryFilters()}) and the by-id guard + * ({@see isDatabaseTypeMismatch()}) so they cannot diverge. + * + * TablesDB is the compatibility successor to the legacy databases API, so it + * also serves legacy-typed databases; the other product APIs are scoped to + * their own type. Every database carries a non-null `type` (set on create + * and backfilled to 'legacy' by migration V23), so null is not represented. + * + * @return string[] + */ + protected function getAllowedDatabaseTypes(): array + { + return match ($this->getDatabaseType()) { + DATABASE_TYPE_TABLESDB => [DATABASE_TYPE_TABLESDB, DATABASE_TYPE_LEGACY], + default => [$this->getDatabaseType()], + }; + } + + /** + * A database resolved by id on a product-DB path must be one of the path's + * allowed types; otherwise it is treated as not-found rather than proceeding + * to a type-mismatched backend operation that surfaces as an opaque 500. The + * legacy /v1/databases API is intentionally not type-guarded. + */ + protected function isDatabaseTypeMismatch(Document $database): bool + { + if ($this->getDatabaseType() === DATABASE_TYPE_LEGACY) { + return false; + } + + return !in_array($database->getAttribute('type', ''), $this->getAllowedDatabaseTypes(), true); + } + public function setHttpPath(string $path): self { if (\str_contains($path, '/tablesdb')) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php index a07a4be561..292c613a5b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php @@ -6,6 +6,7 @@ use Appwrite\Event\Event; use Appwrite\Event\Message\Database as DatabaseMessage; use Appwrite\Event\Publisher\Database as DatabasePublisher; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Databases\Http\Databases\Action as DatabasesAction; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response as UtopiaResponse; use Throwable; @@ -21,10 +22,9 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Structure; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; -use Utopia\Platform\Action as UtopiaAction; use Utopia\Validator\Range; -abstract class Action extends UtopiaAction +abstract class Action extends DatabasesAction { /** * @var string The current context (either 'column' or 'attribute') @@ -36,12 +36,14 @@ abstract class Action extends UtopiaAction */ abstract protected function getResponseModel(): string|array; - public function setHttpPath(string $path): UtopiaAction + public function setHttpPath(string $path): DatabasesAction { if (\str_contains($path, '/tablesdb')) { $this->context = COLUMNS; } - return parent::setHttpPath($path); + parent::setHttpPath($path); + + return $this; } /** @@ -333,7 +335,7 @@ abstract class Action extends UtopiaAction $db = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($db->isEmpty()) { + if ($db->isEmpty() || $this->isDatabaseTypeMismatch($db)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } @@ -495,7 +497,7 @@ abstract class Action extends UtopiaAction { $db = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($db->isEmpty()) { + if ($db->isEmpty() || $this->isDatabaseTypeMismatch($db)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php index ff1636ae60..2808a14088 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php @@ -76,7 +76,7 @@ class Delete extends Action public function action(string $databaseId, string $collectionId, string $key, UtopiaResponse $response, Database $dbForProject, DatabasePublisher $publisherForDatabase, Event $queueForEvents, Authorization $authorization): void { $db = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($db->isEmpty()) { + if ($db->isEmpty() || $this->isDatabaseTypeMismatch($db)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php index 3b9d665d70..4fc251fe51 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php @@ -75,7 +75,7 @@ class Get extends Action public function action(string $databaseId, string $collectionId, string $key, UtopiaResponse $response, Database $dbForProject, Authorization $authorization): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php index f94a60b9de..c62b89a633 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php @@ -99,7 +99,7 @@ class Create extends Action $twoWayKey ??= $collectionId; $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php index 5813690802..430117188f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php @@ -71,7 +71,7 @@ class XList extends Action public function action(string $databaseId, string $collectionId, array $queries, bool $includeTotal, UtopiaResponse $response, Database $dbForProject, Authorization $authorization): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index b2e783bccd..35a6692b88 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -94,7 +94,7 @@ class Create extends Action { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php index 87171fb2fe..532ad23c67 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php @@ -73,7 +73,7 @@ class Delete extends Action public function action(string $databaseId, string $collectionId, UtopiaResponse $response, Database $dbForProject, callable $getDatabasesDB, DatabasePublisher $publisherForDatabase, Event $queueForEvents, Authorization $authorization): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php index 9319cffc57..48c1802038 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php @@ -97,7 +97,7 @@ class Decrement extends Action $isPrivilegedUser = $user->isPrivileged($authorization->getRoles()); $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php index ba74545342..4d4ecc6777 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php @@ -97,7 +97,7 @@ class Increment extends Action $isPrivilegedUser = $user->isPrivileged($authorization->getRoles()); $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php index 2dc3100046..0959acf27c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php @@ -91,7 +91,7 @@ class Delete extends Action public function action(string $databaseId, string $collectionId, array $queries, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, callable $getDatabasesDB, Context $usage, Event $queueForEvents, Event $queueForRealtime, FunctionPublisher $publisherForFunctions, Event $queueForWebhooks, array $plan, EventProcessor $eventProcessor): void { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php index 393590d1e6..bc09c477d8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php @@ -103,7 +103,7 @@ class Update extends Action } $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php index d69298919b..231a2b3a4d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php @@ -93,7 +93,7 @@ class Upsert extends Action public function action(string $databaseId, string $collectionId, array $documents, ?string $transactionId, UtopiaResponse $response, Database $dbForProject, callable $getDatabasesDB, Context $usage, Event $queueForEvents, Event $queueForRealtime, FunctionPublisher $publisherForFunctions, Event $queueForWebhooks, array $plan, EventProcessor $eventProcessor): void { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php index 2e861dfcce..676ff46a91 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php @@ -209,7 +209,7 @@ class Create extends Action } $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database) || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php index e0863b8ac7..55be2373a6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php @@ -110,7 +110,7 @@ class Delete extends Action $isAPIKey = $user->isKey($authorization->getRoles()); $isPrivilegedUser = $user->isPrivileged($authorization->getRoles()); - if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database) || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php index c40e70d667..1c51e38e2e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php @@ -82,7 +82,7 @@ class Get extends Action $isPrivilegedUser = $user->isPrivileged($authorization->getRoles()); $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database) || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php index 8aaac5fcb4..976a76bba7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php @@ -81,7 +81,7 @@ class XList extends Action public function action(string $databaseId, string $collectionId, string $documentId, array $queries, UtopiaResponse $response, Database $dbForProject, callable $getDatabasesDB, Locale $locale, Reader $geodb, Authorization $authorization, Audit $audit): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php index 4a675615da..7c80a578ff 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php @@ -106,7 +106,7 @@ class Update extends Action $isAPIKey = $user->isKey($authorization->getRoles()); $isPrivilegedUser = $user->isPrivileged($authorization->getRoles()); - if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database) || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php index ae940456f0..73fcf35b7b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php @@ -112,7 +112,7 @@ class Upsert extends Action $isPrivilegedUser = $user->isPrivileged($authorization->getRoles()); $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database) || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php index afde3d0baa..fd1d5b53d4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php @@ -92,7 +92,7 @@ class XList extends Action $isPrivilegedUser = $user->isPrivileged($authorization->getRoles()); $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database) || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php index 61b9d515f4..43364413db 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php @@ -65,7 +65,7 @@ class Get extends Action { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Action.php index 251e493cb6..4dad2429cc 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Action.php @@ -3,9 +3,9 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes; use Appwrite\Extend\Exception; -use Utopia\Platform\Action as UtopiaAction; +use Appwrite\Platform\Modules\Databases\Http\Databases\Action as DatabasesAction; -abstract class Action extends UtopiaAction +abstract class Action extends DatabasesAction { /** * The current API context (either 'columnIndex' or 'index'). @@ -17,12 +17,14 @@ abstract class Action extends UtopiaAction */ abstract protected function getResponseModel(): string; - public function setHttpPath(string $path): UtopiaAction + public function setHttpPath(string $path): DatabasesAction { if (\str_contains($path, '/tablesdb')) { $this->context = COLUMN_INDEX; } - return parent::setHttpPath($path); + parent::setHttpPath($path); + + return $this; } /** diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index 4e989621f1..2a2fffcc07 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -90,7 +90,7 @@ class Create extends Action { $db = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($db->isEmpty()) { + if ($db->isEmpty() || $this->isDatabaseTypeMismatch($db)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php index 82cada6e0d..f88f833764 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php @@ -80,7 +80,7 @@ class Delete extends Action { $db = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($db->isEmpty()) { + if ($db->isEmpty() || $this->isDatabaseTypeMismatch($db)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } $collection = $dbForProject->getDocument('database_' . $db->getSequence(), $collectionId); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php index 0ab022f777..763fd86f7b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php @@ -67,7 +67,7 @@ class Get extends Action { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } $collection = $dbForProject->getDocument('database_' . $database->getSequence(), $collectionId); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php index a4f65d0fcc..c4d70c5fb6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php @@ -75,7 +75,7 @@ class XList extends Action /** @var Document $database */ $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php index cc082532f9..f2b4e1b4fa 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php @@ -80,7 +80,7 @@ class XList extends Action { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php index 800df6d044..6ba8b67bd4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php @@ -80,7 +80,7 @@ class Update extends Action public function action(string $databaseId, string $collectionId, ?string $name, ?array $permissions, bool $documentSecurity, bool $enabled, bool $purge, UtopiaResponse $response, Database $dbForProject, callable $getDatabasesDB, Event $queueForEvents, Authorization $authorization): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php index f2f2947016..5d1ccbd45f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php @@ -75,7 +75,7 @@ class XList extends Action { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php index 058c48d68f..6394e2667e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php @@ -15,7 +15,6 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; -use Utopia\Platform\Action; class Delete extends Action { @@ -68,7 +67,7 @@ class Delete extends Action { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php index 90561364ab..5ee8e2f5e3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php @@ -12,7 +12,6 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; -use Utopia\Platform\Action; class Get extends Action { @@ -60,7 +59,7 @@ class Get extends Action { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php index a13c6c4903..1474e602e3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Logs; use Appwrite\Detector\Detector; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Databases\Http\Databases\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; @@ -23,7 +24,6 @@ use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Locale\Locale; -use Utopia\Platform\Action; class XList extends Action { @@ -75,7 +75,7 @@ class XList extends Action { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } 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 4b9cf20b9c..3aca66cd6d 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 @@ -122,7 +122,7 @@ class Create extends Action } $database = $databases[$operation['databaseId']] ??= $authorization->skip(fn () => $dbForProject->getDocument('databases', $operation['databaseId'])); - if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database) || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$operation['databaseId']]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php index c5d55c1b1b..c681d0b3f3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php @@ -13,7 +13,6 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; -use Utopia\Platform\Action; use Utopia\Validator\Boolean; use Utopia\Validator\Text; @@ -69,7 +68,7 @@ class Update extends Action { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php index 39e57a0aee..ee65cbd7ff 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases\Usage; use Appwrite\Extend\Exception; -use Appwrite\Platform\Action; +use Appwrite\Platform\Modules\Databases\Http\Databases\Action as DatabasesAction; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; @@ -20,7 +20,7 @@ use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Enum; use Utopia\Validator\WhiteList; -class Get extends Action +class Get extends DatabasesAction { public static function getName(): string { @@ -29,7 +29,7 @@ class Get extends Action protected $databaseType = DATABASE_TYPE_LEGACY; - public function setHttpPath(string $path): Action + public function setHttpPath(string $path): DatabasesAction { $this->databaseType = match (true) { str_contains($path, '/documentsdb') => DATABASE_TYPE_DOCUMENTSDB, @@ -114,7 +114,7 @@ class Get extends Action { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php index 21dbc83edc..840672114c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php @@ -29,7 +29,7 @@ class XList extends Action protected function getDatabaseTypeQueryFilters(): array { - return [Query::equal('type', [$this->getDatabaseType()])]; + return [Query::equal('type', $this->getAllowedDatabaseTypes())]; } public function __construct() diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php index ccb421b36d..0df38fbf4b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\TablesDB\Logs; use Appwrite\Detector\Detector; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Databases\Http\Databases\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -22,7 +23,6 @@ use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Locale\Locale; -use Utopia\Platform\Action; class XList extends Action { @@ -70,7 +70,7 @@ class XList extends Action { $database = $dbForProject->getDocument('databases', $databaseId); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php index 8dc0f6521a..80a9bd3686 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php @@ -9,7 +9,6 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Databases; use Appwrite\Utopia\Response as UtopiaResponse; -use Utopia\Database\Query; use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; @@ -21,16 +20,6 @@ class XList extends DatabaseXList return 'listTablesDatabases'; } - protected function getDatabaseTypeQueryFilters(): array - { - return [ - Query::or([ - Query::equal('type', [DATABASE_TYPE_TABLESDB, DATABASE_TYPE_LEGACY]), - Query::isNull('type'), - ]), - ]; - } - public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php index 3b346bb7c0..49de7f7cc5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php @@ -85,7 +85,7 @@ class Create extends CollectionAction { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php index f8ba767e7e..12b680496a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php @@ -76,7 +76,7 @@ class Update extends CollectionAction public function action(string $databaseId, string $collectionId, ?string $name, ?int $dimensions, ?array $permissions, bool $documentSecurity, ?bool $enabled, UtopiaResponse $response, Database $dbForProject, callable $getDatabasesDB, Event $queueForEvents, Authorization $authorization): void { $database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId)); - if ($database->isEmpty()) { + if ($database->isEmpty() || $this->isDatabaseTypeMismatch($database)) { throw new Exception(Exception::DATABASE_NOT_FOUND); } diff --git a/tests/unit/Platform/Modules/Databases/DatabaseTypeMismatchTest.php b/tests/unit/Platform/Modules/Databases/DatabaseTypeMismatchTest.php new file mode 100644 index 0000000000..68da1db3fa --- /dev/null +++ b/tests/unit/Platform/Modules/Databases/DatabaseTypeMismatchTest.php @@ -0,0 +1,102 @@ +isDatabaseTypeMismatch($database); + } + + /** @return string[] */ + public function exposeAllowedTypes(): array + { + return $this->getAllowedDatabaseTypes(); + } + }; + $action->setHttpPath('/v1/tablesdb/:databaseId/tables'); + + // TablesDB is the compatibility successor to the legacy databases API: + // the allowed set must equal what listTablesDatabases advertises. + $this->assertSame([DATABASE_TYPE_TABLESDB, DATABASE_TYPE_LEGACY], $action->exposeAllowedTypes()); + + $this->assertFalse($action->exposeMismatch(new Document(['type' => DATABASE_TYPE_TABLESDB]))); + $this->assertFalse($action->exposeMismatch(new Document(['type' => DATABASE_TYPE_LEGACY]))); + $this->assertTrue($action->exposeMismatch(new Document(['type' => DATABASE_TYPE_DOCUMENTSDB]))); + $this->assertTrue($action->exposeMismatch(new Document(['type' => DATABASE_TYPE_VECTORSDB]))); + // Databases always carry a non-null type (V23 backfilled old rows to + // legacy); an unexpected empty type is excluded by both the list and guard. + $this->assertTrue($action->exposeMismatch(new Document([]))); + } + + public function testDocumentsAndVectorsPathsScopeStrictlyToTheirOwnType(): void + { + $documents = new class () extends Action { + public static function getName(): string + { + return 'testDocumentsdbTypeGuard'; + } + + public function exposeMismatch(Document $database): bool + { + return $this->isDatabaseTypeMismatch($database); + } + }; + $documents->setHttpPath('/v1/documentsdb/:databaseId/collections'); + $this->assertFalse($documents->exposeMismatch(new Document(['type' => DATABASE_TYPE_DOCUMENTSDB]))); + $this->assertTrue($documents->exposeMismatch(new Document(['type' => DATABASE_TYPE_VECTORSDB]))); + $this->assertTrue($documents->exposeMismatch(new Document(['type' => DATABASE_TYPE_LEGACY]))); + $this->assertTrue($documents->exposeMismatch(new Document([]))); + + $vectors = new class () extends Action { + public static function getName(): string + { + return 'testVectorsdbTypeGuard'; + } + + public function exposeMismatch(Document $database): bool + { + return $this->isDatabaseTypeMismatch($database); + } + }; + $vectors->setHttpPath('/v1/vectorsdb/:databaseId/collections'); + $this->assertFalse($vectors->exposeMismatch(new Document(['type' => DATABASE_TYPE_VECTORSDB]))); + $this->assertTrue($vectors->exposeMismatch(new Document(['type' => DATABASE_TYPE_DOCUMENTSDB]))); + $this->assertTrue($vectors->exposeMismatch(new Document(['type' => DATABASE_TYPE_LEGACY]))); + } + + public function testLegacyDatabasesPathIsNeverTypeGuarded(): void + { + $legacy = new class () extends Action { + public static function getName(): string + { + return 'testLegacyTypeGuard'; + } + + public function exposeMismatch(Document $database): bool + { + return $this->isDatabaseTypeMismatch($database); + } + }; + $legacy->setHttpPath('/v1/databases/:databaseId/collections'); + $this->assertFalse($legacy->exposeMismatch(new Document(['type' => DATABASE_TYPE_LEGACY]))); + $this->assertFalse($legacy->exposeMismatch(new Document([]))); + $this->assertFalse($legacy->exposeMismatch(new Document(['type' => DATABASE_TYPE_TABLESDB]))); + $this->assertFalse($legacy->exposeMismatch(new Document(['type' => DATABASE_TYPE_DOCUMENTSDB]))); + } +} From cffdb38f41e3c5fded34f8ea3557800a0054f2a6 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Sat, 20 Jun 2026 19:26:30 +0530 Subject: [PATCH 141/151] Fix local installer dev flow (#12627) --- app/http.php | 12 +-- app/views/install/compose.phtml | 3 +- .../Installer/Http/Installer/Install.php | 9 +- .../Installer/Http/Installer/Reset.php | 27 ++++-- src/Appwrite/Platform/Installer/Server.php | 5 +- .../Modules/Storage/Http/Buckets/Create.php | 4 +- src/Appwrite/Platform/Tasks/Install.php | 94 ++++++++++++++----- 7 files changed, 115 insertions(+), 39 deletions(-) diff --git a/app/http.php b/app/http.php index 94bc5d01ac..6a1d7250be 100644 --- a/app/http.php +++ b/app/http.php @@ -270,8 +270,8 @@ function createDatabase(Container $resources, string $resourceKey, string $dbNam '$id' => ID::custom($index['$id']), 'type' => $index['type'], 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], + 'lengths' => $index['lengths'] ?? [], + 'orders' => $index['orders'] ?? [], ]), $collection['indexes']); $database->createCollection($key, $attributes, $indexes); @@ -353,8 +353,8 @@ $http->on(Constant::EVENT_START, function ($http) use ($payloadSize, $totalWorke '$id' => ID::custom($index['$id']), 'type' => $index['type'], 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], + 'lengths' => $index['lengths'] ?? [], + 'orders' => $index['orders'] ?? [], ]), $files['indexes']); $dbForPlatform->createCollection('bucket_' . $bucket->getSequence(), $attributes, $indexes); @@ -399,8 +399,8 @@ $http->on(Constant::EVENT_START, function ($http) use ($payloadSize, $totalWorke '$id' => ID::custom($index['$id']), 'type' => $index['type'], 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], + 'lengths' => $index['lengths'] ?? [], + 'orders' => $index['orders'] ?? [], ]), $files['indexes']); $authorization->skip(fn () => $dbForPlatform->createCollection('bucket_' . $bucket->getSequence(), $attributes, $indexes)); diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index abda3a650c..d04baa5e11 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -12,6 +12,7 @@ $version = $this->getParam('version', ''); $organization = $this->getParam('organization', ''); $image = $this->getParam('image', ''); $enableAssistant = $this->getParam('enableAssistant', false); +$executorImages = $this->getParam('executorImages', ''); $dbService = $this->getParam('database', 'mongodb'); $allowedDbServices = ['mariadb', 'mongodb']; if (!\in_array($dbService, $allowedDbServices, true)) { @@ -991,7 +992,6 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); image: openruntimes/executor:0.25.1 networks: - appwrite - - runtimes volumes: - /var/run/docker.sock:/var/run/docker.sock - appwrite-builds:/storage/builds:rw @@ -1003,6 +1003,7 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); environment: - OPR_EXECUTOR_CONNECTION_STORAGE=local://localhost - OPR_EXECUTOR_CONNECTION_BUILD_CACHE_STORAGE= + - OPR_EXECUTOR_IMAGES= - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL - OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK diff --git a/src/Appwrite/Platform/Installer/Http/Installer/Install.php b/src/Appwrite/Platform/Installer/Http/Installer/Install.php index a3368a75b1..7cf81b5eb8 100644 --- a/src/Appwrite/Platform/Installer/Http/Installer/Install.php +++ b/src/Appwrite/Platform/Installer/Http/Installer/Install.php @@ -42,7 +42,14 @@ class Install extends Action ->param('accountPassword', '', new Password(allowEmpty: true), 'Account password', true) ->param('database', '', new WhiteList(['mongodb', 'mariadb', 'postgresql']), 'Database adapter', true) ->param('installId', '', new Text(64, 0), 'Installation ID', true) - ->param('retryStep', null, new Nullable(new WhiteList([Server::STEP_DOCKER_COMPOSE, Server::STEP_ENV_VARS, Server::STEP_DOCKER_CONTAINERS], true)), 'Retry from step', true) + ->param('retryStep', null, new Nullable(new WhiteList([ + Server::STEP_CONFIG_FILES, + Server::STEP_DOCKER_COMPOSE, + Server::STEP_ENV_VARS, + Server::STEP_DOCKER_CONTAINERS, + Server::STEP_ACCOUNT_SETUP, + Server::STEP_MIGRATION, + ], true)), 'Retry from step', true) ->param('migrate', false, new \Utopia\Validator\Boolean(true), 'Run database migration after upgrade', true) ->inject('request') ->inject('response') diff --git a/src/Appwrite/Platform/Installer/Http/Installer/Reset.php b/src/Appwrite/Platform/Installer/Http/Installer/Reset.php index 8e5b877473..0bd319019d 100644 --- a/src/Appwrite/Platform/Installer/Http/Installer/Reset.php +++ b/src/Appwrite/Platform/Installer/Http/Installer/Reset.php @@ -69,17 +69,33 @@ class Reset extends Action $isLocal = $config->isLocal(); $composeFileName = $isLocal ? 'docker-compose.web-installer.yml' : 'docker-compose.yml'; $envFileName = $isLocal ? '.env.web-installer' : '.env'; - $path = $isLocal ? '/usr/src/code' : '/usr/src/code/appwrite'; + $path = $isLocal ? $config->getHostPath() : '/usr/src/code/appwrite'; + + if ($path === null || $path === '') { + return 'Missing host path for local installer reset'; + } $composeFile = $path . '/' . $composeFileName; + $envFile = $path . '/' . $envFileName; if (file_exists($composeFile)) { - $command = array_map(escapeshellarg(...), [ + $command = [ 'docker', 'compose', - '-f', $composeFile, + ]; + if (file_exists($envFile)) { + $command[] = '--env-file'; + $command[] = $envFile; + } + $command = array_map(escapeshellarg(...), [ + ...$command, + '-f', + $composeFile, ...($isLocal ? ['--project-name', 'appwrite'] : []), - '--project-directory', $path, - 'down', '-v', '--remove-orphans', + '--project-directory', + $path, + 'down', + '-v', + '--remove-orphans', ]); $output = []; @@ -92,7 +108,6 @@ class Reset extends Action @unlink($composeFile); } - $envFile = $path . '/' . $envFileName; if (file_exists($envFile)) { @unlink($envFile); } diff --git a/src/Appwrite/Platform/Installer/Server.php b/src/Appwrite/Platform/Installer/Server.php index 26d82adf24..b86db4d93d 100644 --- a/src/Appwrite/Platform/Installer/Server.php +++ b/src/Appwrite/Platform/Installer/Server.php @@ -114,7 +114,6 @@ class Server } if (isset($opts['docker'])) { - $this->printInstallerUrl($host, $port); $this->startDockerInstaller($opts); } @@ -365,9 +364,13 @@ class Server '-i', '--rm', '--name', $container, + '--label', 'com.docker.compose.project=appwrite-installer', + '--label', 'com.docker.compose.service=appwrite-installer', + '--add-host', 'host.docker.internal:host-gateway', '-p', "127.0.0.1:$port:" . self::INSTALLER_WEB_PORT, '--volume', '/var/run/docker.sock:/var/run/docker.sock', '--volume', "$volumePath:/usr/src/code:rw", + '--volume', "$volumePath:$volumePath:rw", ]; $args[] = '-e'; $args[] = 'APPWRITE_INSTALLER_CONFIG=' . $configJson; diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php index ebe06d0ccf..8f288c45d1 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php @@ -129,8 +129,8 @@ class Create extends Action '$id' => $index['$id'], 'type' => $index['type'], 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], + 'lengths' => $index['lengths'] ?? [], + 'orders' => $index['orders'] ?? [], ]); } diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 3e11a4060c..75f3c5bf18 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -538,6 +538,19 @@ class Install extends Action $assistantKey = (string) ($input['_APP_ASSISTANT_OPENAI_API_KEY'] ?? ''); $enableAssistant = trim($assistantKey) !== ''; + $enabledRuntimes = \array_unique(\array_filter(\array_map( + 'trim', + \explode(',', ($input['_APP_FUNCTIONS_RUNTIMES'] ?? '') . ',' . ($input['_APP_SITES_RUNTIMES'] ?? '')) + ))); + $runtimes = Config::getParam('runtimes', []); + $runtimeImages = []; + foreach ($enabledRuntimes as $runtime) { + $imageName = $runtimes[$runtime]['image'] ?? ''; + if ($imageName !== '') { + $runtimeImages[] = $imageName; + } + } + $executorImages = \implode(',', \array_unique($runtimeImages)); $templateForCompose ->setParam('httpPort', $httpPort) @@ -547,17 +560,24 @@ class Install extends Action ->setParam('image', $image) ->setParam('database', $database) ->setParam('hostPath', $this->hostPath) - ->setParam('enableAssistant', $enableAssistant); + ->setParam('enableAssistant', $enableAssistant) + ->setParam('executorImages', $executorImages); $templateForEnv->setParam('vars', $input); $steps = [ InstallerServer::STEP_DOCKER_COMPOSE, InstallerServer::STEP_ENV_VARS, - InstallerServer::STEP_DOCKER_CONTAINERS + InstallerServer::STEP_DOCKER_CONTAINERS, + InstallerServer::STEP_ACCOUNT_SETUP, + InstallerServer::STEP_MIGRATION, ]; $startIndex = 0; + $resumeFromStep = match ($resumeFromStep) { + InstallerServer::STEP_CONFIG_FILES => InstallerServer::STEP_DOCKER_COMPOSE, + default => $resumeFromStep, + }; if ($resumeFromStep !== null) { $resumeIndex = array_search($resumeFromStep, $steps, true); if ($resumeIndex !== false) { @@ -597,37 +617,43 @@ class Install extends Action $this->updateProgress($progress, InstallerServer::STEP_CONFIG_FILES, InstallerServer::STATUS_COMPLETED, $messages); } - if ($database === 'mongodb' && !$useExistingConfig) { + if ($database === 'mongodb' && !$useExistingConfig && $startIndex <= 1) { $this->copyMongoEntrypointIfNeeded(); } if (!$noStart) { - $currentStep = InstallerServer::STEP_DOCKER_CONTAINERS; - $this->updateProgress($progress, InstallerServer::STEP_DOCKER_CONTAINERS, InstallerServer::STATUS_IN_PROGRESS, $messages); - $this->runDockerCompose($input, $isLocalInstall, $useExistingConfig, $isCLI, $progress, $isUpgrade); + $shouldStartContainers = $startIndex <= 2; + if ($shouldStartContainers) { + $currentStep = InstallerServer::STEP_DOCKER_CONTAINERS; + $this->updateProgress($progress, InstallerServer::STEP_DOCKER_CONTAINERS, InstallerServer::STATUS_IN_PROGRESS, $messages); + $this->runDockerCompose($input, $isLocalInstall, $useExistingConfig, $isCLI, $progress, $isUpgrade); - if (!$isUpgrade) { - $this->updateProgress($progress, InstallerServer::STEP_DOCKER_CONTAINERS, InstallerServer::STATUS_COMPLETED, $messages); - $this->updateProgress($progress, InstallerServer::STEP_ACCOUNT_SETUP, InstallerServer::STATUS_IN_PROGRESS, messageOverride: 'Creating Appwrite account...'); + if (!$isUpgrade) { + $this->updateProgress($progress, InstallerServer::STEP_DOCKER_CONTAINERS, InstallerServer::STATUS_COMPLETED, $messages); + $this->updateProgress($progress, InstallerServer::STEP_ACCOUNT_SETUP, InstallerServer::STATUS_IN_PROGRESS, messageOverride: 'Creating Appwrite account...'); + } } - if (!$isLocalInstall) { + if (!$isLocalInstall || file_exists('/.dockerenv') || file_exists('/run/.containerenv')) { $this->connectInstallerToAppwriteNetwork(); } $domain = $input['_APP_DOMAIN'] ?? 'localhost'; $healthStep = $isUpgrade ? InstallerServer::STEP_DOCKER_CONTAINERS : InstallerServer::STEP_ACCOUNT_SETUP; + if ($isUpgrade && $startIndex >= 4) { + $healthStep = InstallerServer::STEP_MIGRATION; + } if (!$isUpgrade) { $currentStep = InstallerServer::STEP_ACCOUNT_SETUP; } $apiUrl = $this->waitForApiReady($domain, $httpPort, $isLocalInstall, $progress, $healthStep); - if ($isUpgrade) { + if ($isUpgrade && $shouldStartContainers) { $this->updateProgress($progress, InstallerServer::STEP_DOCKER_CONTAINERS, InstallerServer::STATUS_COMPLETED, $messages); } - if (!$isUpgrade) { + if (!$isUpgrade && $startIndex <= 3) { $this->createInitialAdminAccount($account, $progress, $apiUrl, $domain); } @@ -762,13 +788,30 @@ class Install extends Action // Allow the SSE chunk to flush before the blocking exec usleep(100_000); - // Static command — no user input involved - $command = $isLocalInstall - ? 'docker compose exec appwrite migrate 2>&1' - : 'docker exec appwrite migrate 2>&1'; + if ($isLocalInstall) { + $composePath = $this->hostPath !== '' ? $this->hostPath : $this->path; + $command = [ + 'docker', + 'compose', + '--env-file', + $composePath . '/' . $this->getEnvFileName(), + '-f', + $composePath . '/' . $this->getComposeFileName(), + '--project-name', + 'appwrite', + '--project-directory', + $composePath, + 'exec', + 'appwrite', + 'migrate', + ]; + } else { + $command = ['docker', 'exec', 'appwrite', 'migrate']; + } + $commandLine = implode(' ', array_map(escapeshellarg(...), $command)); $output = []; - \exec($command, $output, $exit); + \exec($commandLine . ' 2>&1', $output, $exit); if ($exit !== 0) { $message = trim(implode("\n", $output)); @@ -856,9 +899,9 @@ class Install extends Action * the runtime context and returns whichever responds first. * * Candidates (in order of preference): - * - Docker internal DNS (http://appwrite) — only if on the appwrite network - * - host.docker.internal:{port} — reaches host-published ports from inside a container + * - Docker internal DNS (http://appwrite) — preferred when on the appwrite network * - localhost:{port} — works when running directly on the host (local dev) + * - host.docker.internal:{port} — non-local fallback for host-published ports */ private function waitForApiReady(string $domain, string $httpPort, bool $isLocalInstall, ?callable $progress, string $step = InstallerServer::STEP_ACCOUNT_SETUP): string { @@ -872,6 +915,7 @@ class Install extends Action if ($isLocalInstall) { $candidates = [ + self::APPWRITE_API_URL . $healthPath, 'http://localhost:' . $httpPort . $healthPath, ]; } else { @@ -1081,12 +1125,18 @@ class Install extends Action Console::log("Running \"docker compose up -d --remove-orphans --renew-anon-volumes\""); } - $composeFileName = $this->getComposeFileName(); - $composeFile = $this->path . '/' . $composeFileName; + $composePath = $this->path; + if ($isLocalInstall && $this->hostPath !== '') { + $composePath = $this->hostPath; + } + $composeFile = $composePath . '/' . $this->getComposeFileName(); + $envFile = $composePath . '/' . $this->getEnvFileName(); $command = [ 'docker', 'compose', + '--env-file', + $envFile, '-f', $composeFile, ]; @@ -1097,7 +1147,7 @@ class Install extends Action } $command[] = '--project-directory'; - $command[] = $this->path; + $command[] = $composePath; $command[] = 'up'; $command[] = '-d'; $command[] = '--remove-orphans'; From 2120f2f41e1b996996602a089dc7dd8e0af479a3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Sat, 20 Jun 2026 20:53:26 +0530 Subject: [PATCH 142/151] Improve CI image handoff and merged-run behavior (#12629) --- .github/workflows/ci.yml | 169 ++++++++++++++------------------------- 1 file changed, 62 insertions(+), 107 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2bd7ea4a7..488d635828 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,12 @@ name: CI concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: true + group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: COMPOSE_FILE: docker-compose.yml IMAGE: appwrite-dev - REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/appwrite-dev K6_VERSION: '0.53.0' on: @@ -239,36 +238,36 @@ jobs: uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | - const runner4 = `runs-on=${context.runId}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel`; - const runner8 = `runs-on=${context.runId}/runner=8cpu-linux-x64/volume=120g/spot=false/extras=otel`; + const runner4 = `runs-on=${context.runId}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache`; + const runner8 = `runs-on=${context.runId}/runner=8cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache`; const services = [ - { name: 'Account', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Avatars', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Console', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Databases', runner: runner8, functional: false, processes: 3, timeout: 30 }, - { name: 'TablesDB', runner: runner8, functional: false, processes: 3, timeout: 30 }, - { name: 'Functions', runner: runner4, functional: false, processes: null, timeout: 20 }, - { name: 'FunctionsSchedule', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'GraphQL', runner: runner4, functional: false, processes: null, timeout: 20 }, - { name: 'Health', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Advisor', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Locale', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Projects', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Realtime', runner: runner4, functional: false, processes: null, timeout: 20 }, - { name: 'Sites', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Proxy', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Storage', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Tokens', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Teams', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Users', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'ProjectWebhooks', runner: runner4, functional: false, processes: null, timeout: 20 }, - { name: 'Webhooks', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'VCS', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Messaging', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Migrations', runner: runner4, functional: true, processes: 1, timeout: 20 }, - { name: 'Project', runner: runner4, functional: true, processes: null, timeout: 20 }, - { name: 'Presences', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Account', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Avatars', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Console', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Databases', runner: runner8, functional: false, processes: 3, timeout: 15 }, + { name: 'TablesDB', runner: runner8, functional: false, processes: 3, timeout: 15 }, + { name: 'Functions', runner: runner4, functional: false, processes: null, timeout: 15 }, + { name: 'FunctionsSchedule', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'GraphQL', runner: runner4, functional: false, processes: null, timeout: 15 }, + { name: 'Health', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Advisor', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Locale', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Projects', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Realtime', runner: runner4, functional: false, processes: null, timeout: 15 }, + { name: 'Sites', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Proxy', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Storage', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Tokens', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Teams', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Users', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'ProjectWebhooks', runner: runner4, functional: false, processes: null, timeout: 15 }, + { name: 'Webhooks', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'VCS', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Messaging', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Migrations', runner: runner4, functional: true, processes: 1, timeout: 15 }, + { name: 'Project', runner: runner4, functional: true, processes: null, timeout: 15 }, + { name: 'Presences', runner: runner4, functional: true, processes: null, timeout: 15 }, ]; core.setOutput('services', JSON.stringify(services)); @@ -303,7 +302,7 @@ jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+s3-cache+ecr-cache steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -316,13 +315,6 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Docker Buildx uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 @@ -331,9 +323,9 @@ jobs: with: context: . push: true - tags: ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + tags: ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} + cache-from: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }} + cache-to: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }},mode=max target: development build-args: | DEBUG=false @@ -342,7 +334,7 @@ jobs: unit: name: Tests / Unit - runs-on: ubuntu-latest + runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache needs: build permissions: contents: read @@ -358,17 +350,10 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Pull Docker Image run: | - docker pull ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} - docker tag ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} ${{ env.IMAGE }} + docker pull ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} + docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }} - name: Load and Start Appwrite timeout-minutes: 5 @@ -380,9 +365,10 @@ jobs: run: docker compose exec -T appwrite vars - name: Run Unit Tests + timeout-minutes: 15 uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 with: - max_attempts: 2 + max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 timeout_minutes: 15 job_id: ${{ job.check_run_id }} @@ -395,7 +381,7 @@ jobs: e2e_general: name: Tests / E2E / General - runs-on: ubuntu-latest + runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache needs: build permissions: contents: read @@ -411,17 +397,10 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Pull Docker Image run: | - docker pull ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} - docker tag ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} ${{ env.IMAGE }} + docker pull ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} + docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }} - name: Load and Start Appwrite timeout-minutes: 5 @@ -438,9 +417,10 @@ jobs: done - name: Run General Tests + timeout-minutes: 15 uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 with: - max_attempts: 2 + max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 timeout_minutes: 15 job_id: ${{ job.check_run_id }} @@ -502,17 +482,10 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Pull Docker Image run: | - docker pull ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} - docker tag ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} ${{ env.IMAGE }} + docker pull ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} + docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }} - name: Load and Start Appwrite timeout-minutes: 5 @@ -534,9 +507,10 @@ jobs: done - name: Run tests + timeout-minutes: 15 uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 with: - max_attempts: 2 + max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 timeout_minutes: ${{ matrix.service.timeout }} job_id: ${{ job.check_run_id }} @@ -569,7 +543,7 @@ jobs: e2e_abuse: name: Tests / E2E / Abuse (${{ matrix.mode }}) - runs-on: ubuntu-latest + runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache needs: [build, matrix] permissions: contents: read @@ -591,17 +565,10 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Pull Docker Image run: | - docker pull ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} - docker tag ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} ${{ env.IMAGE }} + docker pull ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} + docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }} - name: Load and Start Appwrite timeout-minutes: 5 @@ -615,9 +582,10 @@ jobs: docker compose up -d --quiet-pull --wait - name: Run tests + timeout-minutes: 15 uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 with: - max_attempts: 2 + max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 timeout_minutes: 15 job_id: ${{ job.check_run_id }} @@ -636,7 +604,7 @@ jobs: e2e_screenshots: name: Tests / E2E / Screenshots (${{ matrix.mode }}) - runs-on: ubuntu-latest + runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache needs: [build, matrix] permissions: contents: read @@ -656,17 +624,10 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Pull Docker Image run: | - docker pull ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} - docker tag ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} ${{ env.IMAGE }} + docker pull ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} + docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }} - name: Load and Start Appwrite timeout-minutes: 5 @@ -687,9 +648,10 @@ jobs: done - name: Run tests + timeout-minutes: 15 uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 with: - max_attempts: 2 + max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 timeout_minutes: 15 job_id: ${{ job.check_run_id }} @@ -709,7 +671,7 @@ jobs: benchmark: name: Benchmark if: github.event_name == 'pull_request' || github.event_name == 'push' - runs-on: ubuntu-latest + runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache needs: build permissions: actions: read @@ -729,18 +691,11 @@ jobs: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Pull Appwrite image run: | - docker pull ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} - docker tag ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} ${{ env.IMAGE }} - docker tag ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} ${{ env.IMAGE }}:after + docker pull ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} + docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }} + docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }}:after - name: Setup k6 uses: grafana/setup-k6-action@db07bd9765aac508ef18982e52ab937fe633a065 # v1.2.1 From c2d84ee25e4eb04f6c11b27c26c489ffee35af5f Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sun, 21 Jun 2026 00:04:02 +0100 Subject: [PATCH 143/151] fix(audits): use span attributes instead of per-message Console logging The Audits worker logged on every message via Console (info/log/success/error), flooding worker logs in a hot path (thousands/s) with little signal. Replace with span telemetry on the batch flush: - drop "Aggregating audit logs" (logged per message, before the batch check) - on flush, add audits.projects and audits.count (events) to the span - on a per-project failure, add audits.error instead of Console::error Also fix a PHP 8.x deprecation: the project sequence was used directly as an array key, warning "Using null as an array offset is deprecated" when null. Cast to string (null -> "") to keep the prior coercion without the warning. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/Appwrite/Platform/Workers/Audits.php | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Audits.php b/src/Appwrite/Platform/Workers/Audits.php index e0f50756cb..6c45aa63f3 100644 --- a/src/Appwrite/Platform/Workers/Audits.php +++ b/src/Appwrite/Platform/Workers/Audits.php @@ -5,11 +5,11 @@ namespace Appwrite\Platform\Workers; use Appwrite\Event\Message\Audit; use Exception; use Throwable; -use Utopia\Console; use Utopia\Database\Document; use Utopia\Database\Exception\Structure; use Utopia\Platform\Action; use Utopia\Queue\Message; +use Utopia\Span\Span; use Utopia\System\System; class Audits extends Action @@ -63,8 +63,6 @@ class Audits extends Action $auditMessage = Audit::fromArray($payload); - Console::info('Aggregating audit logs'); - $event = $auditMessage->event; $auditPayload = ''; @@ -123,10 +121,11 @@ class Audits extends Action ]; } - if (isset($this->logs[$auditMessage->project->getSequence()])) { - $this->logs[$auditMessage->project->getSequence()]['logs'][] = $eventData; + $projectSequence = (string) $auditMessage->project->getSequence(); + if (isset($this->logs[$projectSequence])) { + $this->logs[$projectSequence]['logs'][] = $eventData; } else { - $this->logs[$auditMessage->project->getSequence()] = [ + $this->logs[$projectSequence] = [ 'project' => new Document([ '$id' => $auditMessage->project->getId(), '$sequence' => $auditMessage->project->getSequence(), @@ -148,22 +147,25 @@ class Audits extends Action return; } + $projects = 0; + $events = 0; foreach ($this->logs as $sequence => $projectLogs) { try { - Console::log('Processing Project "' . $sequence . '" batch with ' . count($projectLogs['logs']) . ' events'); - - $projectDocument = $projectLogs['project']; - $audit = $getAudit($projectDocument); + $audit = $getAudit($projectLogs['project']); $audit->logBatch($projectLogs['logs']); - Console::success('Audit logs processed successfully'); + $projects++; + $events += count($projectLogs['logs']); } catch (Throwable $e) { - Console::error('Error processing audit logs for Project "' . $sequence . '": ' . $e->getMessage()); + Span::add('audits.error', $e->getMessage()); } finally { unset($this->logs[$sequence]); } } + Span::add('audits.projects', $projects); + Span::add('audits.count', $events); + $this->lastTriggeredTime = time(); } } From 4ce89efe33e0ee8ba5b1522adbf171dfb8f90482 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Sun, 21 Jun 2026 17:27:27 +0100 Subject: [PATCH 144/151] fix(deletes): run execution-limit cleanup sequentially to avoid shared-connection crash deleteExecutionsByLimit() fanned the two resource types out with Swoole\Coroutine\batch(), but both coroutines share one $dbForProject (getProjectDB caches the Database/Pool per host). When one coroutine opens a delete transaction the Pool adapter pins that connection in a process-global field and routes the sibling coroutine's reads onto it, producing "2014 Cannot execute queries while other unbuffered queries are active" and crashing the worker. Process the resource types sequentially so only one transaction holds the connection at a time. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/Appwrite/Platform/Workers/Deletes.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 9eda3dbd52..1ac808c682 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -1106,7 +1106,7 @@ class Deletes extends Action // fast path, no need to list anything! $delete($dbForProject, $resourceInternalId, $resourceType); } else { - $processResource = function (string $type) use ($dbForProject, $delete) { + foreach ([RESOURCE_TYPE_SITES, RESOURCE_TYPE_FUNCTIONS] as $type) { $this->listByGroup( collection: $type, queries: [Query::select(['$id', '$sequence'])], @@ -1115,13 +1115,7 @@ class Deletes extends Action $delete($dbForProject, $resource->getSequence(), $type); } ); - }; - - /* perform processing in parallel */ - batch([ - fn () => $processResource(RESOURCE_TYPE_SITES), - fn () => $processResource(RESOURCE_TYPE_FUNCTIONS), - ]); + } } } From 21b75e37785f2c9fb74e4199131041e4a199afef Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 22 Jun 2026 04:17:32 +0000 Subject: [PATCH 145/151] chore(deps): allow utopia-php/audit 2.6.* audit 2.6.0 carries the ClickHouse audit adapter tenant-leading sort key and LowCardinality schema change. CE/self-hosted uses the Database adapter, not ClickHouse, so this is purely a constraint widening with no functional change. utopia-php/database stays on 6.x. --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 5d75f38d4b..bfd843c9a1 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ "utopia-php/abuse": "1.4.*", "utopia-php/agents": "2.*", "utopia-php/analytics": "0.15.*", - "utopia-php/audit": "2.5.*", + "utopia-php/audit": "2.6.*", "utopia-php/auth": "0.5.*", "utopia-php/cache": "^3.0", "utopia-php/cli": "^0.24", diff --git a/composer.lock b/composer.lock index a43b5016da..c999e053c7 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": "264c11d2628eeebe5722497eca10e576", + "content-hash": "da448b447a61b122c0c454f2b7c86b0d", "packages": [ { "name": "adhocore/jwt", @@ -3269,16 +3269,16 @@ }, { "name": "utopia-php/audit", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "d9e9bb50f2150e0a7ccbe24668ff7230e7cb7a20" + "reference": "f5bb07841e335e9ea7d4bd5860da1f580447014a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/d9e9bb50f2150e0a7ccbe24668ff7230e7cb7a20", - "reference": "d9e9bb50f2150e0a7ccbe24668ff7230e7cb7a20", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/f5bb07841e335e9ea7d4bd5860da1f580447014a", + "reference": "f5bb07841e335e9ea7d4bd5860da1f580447014a", "shasum": "" }, "require": { @@ -3313,9 +3313,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/2.5.0" + "source": "https://github.com/utopia-php/audit/tree/2.6.0" }, - "time": "2026-06-18T11:19:26+00:00" + "time": "2026-06-22T03:33:28+00:00" }, { "name": "utopia-php/auth", From 3930df146c1ac1c5800cc59de1bb08103a921b1b Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 22 Jun 2026 10:10:47 +0530 Subject: [PATCH 146/151] (test): report true per-test duration and de-duplicate variable build tests (#12637) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * (test): report true per-test duration and de-duplicate variable build tests The PHPUnit test reporter printed `durationSinceStart()` — wall-clock elapsed since the run began — and labeled it as per-test duration. That made the numbers climb monotonically across the run and flagged nearly every test past the 15s mark as "slow", even pure CRUD tests that finish in well under a second. Capture an elapsed-since-start stamp when each test is prepared and subtract it at finish, so the reported time and the "slow" warning are the test's own duration. Separately, the variable-in-build integration tests (testProjectVariableInFunction, testProjectVariableInSite) lived in the shared VariablesBase trait and therefore ran in both the console-client and custom-server suites — 4 real Docker/npm builds where 2 suffice. The contract is auth-side independent, so move them into VariablesCustomServerTest only and keep the cheap CRUD coverage shared. * (test): satisfy rector string-cast rule and document refactor pre-check Rector's StringCastAssertStringContainsStringRector requires (string) casts on the assertStringContains(Not) arguments in the moved build tests. Apply them, and add composer refactor / refactor:check to the AGENTS.md command table so the CI "Refactor" check is run before pushing. * fix: purge project cache after config updates * (test): stamp test start at PreparationStarted, not Prepared Prepared fires after setUp/fixtures run, so expensive e2e setup was excluded from the reported per-test duration and the slow-test warning. Listen on PreparationStarted (before preparation begins) instead, and rename the subscriber to match. * (ci): bump php-retry to node24 runtime commit itznotabug/php-retry#15 migrated the action runtime from the deprecated node20 to node24. The v3 tag has not been re-pointed yet, so pin the merged commit (d4500b9) directly to clear the "Node 20 is being deprecated" warning on the unit-test retry step. Updates all 5 pins. * (ci): combine PHP check jobs into a single Checks job * (test): use full-precision duration in per-test reporter durationSinceStart()->seconds() returns only the whole-second part, so the finish-minus-start delta dropped all sub-second time: a 10.9s→11.1s test reported 1000ms instead of ~200ms, and most sub-second tests reported 0ms. Use Duration::asFloat() (seconds + nanoseconds) for both the start stamp and the finish elapsed, and format output as rounded integer ms / 2-decimal seconds. * fix: remove project cache purge calls --- .github/workflows/ci.yml | 144 +++-------- AGENTS.md | 2 + tests/e2e/Services/Project/VariablesBase.php | 242 ----------------- .../Project/VariablesCustomServerTest.php | 243 ++++++++++++++++++ tests/extensions/TestFinishedSubscriber.php | 14 +- tests/extensions/TestHook.php | 1 + .../TestPreparationStartedSubscriber.php | 26 ++ 7 files changed, 321 insertions(+), 351 deletions(-) create mode 100644 tests/extensions/TestPreparationStartedSubscriber.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 488d635828..159782dfbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,111 +91,13 @@ jobs: sarif_file: 'trivy-fs-results.sarif' category: 'trivy-source' - composer: - name: Checks / Composer + checks: + name: Checks runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Setup PHP - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 - with: - php-version: '8.3' - tools: composer:v2 - coverage: none - - - name: Validate - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --ignore-platform-reqs - - - name: Audit - env: - COMPOSER_NO_AUDIT: 0 - run: composer audit - - format: - name: Checks / Format - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - if: github.event_name == 'pull_request' - - - name: Setup PHP - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 - with: - php-version: '8.3' - tools: composer:v2 - coverage: none - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --ignore-platform-reqs - - - name: Run Linter - run: composer lint - - refactor: - name: Checks / Refactor - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Setup PHP - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 - with: - php-version: '8.3' - tools: composer:v2 - coverage: none - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --ignore-platform-reqs - - - name: Run Rector - run: composer refactor:check - - analyze: - name: Checks / Analyze - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Setup PHP - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 - with: - php-version: '8.3' - tools: composer:v2 - coverage: none - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --ignore-platform-reqs - - - name: Cache PHPStan result cache - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: .phpstan-cache - key: phpstan-${{ github.sha }} - restore-keys: | - phpstan- - - - name: Run PHPStan - run: composer analyze -- --no-progress - - specs: - name: Checks / Specs - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Setup PHP uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 with: @@ -204,10 +106,42 @@ jobs: tools: composer:v2 coverage: none + - name: Validate composer.json + run: composer validate + - name: Install dependencies + id: install run: composer install --prefer-dist --no-progress --ignore-platform-reqs + - name: Cache PHPStan result cache + if: ${{ !cancelled() && steps.install.outcome == 'success' }} + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: .phpstan-cache + key: phpstan-${{ github.sha }} + restore-keys: | + phpstan- + + - name: Audit dependencies + if: ${{ !cancelled() && steps.install.outcome == 'success' }} + env: + COMPOSER_NO_AUDIT: 0 + run: composer audit + + - name: Run Linter + if: ${{ !cancelled() && steps.install.outcome == 'success' }} + run: composer lint + + - name: Run Rector + if: ${{ !cancelled() && steps.install.outcome == 'success' }} + run: composer refactor:check + + - name: Run PHPStan + if: ${{ !cancelled() && steps.install.outcome == 'success' }} + run: composer analyze -- --no-progress + - name: Generate specs + if: ${{ !cancelled() && steps.install.outcome == 'success' }} run: _APP_STORAGE_LIMIT=5368709120 php app/cli.php specs --version=latest --git=no locale: @@ -366,7 +300,7 @@ jobs: - name: Run Unit Tests timeout-minutes: 15 - uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 + uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -418,7 +352,7 @@ jobs: - name: Run General Tests timeout-minutes: 15 - uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 + uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -508,7 +442,7 @@ jobs: - name: Run tests timeout-minutes: 15 - uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 + uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -583,7 +517,7 @@ jobs: - name: Run tests timeout-minutes: 15 - uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 + uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -649,7 +583,7 @@ jobs: - name: Run tests timeout-minutes: 15 - uses: itznotabug/php-retry@d6bef45a8bff490babfb613e33b00d133e4062f0 # v3 + uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 diff --git a/AGENTS.md b/AGENTS.md index edaeff9ea5..2a73d6d90e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,6 +15,8 @@ Self-hosted Backend-as-a-Service platform. Hybrid monolithic-microservice archit | `composer lint ` | Check formatting of a file | | `composer analyze` | Static analysis (PHPStan level 3) | | `composer check` | Same as `analyze` | +| `composer refactor:check` | Rector dry-run over `tests/` (CI "Refactor" check) | +| `composer refactor` | Apply Rector fixes | ## Stack diff --git a/tests/e2e/Services/Project/VariablesBase.php b/tests/e2e/Services/Project/VariablesBase.php index b1f8ed61b9..c6cf4115f2 100644 --- a/tests/e2e/Services/Project/VariablesBase.php +++ b/tests/e2e/Services/Project/VariablesBase.php @@ -3,7 +3,6 @@ namespace Tests\E2E\Services\Project; use Appwrite\Tests\Async; -use Appwrite\Tests\Async\Exceptions\Critical; use CURLFile; use Tests\E2E\Client; use Utopia\Console; @@ -11,7 +10,6 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Database\Validator\Datetime as DatetimeValidator; -use Utopia\System\System; trait VariablesBase { @@ -738,246 +736,6 @@ trait VariablesBase $this->assertSame('variable_not_found', $delete['body']['type']); } - // Integration tests - - /** - * Test that project variables are available in function build and runtime. - */ - public function testProjectVariableInFunction(): void - { - $projectId = $this->getProject()['$id']; - $apiKey = $this->getProject()['apiKey']; - - // 1. Create a project variable - $variable = $this->createVariable( - ID::unique(), - 'GLOBAL_VARIABLE', - 'Project Variable Value', - false - ); - - $this->assertSame(201, $variable['headers']['status-code']); - $variableId = $variable['body']['$id']; - - // 2. Create a function with build commands that echo the variable - $function = $this->client->call(Client::METHOD_POST, '/functions', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ], [ - 'functionId' => ID::unique(), - 'name' => 'Project Variable Test', - 'runtime' => 'node-22', - 'entrypoint' => 'index.js', - 'execute' => ['any'], - 'timeout' => 15, - 'commands' => 'echo $GLOBAL_VARIABLE', - ]); - - $this->assertSame(201, $function['headers']['status-code']); - $functionId = $function['body']['$id']; - - // 3. Deploy the function (basic function reads GLOBAL_VARIABLE from env) - $deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments', [ - 'content-type' => 'multipart/form-data', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ], [ - 'code' => $this->packageCode('functions', 'basic'), - 'activate' => true, - ]); - - $this->assertSame(202, $deployment['headers']['status-code']); - $deploymentId = $deployment['body']['$id'] ?? ''; - - // 4. Wait for deployment to be ready and activated - $this->assertEventually(function () use ($projectId, $apiKey, $functionId, $deploymentId) { - $deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/deployments/' . $deploymentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - - $status = $deployment['body']['status'] ?? ''; - if ($status === 'failed') { - throw new Critical('Deployment build failed: ' . ($deployment['body']['buildLogs'] ?? 'no logs')); - } - - $this->assertSame('ready', $status, 'Deployment status is not ready'); - }, 120000, 500); - - $this->assertEventually(function () use ($projectId, $apiKey, $functionId, $deploymentId) { - $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - $this->assertSame($deploymentId, $function['body']['deploymentId'] ?? ''); - }, 120000, 500); - - // 5. Verify the project variable was available during build - $deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/deployments/' . $deploymentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - $this->assertSame(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('Project Variable Value', $deployment['body']['buildLogs']); - - // 6. Execute the function and verify the project variable is in runtime output - $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), [ - 'async' => false, - ]); - - $this->assertSame(201, $execution['headers']['status-code']); - $this->assertSame('completed', $execution['body']['status']); - $this->assertSame(200, $execution['body']['responseStatusCode']); - $output = json_decode($execution['body']['responseBody'], true); - $this->assertSame('Project Variable Value', $output['GLOBAL_VARIABLE']); - - // Cleanup - $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - $this->deleteVariable($variableId); - } - - /** - * Test that project variables are available in site build and SSR runtime. - */ - public function testProjectVariableInSite(): void - { - $projectId = $this->getProject()['$id']; - $apiKey = $this->getProject()['apiKey']; - - // 1. Create a project variable - $variable = $this->createVariable( - ID::unique(), - 'name', - 'ProjectVarTest', - ); - - $this->assertSame(201, $variable['headers']['status-code']); - $variableId = $variable['body']['$id']; - - // 2. Create a site - $site = $this->client->call(Client::METHOD_POST, '/sites', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ], [ - 'siteId' => ID::unique(), - 'name' => 'Project Variable Astro Site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'echo $name && npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - ]); - - $this->assertSame(201, $site['headers']['status-code']); - $siteId = $site['body']['$id']; - - // 3. Setup domain for proxy access - $sitesDomain = \explode(',', System::getEnv('_APP_DOMAIN_SITES', ''))[0]; - $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/site', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), [ - 'domain' => ID::unique() . '.' . $sitesDomain, - 'siteId' => $siteId, - ]); - - $this->assertSame(201, $rule['headers']['status-code']); - - // 4. Deploy the site (astro site reads import.meta.env.name) - $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments', [ - 'content-type' => 'multipart/form-data', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ], [ - 'code' => $this->packageCode('sites', 'astro'), - 'activate' => 'true', - ]); - - $this->assertSame(202, $deployment['headers']['status-code']); - $deploymentId = $deployment['body']['$id'] ?? ''; - - // 5. Wait for deployment to be ready and activated - $this->assertEventually(function () use ($projectId, $apiKey, $siteId, $deploymentId) { - $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - - $status = $deployment['body']['status'] ?? ''; - if ($status === 'failed') { - throw new Critical('Site deployment failed: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - } - - $this->assertSame('ready', $status, 'Deployment status is not ready'); - }, 120000, 500); - - $this->assertEventually(function () use ($projectId, $apiKey, $siteId, $deploymentId) { - $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - $this->assertSame($deploymentId, $site['body']['deploymentId'] ?? ''); - }, 120000, 500); - - // 6. Verify the project variable was available during build - $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - $this->assertSame(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('ProjectVarTest', $deployment['body']['buildLogs']); - - // 7. Get the domain and access the site - $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), [ - 'queries' => [ - Query::equal('deploymentResourceId', [$siteId])->toString(), - Query::equal('trigger', ['manual'])->toString(), - Query::equal('type', ['deployment'])->toString(), - ], - ]); - - $this->assertSame(200, $rules['headers']['status-code']); - $this->assertGreaterThanOrEqual(1, \count($rules['body']['rules'])); - $domain = $rules['body']['rules'][0]['domain']; - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/'); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertStringContainsString('Env variable is ProjectVarTest', $response['body']); - $this->assertStringNotContainsString('Variable not found', $response['body']); - - // Cleanup - $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apiKey, - ]); - $this->deleteVariable($variableId); - } - // Helpers protected function createVariable(string $variableId, ?string $key, ?string $value, ?bool $secret = null, bool $authenticated = true): mixed diff --git a/tests/e2e/Services/Project/VariablesCustomServerTest.php b/tests/e2e/Services/Project/VariablesCustomServerTest.php index f4af7069cb..6c710fecf2 100644 --- a/tests/e2e/Services/Project/VariablesCustomServerTest.php +++ b/tests/e2e/Services/Project/VariablesCustomServerTest.php @@ -4,13 +4,256 @@ declare(strict_types=1); namespace Tests\E2E\Services\Project; +use Appwrite\Tests\Async\Exceptions\Critical; +use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Query; +use Utopia\System\System; final class VariablesCustomServerTest extends Scope { use VariablesBase; use ProjectCustom; use SideServer; + + /** + * Test that project variables are available in function build and runtime. + */ + public function testProjectVariableInFunction(): void + { + $projectId = $this->getProject()['$id']; + $apiKey = $this->getProject()['apiKey']; + + // 1. Create a project variable + $variable = $this->createVariable( + ID::unique(), + 'GLOBAL_VARIABLE', + 'Project Variable Value', + false + ); + + $this->assertSame(201, $variable['headers']['status-code']); + $variableId = $variable['body']['$id']; + + // 2. Create a function with build commands that echo the variable + $function = $this->client->call(Client::METHOD_POST, '/functions', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ], [ + 'functionId' => ID::unique(), + 'name' => 'Project Variable Test', + 'runtime' => 'node-22', + 'entrypoint' => 'index.js', + 'execute' => ['any'], + 'timeout' => 15, + 'commands' => 'echo $GLOBAL_VARIABLE', + ]); + + $this->assertSame(201, $function['headers']['status-code']); + $functionId = $function['body']['$id']; + + // 3. Deploy the function (basic function reads GLOBAL_VARIABLE from env) + $deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments', [ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ], [ + 'code' => $this->packageCode('functions', 'basic'), + 'activate' => true, + ]); + + $this->assertSame(202, $deployment['headers']['status-code']); + $deploymentId = $deployment['body']['$id'] ?? ''; + + // 4. Wait for deployment to be ready and activated + $this->assertEventually(function () use ($projectId, $apiKey, $functionId, $deploymentId) { + $deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/deployments/' . $deploymentId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + + $status = $deployment['body']['status'] ?? ''; + if ($status === 'failed') { + throw new Critical('Deployment build failed: ' . ($deployment['body']['buildLogs'] ?? 'no logs')); + } + + $this->assertSame('ready', $status, 'Deployment status is not ready'); + }, 120000, 500); + + $this->assertEventually(function () use ($projectId, $apiKey, $functionId, $deploymentId) { + $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + $this->assertSame($deploymentId, $function['body']['deploymentId'] ?? ''); + }, 120000, 500); + + // 5. Verify the project variable was available during build + $deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/deployments/' . $deploymentId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + $this->assertSame(200, $deployment['headers']['status-code']); + $this->assertStringContainsString('Project Variable Value', (string) $deployment['body']['buildLogs']); + + // 6. Execute the function and verify the project variable is in runtime output + $execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'async' => false, + ]); + + $this->assertSame(201, $execution['headers']['status-code']); + $this->assertSame('completed', $execution['body']['status']); + $this->assertSame(200, $execution['body']['responseStatusCode']); + $output = json_decode($execution['body']['responseBody'], true); + $this->assertSame('Project Variable Value', $output['GLOBAL_VARIABLE']); + + // Cleanup + $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + $this->deleteVariable($variableId); + } + + /** + * Test that project variables are available in site build and SSR runtime. + */ + public function testProjectVariableInSite(): void + { + $projectId = $this->getProject()['$id']; + $apiKey = $this->getProject()['apiKey']; + + // 1. Create a project variable + $variable = $this->createVariable( + ID::unique(), + 'name', + 'ProjectVarTest', + ); + + $this->assertSame(201, $variable['headers']['status-code']); + $variableId = $variable['body']['$id']; + + // 2. Create a site + $site = $this->client->call(Client::METHOD_POST, '/sites', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ], [ + 'siteId' => ID::unique(), + 'name' => 'Project Variable Astro Site', + 'framework' => 'astro', + 'adapter' => 'ssr', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'echo $name && npm run build', + 'installCommand' => 'npm ci', + 'fallbackFile' => '', + ]); + + $this->assertSame(201, $site['headers']['status-code']); + $siteId = $site['body']['$id']; + + // 3. Setup domain for proxy access + $sitesDomain = \explode(',', System::getEnv('_APP_DOMAIN_SITES', ''))[0]; + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/site', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'domain' => ID::unique() . '.' . $sitesDomain, + 'siteId' => $siteId, + ]); + + $this->assertSame(201, $rule['headers']['status-code']); + + // 4. Deploy the site (astro site reads import.meta.env.name) + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments', [ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ], [ + 'code' => $this->packageCode('sites', 'astro'), + 'activate' => 'true', + ]); + + $this->assertSame(202, $deployment['headers']['status-code']); + $deploymentId = $deployment['body']['$id'] ?? ''; + + // 5. Wait for deployment to be ready and activated + $this->assertEventually(function () use ($projectId, $apiKey, $siteId, $deploymentId) { + $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + + $status = $deployment['body']['status'] ?? ''; + if ($status === 'failed') { + throw new Critical('Site deployment failed: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + } + + $this->assertSame('ready', $status, 'Deployment status is not ready'); + }, 120000, 500); + + $this->assertEventually(function () use ($projectId, $apiKey, $siteId, $deploymentId) { + $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + $this->assertSame($deploymentId, $site['body']['deploymentId'] ?? ''); + }, 120000, 500); + + // 6. Verify the project variable was available during build + $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + $this->assertSame(200, $deployment['headers']['status-code']); + $this->assertStringContainsString('ProjectVarTest', (string) $deployment['body']['buildLogs']); + + // 7. Get the domain and access the site + $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('deploymentResourceId', [$siteId])->toString(), + Query::equal('trigger', ['manual'])->toString(), + Query::equal('type', ['deployment'])->toString(), + ], + ]); + + $this->assertSame(200, $rules['headers']['status-code']); + $this->assertGreaterThanOrEqual(1, \count($rules['body']['rules'])); + $domain = $rules['body']['rules'][0]['domain']; + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertSame(200, $response['headers']['status-code']); + $this->assertStringContainsString('Env variable is ProjectVarTest', (string) $response['body']); + $this->assertStringNotContainsString('Variable not found', (string) $response['body']); + + // Cleanup + $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + ]); + $this->deleteVariable($variableId); + } } diff --git a/tests/extensions/TestFinishedSubscriber.php b/tests/extensions/TestFinishedSubscriber.php index e07a9b67ed..fd58ad1f88 100644 --- a/tests/extensions/TestFinishedSubscriber.php +++ b/tests/extensions/TestFinishedSubscriber.php @@ -15,16 +15,22 @@ class TestFinishedSubscriber implements FinishedSubscriber public function notify(Finished $event): void { $test = $event->test()->name(); - $time = $event->telemetryInfo()->durationSinceStart()->seconds(); + $testId = $event->test()->id(); + + $elapsed = $event->telemetryInfo()->durationSinceStart()->asFloat(); + $start = TestPreparationStartedSubscriber::$startSeconds[$testId] ?? null; + $time = $start === null ? $elapsed : $elapsed - $start; + + unset(TestPreparationStartedSubscriber::$startSeconds[$testId]); printf( - "%s ended in %s milliseconds\n", + "%s ended in %d milliseconds\n", $test, - $time * 1000 + (int) round($time * 1000) ); if ($time > $this->maxSecondsAllowed) { - fwrite(STDOUT, sprintf("\e[31mThe %s test is slow, it took %s seconds!\n\e[0m", $test, $time)); + fwrite(STDOUT, sprintf("\e[31mThe %s test is slow, it took %.2f seconds!\n\e[0m", $test, $time)); } } } diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index 6ac1ec4afe..00cdfda33c 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -13,6 +13,7 @@ class TestHook implements Extension public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void { + $facade->registerSubscriber(new TestPreparationStartedSubscriber()); $facade->registerSubscriber(new TestFinishedSubscriber(self::MAX_SECONDS_ALLOWED)); $facade->registerSubscriber(new RetrySubscriber()); } diff --git a/tests/extensions/TestPreparationStartedSubscriber.php b/tests/extensions/TestPreparationStartedSubscriber.php new file mode 100644 index 0000000000..3bb59e52a8 --- /dev/null +++ b/tests/extensions/TestPreparationStartedSubscriber.php @@ -0,0 +1,26 @@ + + */ + public static array $startSeconds = []; + + public function notify(PreparationStarted $event): void + { + self::$startSeconds[$event->test()->id()] = $event->telemetryInfo()->durationSinceStart()->asFloat(); + } +} From 9b2b0def15c040972d7c55bcd51b99cd23777dbb Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 22 Jun 2026 11:22:23 +0530 Subject: [PATCH 147/151] Bump utopia auth to 0.6 (#12642) --- composer.json | 2 +- composer.lock | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index bfd843c9a1..f952d94d89 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,7 @@ "utopia-php/agents": "2.*", "utopia-php/analytics": "0.15.*", "utopia-php/audit": "2.6.*", - "utopia-php/auth": "0.5.*", + "utopia-php/auth": "^0.6", "utopia-php/cache": "^3.0", "utopia-php/cli": "^0.24", "utopia-php/compression": "0.1.*", diff --git a/composer.lock b/composer.lock index c999e053c7..969d2985ee 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": "da448b447a61b122c0c454f2b7c86b0d", + "content-hash": "bf0c07c029c54b225566c1a731fccae0", "packages": [ { "name": "adhocore/jwt", @@ -3319,16 +3319,16 @@ }, { "name": "utopia-php/auth", - "version": "0.5.1", + "version": "0.6.1", "source": { "type": "git", "url": "https://github.com/utopia-php/auth.git", - "reference": "9245a6342ed94f00425aef6963a32b8af9b0dc9d" + "reference": "8323a51314f6988c62926117ed642588ca8e8c4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/auth/zipball/9245a6342ed94f00425aef6963a32b8af9b0dc9d", - "reference": "9245a6342ed94f00425aef6963a32b8af9b0dc9d", + "url": "https://api.github.com/repos/utopia-php/auth/zipball/8323a51314f6988c62926117ed642588ca8e8c4a", + "reference": "8323a51314f6988c62926117ed642588ca8e8c4a", "shasum": "" }, "require": { @@ -3338,12 +3338,6 @@ "ext-sodium": "*", "php": ">=8.0" }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "1.9.x-dev", - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" - }, "type": "library", "autoload": { "psr-4": { @@ -3369,9 +3363,9 @@ ], "support": { "issues": "https://github.com/utopia-php/auth/issues", - "source": "https://github.com/utopia-php/auth/tree/0.5.1" + "source": "https://github.com/utopia-php/auth/tree/0.6.1" }, - "time": "2026-05-30T12:21:17+00:00" + "time": "2026-06-20T09:45:06+00:00" }, { "name": "utopia-php/cache", From 62cf3f303b7b59520e77799647743c84f6500a9e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 22 Jun 2026 14:26:45 +0530 Subject: [PATCH 148/151] Fix project OAuth provider sparse update (#12646) --- app/controllers/api/projects.php | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 8ab30fac99..a39ce3c4bd 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -38,27 +38,31 @@ Http::patch('/v1/projects/:projectId/oauth2') ->inject('dbForPlatform') ->action(function (string $projectId, string $provider, ?string $appId, ?string $secret, ?bool $enabled, Response $response, Database $dbForPlatform) { - $project = $dbForPlatform->getDocument('projects', $projectId); + $project = $dbForPlatform->withTransaction(function () use ($dbForPlatform, $projectId, $provider, $appId, $secret, $enabled) { + $project = $dbForPlatform->getDocument('projects', $projectId, forUpdate: true); - if ($project->isEmpty()) { - throw new Exception(Exception::PROJECT_NOT_FOUND); - } + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } - $providers = $project->getAttribute('oAuthProviders', []); + $providers = $project->getAttribute('oAuthProviders', []); - if ($appId !== null) { - $providers[$provider . 'Appid'] = $appId; - } + if ($appId !== null) { + $providers[$provider . 'Appid'] = $appId; + } - if ($secret !== null) { - $providers[$provider . 'Secret'] = $secret; - } + if ($secret !== null) { + $providers[$provider . 'Secret'] = $secret; + } - if ($enabled !== null) { - $providers[$provider . 'Enabled'] = $enabled; - } + if ($enabled !== null) { + $providers[$provider . 'Enabled'] = $enabled; + } - $project = $dbForPlatform->updateDocument('projects', $project->getId(), $project->setAttribute('oAuthProviders', $providers)); + return $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'oAuthProviders' => $providers, + ])); + }); $response->dynamic($project, Response::MODEL_PROJECT); }); From 90a5575cb9e5838c34858c4fd7f6dd7e859dc565 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 22 Jun 2026 14:41:57 +0530 Subject: [PATCH 149/151] Update php-retry action to v4 (#12647) --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 159782dfbb..5c734df8e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -300,7 +300,7 @@ jobs: - name: Run Unit Tests timeout-minutes: 15 - uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 + uses: itznotabug/php-retry@60547503cb2126eddaa082d0999e99cfca2b3856 # v4 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -352,7 +352,7 @@ jobs: - name: Run General Tests timeout-minutes: 15 - uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 + uses: itznotabug/php-retry@60547503cb2126eddaa082d0999e99cfca2b3856 # v4 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -442,7 +442,7 @@ jobs: - name: Run tests timeout-minutes: 15 - uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 + uses: itznotabug/php-retry@60547503cb2126eddaa082d0999e99cfca2b3856 # v4 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -517,7 +517,7 @@ jobs: - name: Run tests timeout-minutes: 15 - uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 + uses: itznotabug/php-retry@60547503cb2126eddaa082d0999e99cfca2b3856 # v4 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 @@ -583,7 +583,7 @@ jobs: - name: Run tests timeout-minutes: 15 - uses: itznotabug/php-retry@d4500b9db3258e2cc8857427980f28e1611eb79c # v3 + uses: itznotabug/php-retry@60547503cb2126eddaa082d0999e99cfca2b3856 # v4 with: max_attempts: ${{ github.event_name == 'pull_request' && 2 || 1 }} retry_wait_seconds: 60 From 76f42eeaf3d47c25be80c4ecffb9f23a81f151e9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 22 Jun 2026 17:41:44 +0530 Subject: [PATCH 150/151] Bump utopia-php/auth to ^0.7 (#12651) --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index f952d94d89..21432398af 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,7 @@ "utopia-php/agents": "2.*", "utopia-php/analytics": "0.15.*", "utopia-php/audit": "2.6.*", - "utopia-php/auth": "^0.6", + "utopia-php/auth": "^0.7", "utopia-php/cache": "^3.0", "utopia-php/cli": "^0.24", "utopia-php/compression": "0.1.*", diff --git a/composer.lock b/composer.lock index 969d2985ee..d3bee71eb6 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": "bf0c07c029c54b225566c1a731fccae0", + "content-hash": "2c365042d311895a9cddaceca7623b1e", "packages": [ { "name": "adhocore/jwt", @@ -3319,16 +3319,16 @@ }, { "name": "utopia-php/auth", - "version": "0.6.1", + "version": "0.7.0", "source": { "type": "git", "url": "https://github.com/utopia-php/auth.git", - "reference": "8323a51314f6988c62926117ed642588ca8e8c4a" + "reference": "22a2cf6ca604e5cc6bf10f0f8240195f0baa063a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/auth/zipball/8323a51314f6988c62926117ed642588ca8e8c4a", - "reference": "8323a51314f6988c62926117ed642588ca8e8c4a", + "url": "https://api.github.com/repos/utopia-php/auth/zipball/22a2cf6ca604e5cc6bf10f0f8240195f0baa063a", + "reference": "22a2cf6ca604e5cc6bf10f0f8240195f0baa063a", "shasum": "" }, "require": { @@ -3336,7 +3336,7 @@ "ext-openssl": "*", "ext-scrypt": "*", "ext-sodium": "*", - "php": ">=8.0" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -3363,9 +3363,9 @@ ], "support": { "issues": "https://github.com/utopia-php/auth/issues", - "source": "https://github.com/utopia-php/auth/tree/0.6.1" + "source": "https://github.com/utopia-php/auth/tree/0.7.0" }, - "time": "2026-06-20T09:45:06+00:00" + "time": "2026-06-22T11:58:24+00:00" }, { "name": "utopia-php/cache", From a51da57b360ae86564e3501de9dfd41f6aaf8bbd Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 23 Jun 2026 11:11:18 +0530 Subject: [PATCH 151/151] feat(messaging): attach project ID to internal SMS for provider attribution (#12653) * feat(messaging): attach project ID to internal SMS for provider attribution Internal (auth) SMS such as phone OTP, MFA challenges and team invites are sent through Appwrite's own provider, but the provider's delivery logs and webhooks carry no way to trace a message back to the project that triggered it. Attach the project ID as the MSG91 UUID tracking field (supported via utopia-php/messaging 1.2.0) so provider-side reports can be reconciled per project. Bumps utopia-php/messaging 1.1.0 -> 1.2.0. * chore(messaging): require utopia-php/messaging ^1.2 The internal SMS path now depends on SMS::setMetadata() and the Msg91\MetadataParameter enum, both introduced in 1.2.0, so raise the constraint from ^1.1 to ^1.2 to enforce the minimum at install time. --- composer.json | 2 +- composer.lock | 14 +++++++------- src/Appwrite/Platform/Workers/Messaging.php | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 21432398af..2a1499f1a8 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,7 @@ "utopia-php/locale": "0.8.*", "utopia-php/lock": "0.2.*", "utopia-php/logger": "0.8.*", - "utopia-php/messaging": "^1.1", + "utopia-php/messaging": "^1.2", "utopia-php/migration": "1.14.*", "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "1.*", diff --git a/composer.lock b/composer.lock index d3bee71eb6..652b26e041 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": "2c365042d311895a9cddaceca7623b1e", + "content-hash": "508b3e633843d61eb24f864fd8832db0", "packages": [ { "name": "adhocore/jwt", @@ -4348,16 +4348,16 @@ }, { "name": "utopia-php/messaging", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "2a8e82cda89b373833e10923ae959f56466300a3" + "reference": "3419ffbbeb242b3232b588430bd465024959720c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/2a8e82cda89b373833e10923ae959f56466300a3", - "reference": "2a8e82cda89b373833e10923ae959f56466300a3", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/3419ffbbeb242b3232b588430bd465024959720c", + "reference": "3419ffbbeb242b3232b588430bd465024959720c", "shasum": "" }, "require": { @@ -4394,9 +4394,9 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/1.1.0" + "source": "https://github.com/utopia-php/messaging/tree/1.2.0" }, - "time": "2026-06-16T03:44:58+00:00" + "time": "2026-06-23T04:24:43+00:00" }, { "name": "utopia-php/migration", diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 2a827f82cb..92745a0f91 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -33,6 +33,7 @@ use Utopia\Messaging\Adapter\SMS\GEOSMS; use Utopia\Messaging\Adapter\SMS\Inforu; use Utopia\Messaging\Adapter\SMS\Mock; use Utopia\Messaging\Adapter\SMS\Msg91; +use Utopia\Messaging\Adapter\SMS\Msg91\MetadataParameter; use Utopia\Messaging\Adapter\SMS\Telesign; use Utopia\Messaging\Adapter\SMS\TextMagic; use Utopia\Messaging\Adapter\SMS\Twilio; @@ -824,6 +825,10 @@ class Messaging extends Action ); $sms->setOrigin(MESSAGE_SEND_TYPE_INTERNAL); + // Attach the project ID so the SMS provider's delivery logs and + // webhooks can be attributed back to the originating project. + $sms->setMetadata([MetadataParameter::UUID->value => $project->getId()]); + $this->adapter->send($sms); }