From 2529d64791dfe9ab2349694ae80547d347932a83 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 29 Jul 2025 16:53:13 +1200 Subject: [PATCH 01/28] Filter sequence to int because any models skip rule checks --- src/Appwrite/Utopia/Response/Model/Document.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Appwrite/Utopia/Response/Model/Document.php b/src/Appwrite/Utopia/Response/Model/Document.php index d43ab0d1e6..c36d6de12e 100644 --- a/src/Appwrite/Utopia/Response/Model/Document.php +++ b/src/Appwrite/Utopia/Response/Model/Document.php @@ -79,6 +79,7 @@ class Document extends Any { $document->removeAttribute('$collection'); $document->removeAttribute('$tenant'); + $document->setAttribute('$sequence', (int)$document->getAttribute('$sequence', 0)); foreach ($document->getAttributes() as $attribute) { if (\is_array($attribute)) { From 360e4ce9923703436194fd140fff0b2890d680d6 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 29 Jul 2025 16:54:39 +1200 Subject: [PATCH 02/28] Add test case --- tests/e2e/Services/Databases/DatabasesBase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index be982ac145..de5d33f29d 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -1657,6 +1657,7 @@ trait DatabasesBase $this->assertEquals($document1['body']['actors'][1], 'Samuel Jackson'); $this->assertEquals($document1['body']['birthDay'], '1975-06-12T12:12:55.000+00:00'); $this->assertTrue(array_key_exists('$sequence', $document1['body'])); + $this->assertIsInt($document1['body']['$sequence']); $this->assertEquals(201, $document2['headers']['status-code']); $this->assertEquals($data['moviesId'], $document2['body']['$collectionId']); From b69ad22485cb709c3b97b359d640c738384b481a Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 29 Jul 2025 10:25:31 +0530 Subject: [PATCH 03/28] updated migration release --- composer.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 8bc8ffaebe..5cd409fac6 100644 --- a/composer.lock +++ b/composer.lock @@ -3993,16 +3993,16 @@ }, { "name": "utopia-php/migration", - "version": "0.11.1", + "version": "0.11.2", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "d528a454d5c1ed6564b2843a39ff13297bcdb1af" + "reference": "00f2b8e9927883f611e4e1ff179fa79e6bb2a12a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/d528a454d5c1ed6564b2843a39ff13297bcdb1af", - "reference": "d528a454d5c1ed6564b2843a39ff13297bcdb1af", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/00f2b8e9927883f611e4e1ff179fa79e6bb2a12a", + "reference": "00f2b8e9927883f611e4e1ff179fa79e6bb2a12a", "shasum": "" }, "require": { @@ -4043,9 +4043,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.11.1" + "source": "https://github.com/utopia-php/migration/tree/0.11.2" }, - "time": "2025-07-11T13:46:37+00:00" + "time": "2025-07-29T04:27:20+00:00" }, { "name": "utopia-php/orchestration", @@ -4810,16 +4810,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.41.23", + "version": "0.41.24", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "188dff738ff7b9f1f9209b34ac2092b5456b1001" + "reference": "c9ebf8daa25332ca701515d42e8d0c4a7be6a489" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/188dff738ff7b9f1f9209b34ac2092b5456b1001", - "reference": "188dff738ff7b9f1f9209b34ac2092b5456b1001", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/c9ebf8daa25332ca701515d42e8d0c4a7be6a489", + "reference": "c9ebf8daa25332ca701515d42e8d0c4a7be6a489", "shasum": "" }, "require": { @@ -4855,9 +4855,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.41.23" + "source": "https://github.com/appwrite/sdk-generator/tree/0.41.24" }, - "time": "2025-07-25T06:47:04+00:00" + "time": "2025-07-28T06:27:00+00:00" }, { "name": "doctrine/annotations", @@ -5336,16 +5336,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.5.0", + "version": "v5.6.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "ae59794362fe85e051a58ad36b289443f57be7a9" + "reference": "221b0d0fdf1369c71047ad1d18bb5880017bbc56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9", - "reference": "ae59794362fe85e051a58ad36b289443f57be7a9", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/221b0d0fdf1369c71047ad1d18bb5880017bbc56", + "reference": "221b0d0fdf1369c71047ad1d18bb5880017bbc56", "shasum": "" }, "require": { @@ -5388,9 +5388,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.0" }, - "time": "2025-05-31T08:24:38+00:00" + "time": "2025-07-27T20:03:57+00:00" }, { "name": "phar-io/manifest", From 06e4920ee224b27bbcbdd1bda1adefb638a3e9a8 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 29 Jul 2025 11:57:57 +0530 Subject: [PATCH 04/28] fix: create email target when using email otp registration --- app/controllers/api/account.php | 26 +++++++++++++++++++++- tests/e2e/Services/Account/AccountBase.php | 6 ++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 6adbf61d6d..df17051d6d 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -2239,7 +2239,31 @@ App::post('/v1/account/tokens/email') ]); $user->removeAttribute('$sequence'); - Authorization::skip(fn () => $dbForProject->createDocument('users', $user)); + $user = Authorization::skip(fn () => $dbForProject->createDocument('users', $user)); + + try { + $target = Authorization::skip(fn () => $dbForProject->createDocument('targets', new Document([ + '$permissions' => [ + Permission::read(Role::user($user->getId())), + Permission::update(Role::user($user->getId())), + Permission::delete(Role::user($user->getId())), + ], + 'userId' => $user->getId(), + 'userInternalId' => $user->getSequence(), + 'providerType' => MESSAGE_TYPE_EMAIL, + 'identifier' => $email, + ]))); + $user->setAttribute('targets', [...$user->getAttribute('targets', []), $target]); + } catch (Duplicate) { + $existingTarget = $dbForProject->findOne('targets', [ + Query::equal('identifier', [$email]), + ]); + if (!$existingTarget->isEmpty()) { + $user->setAttribute('targets', $existingTarget, Document::SET_TYPE_APPEND); + } + } + + $dbForProject->purgeCachedDocument('users', $user->getId()); } $tokenSecret = Auth::codeGenerator(6); diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 7c83edf3e3..8813e2784f 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -39,6 +39,8 @@ trait AccountBase $this->assertEquals($response['body']['labels'], []); $this->assertArrayHasKey('accessedAt', $response['body']); $this->assertNotEmpty($response['body']['accessedAt']); + $this->assertArrayHasKey('targets', $response['body']); + $this->assertEquals($email, $response['body']['targets'][0]['identifier']); /** * Test for FAILURE @@ -159,7 +161,7 @@ trait AccountBase 'email' => 'otpuser@appwrite.io' ]); - $this->assertEquals(201, $response['headers']['status-code'], ); + $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertNotEmpty($response['body']['$createdAt']); $this->assertNotEmpty($response['body']['userId']); @@ -209,6 +211,8 @@ trait AccountBase $this->assertEquals($userId, $response['body']['$id']); $this->assertEquals($userId, $response['body']['$id']); $this->assertTrue($response['body']['emailVerification']); + $this->assertArrayHasKey('targets', $response['body']); + $this->assertEquals('otpuser@appwrite.io', $response['body']['targets'][0]['identifier']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/token', array_merge([ 'origin' => 'http://localhost', From 7ad01fcadae3edaad48ca009b15cbe7e8e1ee1c8 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 29 Jul 2025 12:23:06 +0530 Subject: [PATCH 05/28] linebreak --- app/controllers/api/account.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index df17051d6d..61b71930eb 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -2240,7 +2240,6 @@ App::post('/v1/account/tokens/email') $user->removeAttribute('$sequence'); $user = Authorization::skip(fn () => $dbForProject->createDocument('users', $user)); - try { $target = Authorization::skip(fn () => $dbForProject->createDocument('targets', new Document([ '$permissions' => [ From 3db9cd06d5e8aae55f912fa05e6f677a7adf51d6 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 29 Jul 2025 15:21:15 +0530 Subject: [PATCH 06/28] chore: filter certificates renewal task in maintenance by region --- src/Appwrite/Platform/Tasks/Maintenance.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index e6def793b5..4ffbcbbe8e 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -122,6 +122,15 @@ class Maintenance extends Action Console::info("[{$time}] Found " . \count($certificates) . " certificates for renewal, scheduling jobs."); foreach ($certificates as $certificate) { + $rule = $dbForPlatform->find('rules', [ + Query::equal('domain', [$certificate->getAttribute('domain')]), + Query::limit(1), + ]); + + if (!$rule[0] || $rule[0]->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) { + continue; + } + $queueForCertificate ->setDomain(new Document([ 'domain' => $certificate->getAttribute('domain') From 1731212ebbf1b69d753050f47538e4b177590a9c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 29 Jul 2025 15:26:37 +0530 Subject: [PATCH 07/28] chore: improve check --- src/Appwrite/Platform/Tasks/Maintenance.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index 4ffbcbbe8e..aec6e78a6f 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -122,12 +122,11 @@ class Maintenance extends Action Console::info("[{$time}] Found " . \count($certificates) . " certificates for renewal, scheduling jobs."); foreach ($certificates as $certificate) { - $rule = $dbForPlatform->find('rules', [ + $rule = $dbForPlatform->findOne('rules', [ Query::equal('domain', [$certificate->getAttribute('domain')]), - Query::limit(1), ]); - if (!$rule[0] || $rule[0]->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) { + if ($rule->isEmpty() || $rule->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) { continue; } From 66786f20f0d6b4ddb58be775f6c86f9596f0d2f9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 29 Jul 2025 16:53:55 +0530 Subject: [PATCH 08/28] chore: use md5 if enabled --- src/Appwrite/Platform/Tasks/Maintenance.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index aec6e78a6f..036e8783d4 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -122,9 +122,14 @@ class Maintenance extends Action Console::info("[{$time}] Found " . \count($certificates) . " certificates for renewal, scheduling jobs."); foreach ($certificates as $certificate) { - $rule = $dbForPlatform->findOne('rules', [ - Query::equal('domain', [$certificate->getAttribute('domain')]), - ]); + $domain = $certificate->getAttribute('domain'); + if (System::getEnv('_APP_RULES_FORMAT') === 'md5') { + $rule = $dbForPlatform->getDocument('rules', md5($domain)); + } else { + $rule = $dbForPlatform->findOne('rules', [ + Query::equal('domain', [$domain]), + ]); + } if ($rule->isEmpty() || $rule->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) { continue; From ccf0a23bdfd5eaa872a68be651f4d9057f900dda Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 30 Jul 2025 01:02:21 +1200 Subject: [PATCH 09/28] Remove sequence on incoming docs --- app/controllers/api/databases.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 3378d011c9..89b31a10db 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -3453,6 +3453,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents') } else { $relation->removeAttribute('$collectionId'); $relation->removeAttribute('$databaseId'); + $relation->removeAttribute('$sequence'); $relation->setAttribute('$collection', $relatedCollection->getId()); $type = Database::PERMISSION_UPDATE; } @@ -3485,6 +3486,9 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents') } } + // Remove sequence if set + unset($document['$sequence']); + // Assign a unique ID if needed, otherwise use the provided ID. $document['$id'] = $sourceId === 'unique()' ? ID::unique() : $sourceId; $document = new Document($document); @@ -4074,6 +4078,9 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum $permissions = $document->getPermissions() ?? []; } + // Remove sequence if set + unset($data['$sequence']); + $data['$id'] = $documentId; $data['$permissions'] = $permissions; $newDocument = new Document($data); @@ -4708,6 +4715,9 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents') } } + // Remove sequence if set + unset($data['$sequence']); + $documents = []; try { From 933f07c1758f733c852770315a33035292a91663 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 30 Jul 2025 01:18:08 +1200 Subject: [PATCH 10/28] Add missing removal --- app/controllers/api/databases.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 89b31a10db..45ca444c1c 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -4133,6 +4133,7 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum )); $relation->removeAttribute('$collectionId'); $relation->removeAttribute('$databaseId'); + $relation->removeAttribute('$sequence'); // Attribute $collection is required for Utopia. $relation->setAttribute( '$collection', From 01c8dab34d5b1d441e632164bac0d4c73a0d59db Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 30 Jul 2025 16:46:14 +1200 Subject: [PATCH 11/28] Fix CSV success test --- .../Services/Migrations/MigrationsBase.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 6bc1f2d427..fd05019b80 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -903,7 +903,7 @@ trait MigrationsBase */ public function testCreateCsvMigration(): array { - // make a database + // Make a database $response = $this->client->call(Client::METHOD_POST, '/databases', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -1112,7 +1112,7 @@ trait MigrationsBase ); }, 60000, 500); - // all data exists, pass/ + // all data exists, pass. $migration = $this->performCsvMigration( [ 'endpoint' => 'http://localhost/v1', @@ -1122,11 +1122,22 @@ trait MigrationsBase ] ); - $this->assertEmpty($migration['body']['statusCounters']); - $this->assertEquals('CSV', $migration['body']['source']); - $this->assertEquals('pending', $migration['body']['status']); - $this->assertEquals('Appwrite', $migration['body']['destination']); - $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + $this->assertEventually(function () use ($migration, $databaseId, $collectionId) { + $migrationId = $migration['body']['$id']; + $migration = $this->client->call(Client::METHOD_GET, '/migrations/'.$migrationId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $migration['headers']['status-code']); + $this->assertEquals('finished', $migration['body']['stage']); + $this->assertEquals('completed', $migration['body']['status']); + $this->assertEquals('CSV', $migration['body']['source']); + $this->assertEquals('Appwrite', $migration['body']['destination']); + $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); + $this->assertEquals(100, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); + }, 60_000, 500); return [ 'databaseId' => $databaseId, From 5b12a6c8b1dc0e994f21a64ab9dfdb4612037dbd Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 30 Jul 2025 16:50:09 +1200 Subject: [PATCH 12/28] Add internal attributes CSV test --- composer.json | 2 +- composer.lock | 27 ++++++++++------ .../Services/Migrations/MigrationsBase.php | 31 ++++++++++++++++++- tests/resources/csv/documents-internals.csv | 26 ++++++++++++++++ 4 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 tests/resources/csv/documents-internals.csv diff --git a/composer.json b/composer.json index 31a31af9f2..f9e22b5557 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,7 @@ "utopia-php/locale": "0.4.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.18.*", - "utopia-php/migration": "0.11.*", + "utopia-php/migration": "dev-feat-csv-allow-internals as 0.11.2", "utopia-php/orchestration": "0.9.*", "utopia-php/platform": "0.7.*", "utopia-php/pools": "0.8.*", diff --git a/composer.lock b/composer.lock index 5cd409fac6..83ebd15beb 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": "edbe5912c45e1f467f398541a75a77de", + "content-hash": "2a397a40480933a873d9d8bdca81c78d", "packages": [ { "name": "adhocore/jwt", @@ -3993,16 +3993,16 @@ }, { "name": "utopia-php/migration", - "version": "0.11.2", + "version": "dev-feat-csv-allow-internals", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "00f2b8e9927883f611e4e1ff179fa79e6bb2a12a" + "reference": "b4a33e84feec22f44e0181d32a7af10a199a82bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/00f2b8e9927883f611e4e1ff179fa79e6bb2a12a", - "reference": "00f2b8e9927883f611e4e1ff179fa79e6bb2a12a", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/b4a33e84feec22f44e0181d32a7af10a199a82bf", + "reference": "b4a33e84feec22f44e0181d32a7af10a199a82bf", "shasum": "" }, "require": { @@ -4043,9 +4043,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.11.2" + "source": "https://github.com/utopia-php/migration/tree/feat-csv-allow-internals" }, - "time": "2025-07-29T04:27:20+00:00" + "time": "2025-07-30T04:29:20+00:00" }, { "name": "utopia-php/orchestration", @@ -8237,9 +8237,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/migration", + "version": "dev-feat-csv-allow-internals", + "alias": "0.11.2", + "alias_normalized": "0.11.2.0" + } + ], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "utopia-php/migration": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index fd05019b80..124f7d1a37 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -992,6 +992,7 @@ trait MigrationsBase 'missing-row' => $bucketOneId, 'missing-column' => $bucketOneId, 'irrelevant-column' => $bucketOneId, + 'documents-internals' => $bucketOneId, ]; $fileIds = []; @@ -1000,7 +1001,8 @@ trait MigrationsBase $csvFileName = match ($label) { 'missing-row', 'missing-column', - 'irrelevant-column' => "{$label}.csv", + 'irrelevant-column', + 'documents-internals' => "{$label}.csv", default => 'documents.csv', }; @@ -1139,6 +1141,33 @@ trait MigrationsBase $this->assertEquals(100, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); }, 60_000, 500); + // all data exists and includes internals, pass. + $migration = $this->performCsvMigration( + [ + 'endpoint' => 'http://localhost/v1', + 'fileId' => $fileIds['documents-internals'], + 'bucketId' => $bucketIds['documents-internals'], + 'resourceId' => $databaseId . ':' . $collectionId, + ] + ); + + $this->assertEventually(function () use ($migration, $databaseId, $collectionId) { + $migrationId = $migration['body']['$id']; + $migration = $this->client->call(Client::METHOD_GET, '/migrations/'.$migrationId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $migration['headers']['status-code']); + $this->assertEquals('finished', $migration['body']['stage']); + $this->assertEquals('completed', $migration['body']['status']); + $this->assertEquals('CSV', $migration['body']['source']); + $this->assertEquals('Appwrite', $migration['body']['destination']); + $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); + $this->assertEquals(25, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); + }, 60_000, 500); + return [ 'databaseId' => $databaseId, 'collectionId' => $collectionId, diff --git a/tests/resources/csv/documents-internals.csv b/tests/resources/csv/documents-internals.csv new file mode 100644 index 0000000000..c72df314b7 --- /dev/null +++ b/tests/resources/csv/documents-internals.csv @@ -0,0 +1,26 @@ +$id,$createdAt,$updatedAt,name,age +z1y2x3w4v5u6t7s8,2022-10-23T10:33:01+00:00,2023-03-15T12:00:41+00:00,Diamond Mendez,56 +r9q0p1o2n3m4l5k6,2021-08-11T21:05:13+00:00,2024-01-02T08:45:22+00:00,Michael Huff,20 +j7i8h9g0f1e2d3c4,2020-05-29T14:22:56+00:00,2022-11-30T18:19:33+00:00,Alyssa Rodriguez,37 +b5a6z7y8x9w0v1u2,2023-01-18T03:44:09+00:00,2023-09-07T23:50:17+00:00,Barbara Smith,26 +t3s4r5q6p7o8n9m0,2020-11-02T09:12:45+00:00,2021-07-21T15:30:55+00:00,Evelyn Edwards,54 +l1k2j3i4h5g6f7e8,2022-03-19T19:55:27+00:00,2024-05-14T06:28:11+00:00,Tina Richardson,41 +d9c0b1a2z3y4x5w6,2021-04-07T01:18:34+00:00,2023-06-25T11:47:04+00:00,Joel Hernandez,49 +v7u8t9s0r1q2p3o4,2023-08-22T16:40:18+00:00,2024-02-19T04:09:58+00:00,Zachary Cooper,59 +n5m6l7k8j9i0h1g2,2020-02-12T07:59:01+00:00,2022-09-08T13:21:49+00:00,Brittany Spears,20 +f3e4d5c6b7a8z9y0,2021-12-05T22:33:12+00:00,2023-11-11T02:55:37+00:00,Holly White,47 +x1w2v3u4t5s6r7q8,2022-07-14T05:01:50+00:00,2024-04-01T20:10:26+00:00,Kimberly Barnes,27 +p9o0n1m2l3k4j5i6,2020-09-28T11:27:36+00:00,2021-10-17T09:38:08+00:00,Stephen Miller,53 +h7g8f9e0d1c2b3a4,2023-04-04T08:15:59+00:00,2024-06-29T17:03:14+00:00,Yvonne Newman,41 +y5x6w7v8u9t0s1r2,2021-01-25T18:09:21+00:00,2022-08-16T22:44:51+00:00,Carol Kane,38 +q3p4o5n6m7l8k9j0,2022-06-09T12:53:47+00:00,2023-12-24T01:16:05+00:00,Doris Foster,44 +i1h2g3f4e5d6c7b8,2020-07-03T23:37:02+00:00,2021-05-09T05:52:43+00:00,Joseph Stokes,28 +a9z0y1x2w3v4u5t6,2023-10-10T02:20:15+00:00,2024-03-28T14:33:29+00:00,Steve Williams,31 +s7r8q9p0o1n2m3l4,2021-06-16T13:48:53+00:00,2022-04-22T07:07:19+00:00,James Carey,29 +k5j6i7h8g9f0e1d2,2022-12-27T20:06:38+00:00,2023-08-03T10:25:57+00:00,Kathryn Henry,38 +c3b4a5z6y7x8w9v0,2020-04-20T04:41:24+00:00,2021-02-13T19:14:06+00:00,Christopher Landry,23 +u1t2s3r4q5p6o7n8,2023-05-08T00:58:10+00:00,2024-07-05T03:36:48+00:00,Jennifer Mcgee,62 +m9l0k1j2i3h4g5f6,2021-09-01T06:11:42+00:00,2022-01-26T16:59:23+00:00,Cathy Church,35 +e7d8c9b0a1z2y3x4,2022-02-18T15:24:07+00:00,2023-04-12T00:40:31+00:00,Jose Lopez,41 +w5v6u7t8s9r0q1p2,2020-12-13T09:03:55+00:00,2021-11-06T11:23:16+00:00,William Rose,30 +o3n4m5l6k7j8i9h0,2021-12-13T09:03:55+00:00,2022-11-06T11:23:16+00:00,Charles Hammer,61 From 7ffa11c75d570e6689fc1247e09d1639589bd4aa Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 30 Jul 2025 13:22:22 +0530 Subject: [PATCH 13/28] chore: remove console sdk from platforms --- app/config/platforms.php | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index ae09c39cac..f02a2c7035 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -196,24 +196,6 @@ return [ 'enabled' => false, 'beta' => false, 'sdks' => [ - [ - 'key' => 'web', - 'name' => 'Console', - 'version' => '1.9.0', - 'url' => 'https://github.com/appwrite/sdk-for-console', - 'package' => '', - 'enabled' => true, - 'beta' => false, - 'dev' => false, - 'hidden' => true, - 'family' => APP_PLATFORM_CONSOLE, - 'prism' => 'javascript', - 'source' => \realpath(__DIR__ . '/../sdks/console-web'), - 'gitUrl' => 'git@github.com:appwrite/sdk-for-console.git', - 'gitBranch' => 'dev', - 'gitRepoName' => 'sdk-for-console', - 'gitUserName' => 'appwrite', - ], [ 'key' => 'cli', 'name' => 'Command Line', From 5977e62e9af3f93e8091599453c1762ed9519859 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 30 Jul 2025 13:32:56 +0530 Subject: [PATCH 14/28] chore: move changelog path to platforms config --- app/config/platforms.php | 20 ++++++++++++++++++++ src/Appwrite/Platform/Tasks/SDKs.php | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index f02a2c7035..557342486b 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -25,6 +25,7 @@ return [ 'gitRepoName' => 'sdk-for-web', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/web/CHANGELOG.md'), 'demos' => [ [ 'icon' => 'react.svg', @@ -73,6 +74,7 @@ return [ 'gitRepoName' => 'sdk-for-flutter', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/flutter/CHANGELOG.md'), ], [ 'key' => 'apple', @@ -91,6 +93,7 @@ return [ 'gitRepoName' => 'sdk-for-apple', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/apple/CHANGELOG.md'), ], [ 'key' => 'objective-c', @@ -108,6 +111,7 @@ return [ 'gitRepoName' => 'sdk-for-objective-c', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/objective-c/CHANGELOG.md'), ], [ 'key' => 'android', @@ -130,6 +134,7 @@ return [ 'Kotlin' => 'kotlin', 'Java' => 'java', ], + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/android/CHANGELOG.md'), ], [ 'key' => 'react-native', @@ -148,6 +153,7 @@ return [ 'gitRepoName' => 'sdk-for-react-native', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/react-native/CHANGELOG.md'), ], [ 'key' => 'graphql', @@ -167,6 +173,7 @@ return [ 'gitUserName' => '', 'gitBranch' => '', 'isSDK' => false, + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/graphql/CHANGELOG.md'), ], [ 'key' => 'rest', @@ -186,6 +193,7 @@ return [ 'gitUserName' => '', 'gitBranch' => '', 'isSDK' => false, + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/rest/CHANGELOG.md'), ], ], ], @@ -247,6 +255,7 @@ return [ 'gitRepoName' => 'sdk-for-node', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/nodejs/CHANGELOG.md'), ], [ 'key' => 'deno', @@ -265,6 +274,7 @@ return [ 'gitRepoName' => 'sdk-for-deno', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/deno/CHANGELOG.md'), ], [ 'key' => 'php', @@ -283,6 +293,7 @@ return [ 'gitRepoName' => 'sdk-for-php', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/php/CHANGELOG.md'), ], [ 'key' => 'python', @@ -301,6 +312,7 @@ return [ 'gitRepoName' => 'sdk-for-python', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/python/CHANGELOG.md'), ], [ 'key' => 'ruby', @@ -319,6 +331,7 @@ return [ 'gitRepoName' => 'sdk-for-ruby', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/ruby/CHANGELOG.md'), ], [ 'key' => 'go', @@ -337,6 +350,7 @@ return [ 'gitRepoName' => 'sdk-for-go', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/go/CHANGELOG.md'), ], [ 'key' => 'dotnet', @@ -355,6 +369,7 @@ return [ 'gitRepoName' => 'sdk-for-dotnet', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/dotnet/CHANGELOG.md'), ], [ 'key' => 'dart', @@ -373,6 +388,7 @@ return [ 'gitRepoName' => 'sdk-for-dart', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/dart/CHANGELOG.md'), ], [ 'key' => 'kotlin', @@ -395,6 +411,7 @@ return [ 'Kotlin' => 'kotlin', 'Java' => 'java', ], + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/kotlin/CHANGELOG.md'), ], [ 'key' => 'swift', @@ -413,6 +430,7 @@ return [ 'gitRepoName' => 'sdk-for-swift', 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/swift/CHANGELOG.md'), ], [ 'key' => 'graphql', @@ -432,6 +450,7 @@ return [ 'gitUserName' => '', 'gitBranch' => '', 'isSDK' => false, + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/graphql/CHANGELOG.md'), ], [ 'key' => 'rest', @@ -451,6 +470,7 @@ return [ 'gitUserName' => '', 'gitBranch' => '', 'isSDK' => false, + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/rest/CHANGELOG.md'), ], ], ], diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 98a1ae6a10..c6f4e92186 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -98,7 +98,7 @@ class SDKs extends Action $gettingStarted = ($gettingStarted) ? \file_get_contents($gettingStarted) : ''; $examples = \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/EXAMPLES.md'); $examples = ($examples) ? \file_get_contents($examples) : ''; - $changelog = \realpath(__DIR__ . '/../../../../docs/sdks/' . $language['key'] . '/CHANGELOG.md'); + $changelog = $language['changelog'] ?? ''; $changelog = ($changelog) ? \file_get_contents($changelog) : '# Change Log'; $warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check [previous releases](' . $language['url'] . '/releases).**'; $license = 'BSD-3-Clause'; From d2dcddaf13d50ba4401f020cdcdeb30b33bb95da Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 30 Jul 2025 13:52:37 +0530 Subject: [PATCH 15/28] chore: add console back --- app/config/platforms.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/config/platforms.php b/app/config/platforms.php index 557342486b..814c07a30c 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -204,6 +204,25 @@ return [ 'enabled' => false, 'beta' => false, 'sdks' => [ + [ + 'key' => 'web', + 'name' => 'Console', + 'version' => '', + 'url' => '', + 'package' => '', + 'enabled' => true, + 'beta' => false, + 'dev' => false, + 'hidden' => true, + 'family' => APP_PLATFORM_CONSOLE, + 'prism' => 'javascript', + 'source' => \realpath(__DIR__ . '/../sdks/console-web'), + 'gitUrl' => '', + 'gitBranch' => 'dev', + 'gitRepoName' => '', + 'gitUserName' => '', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/console/CHANGELOG.md'), + ], [ 'key' => 'cli', 'name' => 'Command Line', @@ -222,6 +241,7 @@ return [ 'gitUserName' => 'appwrite', 'gitBranch' => 'dev', 'repoBranch' => 'master', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/cli/CHANGELOG.md'), 'exclude' => [ 'services' => [ ['name' => 'assistant'], From a21e37b054ab948efcd84b019988703f4e5f29cb Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 30 Jul 2025 23:42:01 +1200 Subject: [PATCH 16/28] Add permissions support for CSV --- composer.json | 2 +- composer.lock | 39 ++++++-------- .../Services/Migrations/MigrationsBase.php | 4 +- tests/resources/csv/documents-internals.csv | 52 +++++++++---------- 4 files changed, 44 insertions(+), 53 deletions(-) diff --git a/composer.json b/composer.json index f9e22b5557..31a31af9f2 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,7 @@ "utopia-php/locale": "0.4.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.18.*", - "utopia-php/migration": "dev-feat-csv-allow-internals as 0.11.2", + "utopia-php/migration": "0.11.*", "utopia-php/orchestration": "0.9.*", "utopia-php/platform": "0.7.*", "utopia-php/pools": "0.8.*", diff --git a/composer.lock b/composer.lock index 83ebd15beb..0089132a38 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": "2a397a40480933a873d9d8bdca81c78d", + "content-hash": "edbe5912c45e1f467f398541a75a77de", "packages": [ { "name": "adhocore/jwt", @@ -3993,16 +3993,16 @@ }, { "name": "utopia-php/migration", - "version": "dev-feat-csv-allow-internals", + "version": "0.11.3", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "b4a33e84feec22f44e0181d32a7af10a199a82bf" + "reference": "8142d722d8eeec443e6d5df91b69ecf89b86df8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/b4a33e84feec22f44e0181d32a7af10a199a82bf", - "reference": "b4a33e84feec22f44e0181d32a7af10a199a82bf", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/8142d722d8eeec443e6d5df91b69ecf89b86df8e", + "reference": "8142d722d8eeec443e6d5df91b69ecf89b86df8e", "shasum": "" }, "require": { @@ -4043,9 +4043,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/feat-csv-allow-internals" + "source": "https://github.com/utopia-php/migration/tree/0.13.5" }, - "time": "2025-07-30T04:29:20+00:00" + "time": "2025-07-29T04:15:45+00:00" }, { "name": "utopia-php/orchestration", @@ -4810,16 +4810,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.41.24", + "version": "0.41.26", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "c9ebf8daa25332ca701515d42e8d0c4a7be6a489" + "reference": "5a13191a5a4bdec8fe1b1180ff67f75c4ff6ac0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/c9ebf8daa25332ca701515d42e8d0c4a7be6a489", - "reference": "c9ebf8daa25332ca701515d42e8d0c4a7be6a489", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/5a13191a5a4bdec8fe1b1180ff67f75c4ff6ac0b", + "reference": "5a13191a5a4bdec8fe1b1180ff67f75c4ff6ac0b", "shasum": "" }, "require": { @@ -4855,9 +4855,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.41.24" + "source": "https://github.com/appwrite/sdk-generator/tree/0.41.26" }, - "time": "2025-07-28T06:27:00+00:00" + "time": "2025-07-30T06:53:12+00:00" }, { "name": "doctrine/annotations", @@ -8237,18 +8237,9 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [ - { - "package": "utopia-php/migration", - "version": "dev-feat-csv-allow-internals", - "alias": "0.11.2", - "alias_normalized": "0.11.2.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/migration": 20 - }, + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 124f7d1a37..f20ed2beb6 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -1139,7 +1139,7 @@ trait MigrationsBase $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); $this->assertEquals(100, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); - }, 60_000, 500); + }, 10_000, 500); // all data exists and includes internals, pass. $migration = $this->performCsvMigration( @@ -1166,7 +1166,7 @@ trait MigrationsBase $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); $this->assertEquals(25, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); - }, 60_000, 500); + }, 10_000, 500); return [ 'databaseId' => $databaseId, diff --git a/tests/resources/csv/documents-internals.csv b/tests/resources/csv/documents-internals.csv index c72df314b7..22144ab0b8 100644 --- a/tests/resources/csv/documents-internals.csv +++ b/tests/resources/csv/documents-internals.csv @@ -1,26 +1,26 @@ -$id,$createdAt,$updatedAt,name,age -z1y2x3w4v5u6t7s8,2022-10-23T10:33:01+00:00,2023-03-15T12:00:41+00:00,Diamond Mendez,56 -r9q0p1o2n3m4l5k6,2021-08-11T21:05:13+00:00,2024-01-02T08:45:22+00:00,Michael Huff,20 -j7i8h9g0f1e2d3c4,2020-05-29T14:22:56+00:00,2022-11-30T18:19:33+00:00,Alyssa Rodriguez,37 -b5a6z7y8x9w0v1u2,2023-01-18T03:44:09+00:00,2023-09-07T23:50:17+00:00,Barbara Smith,26 -t3s4r5q6p7o8n9m0,2020-11-02T09:12:45+00:00,2021-07-21T15:30:55+00:00,Evelyn Edwards,54 -l1k2j3i4h5g6f7e8,2022-03-19T19:55:27+00:00,2024-05-14T06:28:11+00:00,Tina Richardson,41 -d9c0b1a2z3y4x5w6,2021-04-07T01:18:34+00:00,2023-06-25T11:47:04+00:00,Joel Hernandez,49 -v7u8t9s0r1q2p3o4,2023-08-22T16:40:18+00:00,2024-02-19T04:09:58+00:00,Zachary Cooper,59 -n5m6l7k8j9i0h1g2,2020-02-12T07:59:01+00:00,2022-09-08T13:21:49+00:00,Brittany Spears,20 -f3e4d5c6b7a8z9y0,2021-12-05T22:33:12+00:00,2023-11-11T02:55:37+00:00,Holly White,47 -x1w2v3u4t5s6r7q8,2022-07-14T05:01:50+00:00,2024-04-01T20:10:26+00:00,Kimberly Barnes,27 -p9o0n1m2l3k4j5i6,2020-09-28T11:27:36+00:00,2021-10-17T09:38:08+00:00,Stephen Miller,53 -h7g8f9e0d1c2b3a4,2023-04-04T08:15:59+00:00,2024-06-29T17:03:14+00:00,Yvonne Newman,41 -y5x6w7v8u9t0s1r2,2021-01-25T18:09:21+00:00,2022-08-16T22:44:51+00:00,Carol Kane,38 -q3p4o5n6m7l8k9j0,2022-06-09T12:53:47+00:00,2023-12-24T01:16:05+00:00,Doris Foster,44 -i1h2g3f4e5d6c7b8,2020-07-03T23:37:02+00:00,2021-05-09T05:52:43+00:00,Joseph Stokes,28 -a9z0y1x2w3v4u5t6,2023-10-10T02:20:15+00:00,2024-03-28T14:33:29+00:00,Steve Williams,31 -s7r8q9p0o1n2m3l4,2021-06-16T13:48:53+00:00,2022-04-22T07:07:19+00:00,James Carey,29 -k5j6i7h8g9f0e1d2,2022-12-27T20:06:38+00:00,2023-08-03T10:25:57+00:00,Kathryn Henry,38 -c3b4a5z6y7x8w9v0,2020-04-20T04:41:24+00:00,2021-02-13T19:14:06+00:00,Christopher Landry,23 -u1t2s3r4q5p6o7n8,2023-05-08T00:58:10+00:00,2024-07-05T03:36:48+00:00,Jennifer Mcgee,62 -m9l0k1j2i3h4g5f6,2021-09-01T06:11:42+00:00,2022-01-26T16:59:23+00:00,Cathy Church,35 -e7d8c9b0a1z2y3x4,2022-02-18T15:24:07+00:00,2023-04-12T00:40:31+00:00,Jose Lopez,41 -w5v6u7t8s9r0q1p2,2020-12-13T09:03:55+00:00,2021-11-06T11:23:16+00:00,William Rose,30 -o3n4m5l6k7j8i9h0,2021-12-13T09:03:55+00:00,2022-11-06T11:23:16+00:00,Charles Hammer,61 +$id,$createdAt,$updatedAt,$permissions,name,age +z1y2x3w4v5u6t7s8,2022-10-23T10:33:01+00:00,2023-03-15T12:00:41+00:00,"read(\"any\"),update(\"user:123\")",Diamond Mendez,56 +r9q0p1o2n3m4l5k6,2021-08-11T21:05:13+00:00,2024-01-02T08:45:22+00:00,"read(\"any\"),update(\"user:456\")",Michael Huff,20 +j7i8h9g0f1e2d3c4,2020-05-29T14:22:56+00:00,2022-11-30T18:19:33+00:00,"read(\"any\")",Alyssa Rodriguez,37 +b5a6z7y8x9w0v1u2,2023-01-18T03:44:09+00:00,2023-09-07T23:50:17+00:00,"read(\"any\")",Barbara Smith,26 +t3s4r5q6p7o8n9m0,2020-11-02T09:12:45+00:00,2021-07-21T15:30:55+00:00,"read(\"any\")",Evelyn Edwards,54 +l1k2j3i4h5g6f7e8,2022-03-19T19:55:27+00:00,2024-05-14T06:28:11+00:00,"read(\"any\")",Tina Richardson,41 +d9c0b1a2z3y4x5w6,2021-04-07T01:18:34+00:00,2023-06-25T11:47:04+00:00,"read(\"any\")",Joel Hernandez,49 +v7u8t9s0r1q2p3o4,2023-08-22T16:40:18+00:00,2024-02-19T04:09:58+00:00,"read(\"any\")",Zachary Cooper,59 +n5m6l7k8j9i0h1g2,2020-02-12T07:59:01+00:00,2022-09-08T13:21:49+00:00,"read(\"any\")",Brittany Spears,20 +f3e4d5c6b7a8z9y0,2021-12-05T22:33:12+00:00,2023-11-11T02:55:37+00:00,"read(\"any\")",Holly White,47 +x1w2v3u4t5s6r7q8,2022-07-14T05:01:50+00:00,2024-04-01T20:10:26+00:00,"read(\"any\")",Kimberly Barnes,27 +p9o0n1m2l3k4j5i6,2020-09-28T11:27:36+00:00,2021-10-17T09:38:08+00:00,"read(\"any\")",Stephen Miller,53 +h7g8f9e0d1c2b3a4,2023-04-04T08:15:59+00:00,2024-06-29T17:03:14+00:00,"read(\"any\")",Yvonne Newman,41 +y5x6w7v8u9t0s1r2,2021-01-25T18:09:21+00:00,2022-08-16T22:44:51+00:00,"read(\"any\")",Carol Kane,38 +q3p4o5n6m7l8k9j0,2022-06-09T12:53:47+00:00,2023-12-24T01:16:05+00:00,"read(\"any\")",Doris Foster,44 +i1h2g3f4e5d6c7b8,2020-07-03T23:37:02+00:00,2021-05-09T05:52:43+00:00,"read(\"any\")",Joseph Stokes,28 +a9z0y1x2w3v4u5t6,2023-10-10T02:20:15+00:00,2024-03-28T14:33:29+00:00,"read(\"any\")",Steve Williams,31 +s7r8q9p0o1n2m3l4,2021-06-16T13:48:53+00:00,2022-04-22T07:07:19+00:00,"read(\"any\")",James Carey,29 +k5j6i7h8g9f0e1d2,2022-12-27T20:06:38+00:00,2023-08-03T10:25:57+00:00,"read(\"any\")",Kathryn Henry,38 +c3b4a5z6y7x8w9v0,2020-04-20T04:41:24+00:00,2021-02-13T19:14:06+00:00,"read(\"any\")",Christopher Landry,23 +u1t2s3r4q5p6o7n8,2023-05-08T00:58:10+00:00,2024-07-05T03:36:48+00:00,"read(\"any\")",Jennifer Mcgee,62 +m9l0k1j2i3h4g5f6,2021-09-01T06:11:42+00:00,2022-01-26T16:59:23+00:00,"read(\"any\")",Cathy Church,35 +e7d8c9b0a1z2y3x4,2022-02-18T15:24:07+00:00,2023-04-12T00:40:31+00:00,"read(\"any\")",Jose Lopez,41 +w5v6u7t8s9r0q1p2,2020-12-13T09:03:55+00:00,2021-11-06T11:23:16+00:00,"read(\"any\")",William Rose,30 +o3n4m5l6k7j8i9h0,2021-12-13T09:03:55+00:00,2022-11-06T11:23:16+00:00,"read(\"any\")",Charles Hammer,61 From 152882d05d4fd70d2d34e2c01e36f49ebe5c2a3e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 30 Jul 2025 23:59:30 +1200 Subject: [PATCH 17/28] Fix ref --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 0089132a38..9b51b272b3 100644 --- a/composer.lock +++ b/composer.lock @@ -3997,12 +3997,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "8142d722d8eeec443e6d5df91b69ecf89b86df8e" + "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/8142d722d8eeec443e6d5df91b69ecf89b86df8e", - "reference": "8142d722d8eeec443e6d5df91b69ecf89b86df8e", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/fb14e0e35061bfec2656200e3d02a3bdf569a0ac", + "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac", "shasum": "" }, "require": { @@ -4043,9 +4043,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.13.5" + "source": "https://github.com/utopia-php/migration/tree/0.11.3" }, - "time": "2025-07-29T04:15:45+00:00" + "time": "2025-07-30T11:20:31+00:00" }, { "name": "utopia-php/orchestration", From efc21d3dcfbfec578bc359d170ea33afc42faa67 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 31 Jul 2025 00:12:59 +1200 Subject: [PATCH 18/28] Fix tests --- .../Services/Migrations/MigrationsBase.php | 66 +++++-------------- 1 file changed, 15 insertions(+), 51 deletions(-) diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index f20ed2beb6..7bcd99885b 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -1141,6 +1141,21 @@ trait MigrationsBase $this->assertEquals(100, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); }, 10_000, 500); + // get documents count + $documents = $this->client->call(Client::METHOD_GET, '/databases/'.$databaseId.'/collections/'.$collectionId.'/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::limit(150)->toString() + ] + ]); + + $this->assertEquals(200, $documents['headers']['status-code']); + $this->assertIsArray($documents['body']['documents']); + $this->assertIsNumeric($documents['body']['total']); + $this->assertEquals(100, $documents['body']['total']); + // all data exists and includes internals, pass. $migration = $this->performCsvMigration( [ @@ -1167,57 +1182,6 @@ trait MigrationsBase $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); $this->assertEquals(25, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); }, 10_000, 500); - - return [ - 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'migrationId' => $migration['body']['$id'], - ]; - } - - /** - * @depends testCreateCsvMigration - */ - public function testImportSuccessful(array $response): void - { - $databaseId = $response['databaseId']; - $collectionId = $response['collectionId']; - $migrationId = $response['migrationId']; - - $documentsCountInCSV = 100; - - // get migration stats - $this->assertEventually(function () use ($migrationId, $databaseId, $collectionId, $documentsCountInCSV) { - $migration = $this->client->call(Client::METHOD_GET, '/migrations/'.$migrationId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals(200, $migration['headers']['status-code']); - $this->assertEquals('finished', $migration['body']['stage']); - $this->assertEquals('completed', $migration['body']['status']); - $this->assertEquals('CSV', $migration['body']['source']); - $this->assertEquals('Appwrite', $migration['body']['destination']); - $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); - $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); - $this->assertEquals($documentsCountInCSV, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); - }, 60000, 500); - - // get documents count - $documents = $this->client->call(Client::METHOD_GET, '/databases/'.$databaseId.'/collections/'.$collectionId.'/documents', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => [ - // there should be only 100! - Query::limit(150)->toString() - ] - ]); - - $this->assertEquals(200, $documents['headers']['status-code']); - $this->assertIsArray($documents['body']['documents']); - $this->assertIsNumeric($documents['body']['total']); - $this->assertEquals($documentsCountInCSV, $documents['body']['total']); } private function performCsvMigration(array $body): array From 1ea9aca90f6de7480d780a40dcdb9db9b29325c6 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 31 Jul 2025 02:10:29 +1200 Subject: [PATCH 19/28] Fix test --- tests/e2e/Services/Migrations/MigrationsBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 7bcd99885b..5f40662ec3 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -901,7 +901,7 @@ trait MigrationsBase /** * Import documents from a CSV file. */ - public function testCreateCsvMigration(): array + public function testCreateCsvMigration(): void { // Make a database $response = $this->client->call(Client::METHOD_POST, '/databases', [ From 5c0579fbc7b0561348f00baee0efa86f2a2c27ee Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 31 Jul 2025 13:50:34 +0530 Subject: [PATCH 20/28] feat: telemetry for cache hits and misses --- app/controllers/shared/api.php | 7 ++++++- app/init/resources.php | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 86fb1e5822..ca7fc4e6ec 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -31,6 +31,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Queue\Publisher; use Utopia\System\System; +use Utopia\Telemetry\Counter; use Utopia\Validator\WhiteList; $parseLabel = function (string $label, array $responsePayload, array $requestParams, Document $user) { @@ -421,7 +422,9 @@ App::init() ->inject('apiKey') ->inject('plan') ->inject('devKey') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey) use ($usageDatabaseListener, $eventDatabaseListener) { + ->inject('cacheHitsCounter') + ->inject('cacheMissesCounter') + ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Counter $cacheHitsCounter, Counter $cacheMissesCounter) use ($usageDatabaseListener, $eventDatabaseListener) { $route = $utopia->getRoute(); @@ -619,10 +622,12 @@ App::init() ->addHeader('Cache-Control', sprintf('private, max-age=%d', $timestamp)) ->addHeader('X-Appwrite-Cache', 'hit') ->setContentType($cacheLog->getAttribute('mimeType')); + $cacheHitsCounter->add(1); if (!$isImageTransformation || !$isDisabled) { $response->send($data); } } else { + $cacheMissesCounter->add(1); $response ->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate') ->addHeader('Pragma', 'no-cache') diff --git a/app/init/resources.php b/app/init/resources.php index 162eab1973..5aa8727e44 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -1009,3 +1009,19 @@ App::setResource('httpReferrerSafe', function (Request $request, string $httpRef $referrer = (!empty($protocol) ? $protocol : $request->getProtocol()) . '://' . $origin . (!empty($port) ? ':' . $port : ''); return $referrer; }, ['request', 'httpReferrer', 'platforms', 'dbForPlatform', 'project', 'utopia']); + +App::setResource('cacheHitsCounter', function (Telemetry $telemetry) { + return $telemetry->createCounter( + 'cache_hits_total', + 'hits', + 'Total number of cache hits' + ); +}, ['telemetry']); + +App::setResource('cacheMissesCounter', function (Telemetry $telemetry) { + return $telemetry->createCounter( + 'cache_misses_total', + 'misses', + 'Total number of cache misses' + ); +}, ['telemetry']); From d1c3a84ba160df49552c509a60bff98effdb229d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 31 Jul 2025 16:40:40 +0530 Subject: [PATCH 21/28] chore: update to use gauge --- app/controllers/shared/api.php | 14 ++++++++------ app/init/resources.php | 16 ++++------------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index ca7fc4e6ec..e1641040c8 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -31,7 +31,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Queue\Publisher; use Utopia\System\System; -use Utopia\Telemetry\Counter; +use Utopia\Telemetry\Gauge; use Utopia\Validator\WhiteList; $parseLabel = function (string $label, array $responsePayload, array $requestParams, Document $user) { @@ -422,9 +422,9 @@ App::init() ->inject('apiKey') ->inject('plan') ->inject('devKey') - ->inject('cacheHitsCounter') - ->inject('cacheMissesCounter') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Counter $cacheHitsCounter, Counter $cacheMissesCounter) use ($usageDatabaseListener, $eventDatabaseListener) { + ->inject('cacheHitsGauge') + ->inject('cacheMissesGauge') + ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Gauge $cacheHitsCounter, Gauge $cacheMissesCounter) use ($usageDatabaseListener, $eventDatabaseListener) { $route = $utopia->getRoute(); @@ -622,12 +622,14 @@ App::init() ->addHeader('Cache-Control', sprintf('private, max-age=%d', $timestamp)) ->addHeader('X-Appwrite-Cache', 'hit') ->setContentType($cacheLog->getAttribute('mimeType')); - $cacheHitsCounter->add(1); + $cacheHitsCounter->record(1, [ + 'resourceType' => $type, + ]); if (!$isImageTransformation || !$isDisabled) { $response->send($data); } } else { - $cacheMissesCounter->add(1); + $cacheMissesCounter->record(1); $response ->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate') ->addHeader('Pragma', 'no-cache') diff --git a/app/init/resources.php b/app/init/resources.php index 5aa8727e44..c68a8d389d 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -1010,18 +1010,10 @@ App::setResource('httpReferrerSafe', function (Request $request, string $httpRef return $referrer; }, ['request', 'httpReferrer', 'platforms', 'dbForPlatform', 'project', 'utopia']); -App::setResource('cacheHitsCounter', function (Telemetry $telemetry) { - return $telemetry->createCounter( - 'cache_hits_total', - 'hits', - 'Total number of cache hits' - ); +App::setResource('cacheHitsGauge', function (Telemetry $telemetry) { + return $telemetry->createGauge('cache.hits.total'); }, ['telemetry']); -App::setResource('cacheMissesCounter', function (Telemetry $telemetry) { - return $telemetry->createCounter( - 'cache_misses_total', - 'misses', - 'Total number of cache misses' - ); +App::setResource('cacheMissesGauge', function (Telemetry $telemetry) { + return $telemetry->createGauge('cache.misses.total'); }, ['telemetry']); From da1fa09e9ce14b0c8568fb2a274b69c7af5031b0 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 31 Jul 2025 17:06:29 +0530 Subject: [PATCH 22/28] chore: update name --- app/controllers/shared/api.php | 10 +++++----- app/init/resources.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index e1641040c8..a37d921d40 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -422,9 +422,9 @@ App::init() ->inject('apiKey') ->inject('plan') ->inject('devKey') - ->inject('cacheHitsGauge') - ->inject('cacheMissesGauge') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Gauge $cacheHitsCounter, Gauge $cacheMissesCounter) use ($usageDatabaseListener, $eventDatabaseListener) { + ->inject('storageCacheHitsGauge') + ->inject('storageCacheMissesGauge') + ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Gauge $storageCacheHitsCounter, Gauge $storageCacheMissesCounter) use ($usageDatabaseListener, $eventDatabaseListener) { $route = $utopia->getRoute(); @@ -622,14 +622,14 @@ App::init() ->addHeader('Cache-Control', sprintf('private, max-age=%d', $timestamp)) ->addHeader('X-Appwrite-Cache', 'hit') ->setContentType($cacheLog->getAttribute('mimeType')); - $cacheHitsCounter->record(1, [ + $storageCacheHitsCounter->record(1, [ 'resourceType' => $type, ]); if (!$isImageTransformation || !$isDisabled) { $response->send($data); } } else { - $cacheMissesCounter->record(1); + $storageCacheMissesCounter->record(1); $response ->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate') ->addHeader('Pragma', 'no-cache') diff --git a/app/init/resources.php b/app/init/resources.php index c68a8d389d..a01fd0e13e 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -1010,10 +1010,10 @@ App::setResource('httpReferrerSafe', function (Request $request, string $httpRef return $referrer; }, ['request', 'httpReferrer', 'platforms', 'dbForPlatform', 'project', 'utopia']); -App::setResource('cacheHitsGauge', function (Telemetry $telemetry) { - return $telemetry->createGauge('cache.hits.total'); +App::setResource('storageCacheHitsGauge', function (Telemetry $telemetry) { + return $telemetry->createGauge('storage.cache.hits'); }, ['telemetry']); -App::setResource('cacheMissesGauge', function (Telemetry $telemetry) { - return $telemetry->createGauge('cache.misses.total'); +App::setResource('storageCacheMissesGauge', function (Telemetry $telemetry) { + return $telemetry->createGauge('storage.cache.misses'); }, ['telemetry']); From 588087eda6d0487d995e9b565db1248085997f99 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 31 Jul 2025 17:17:15 +0530 Subject: [PATCH 23/28] chore: add total --- app/init/resources.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/init/resources.php b/app/init/resources.php index a01fd0e13e..6ab44e255e 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -1011,9 +1011,9 @@ App::setResource('httpReferrerSafe', function (Request $request, string $httpRef }, ['request', 'httpReferrer', 'platforms', 'dbForPlatform', 'project', 'utopia']); App::setResource('storageCacheHitsGauge', function (Telemetry $telemetry) { - return $telemetry->createGauge('storage.cache.hits'); + return $telemetry->createGauge('storage.cache.hits.total'); }, ['telemetry']); App::setResource('storageCacheMissesGauge', function (Telemetry $telemetry) { - return $telemetry->createGauge('storage.cache.misses'); + return $telemetry->createGauge('storage.cache.misses.total'); }, ['telemetry']); From 81e656e42c81f18a67ec2ba4d54c6a8a91683dfe Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 31 Jul 2025 18:59:17 +0530 Subject: [PATCH 24/28] chore: update counter --- app/controllers/shared/api.php | 14 ++++++++------ app/init/resources.php | 8 ++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index a37d921d40..f627d0ddfe 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -31,7 +31,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Queue\Publisher; use Utopia\System\System; -use Utopia\Telemetry\Gauge; +use Utopia\Telemetry\Counter; use Utopia\Validator\WhiteList; $parseLabel = function (string $label, array $responsePayload, array $requestParams, Document $user) { @@ -422,9 +422,8 @@ App::init() ->inject('apiKey') ->inject('plan') ->inject('devKey') - ->inject('storageCacheHitsGauge') - ->inject('storageCacheMissesGauge') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Gauge $storageCacheHitsCounter, Gauge $storageCacheMissesCounter) use ($usageDatabaseListener, $eventDatabaseListener) { + ->inject('storageCacheOperationsCounter') + ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Counter $storageCacheOperationsCounter) use ($usageDatabaseListener, $eventDatabaseListener) { $route = $utopia->getRoute(); @@ -622,14 +621,17 @@ App::init() ->addHeader('Cache-Control', sprintf('private, max-age=%d', $timestamp)) ->addHeader('X-Appwrite-Cache', 'hit') ->setContentType($cacheLog->getAttribute('mimeType')); - $storageCacheHitsCounter->record(1, [ + $storageCacheOperationsCounter->add(1, [ + 'result' => 'hit', 'resourceType' => $type, ]); if (!$isImageTransformation || !$isDisabled) { $response->send($data); } } else { - $storageCacheMissesCounter->record(1); + $storageCacheOperationsCounter->add(1, [ + 'result' => 'miss', + ]); $response ->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate') ->addHeader('Pragma', 'no-cache') diff --git a/app/init/resources.php b/app/init/resources.php index 6ab44e255e..ec62a6c0bb 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -1010,10 +1010,6 @@ App::setResource('httpReferrerSafe', function (Request $request, string $httpRef return $referrer; }, ['request', 'httpReferrer', 'platforms', 'dbForPlatform', 'project', 'utopia']); -App::setResource('storageCacheHitsGauge', function (Telemetry $telemetry) { - return $telemetry->createGauge('storage.cache.hits.total'); -}, ['telemetry']); - -App::setResource('storageCacheMissesGauge', function (Telemetry $telemetry) { - return $telemetry->createGauge('storage.cache.misses.total'); +App::setResource('storageCacheOperationsCounter', function (Telemetry $telemetry) { + return $telemetry->createCounter('storage.cache.operations.total'); }, ['telemetry']); From 5689fd6e7ea51db8edd095b9e0e3711035995707 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 1 Aug 2025 09:09:11 +0530 Subject: [PATCH 25/28] chore: update changelog and sdk gen --- app/config/platforms.php | 2 +- composer.lock | 108 +++++++++++++++++++++------------- docs/sdks/dotnet/CHANGELOG.md | 3 +- 3 files changed, 69 insertions(+), 44 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index 814c07a30c..525e278cd1 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -375,7 +375,7 @@ return [ [ 'key' => 'dotnet', 'name' => '.NET', - 'version' => '0.14.1', + 'version' => '0.15.0', 'url' => 'https://github.com/appwrite/sdk-for-dotnet', 'package' => 'https://www.nuget.org/packages/Appwrite', 'enabled' => true, diff --git a/composer.lock b/composer.lock index 9b51b272b3..da084c8fcd 100644 --- a/composer.lock +++ b/composer.lock @@ -2547,16 +2547,16 @@ }, { "name": "symfony/http-client", - "version": "v7.3.1", + "version": "v7.3.2", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "4403d87a2c16f33345dca93407a8714ee8c05a64" + "reference": "1c064a0c67749923483216b081066642751cc2c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/4403d87a2c16f33345dca93407a8714ee8c05a64", - "reference": "4403d87a2c16f33345dca93407a8714ee8c05a64", + "url": "https://api.github.com/repos/symfony/http-client/zipball/1c064a0c67749923483216b081066642751cc2c7", + "reference": "1c064a0c67749923483216b081066642751cc2c7", "shasum": "" }, "require": { @@ -2622,7 +2622,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.3.1" + "source": "https://github.com/symfony/http-client/tree/v7.3.2" }, "funding": [ { @@ -2633,12 +2633,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-06-28T07:58:39+00:00" + "time": "2025-07-15T11:36:08+00:00" }, { "name": "symfony/http-client-contracts", @@ -4810,16 +4814,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.41.26", + "version": "0.41.27", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "5a13191a5a4bdec8fe1b1180ff67f75c4ff6ac0b" + "reference": "083fd2e8163d6a4e59ee971ac6cb97277d831dd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/5a13191a5a4bdec8fe1b1180ff67f75c4ff6ac0b", - "reference": "5a13191a5a4bdec8fe1b1180ff67f75c4ff6ac0b", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/083fd2e8163d6a4e59ee971ac6cb97277d831dd5", + "reference": "083fd2e8163d6a4e59ee971ac6cb97277d831dd5", "shasum": "" }, "require": { @@ -4855,9 +4859,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.41.26" + "source": "https://github.com/appwrite/sdk-generator/tree/0.41.27" }, - "time": "2025-07-30T06:53:12+00:00" + "time": "2025-07-31T10:20:46+00:00" }, { "name": "doctrine/annotations", @@ -7258,16 +7262,16 @@ }, { "name": "symfony/console", - "version": "v7.3.1", + "version": "v7.3.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9e27aecde8f506ba0fd1d9989620c04a87697101" + "reference": "5f360ebc65c55265a74d23d7fe27f957870158a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9e27aecde8f506ba0fd1d9989620c04a87697101", - "reference": "9e27aecde8f506ba0fd1d9989620c04a87697101", + "url": "https://api.github.com/repos/symfony/console/zipball/5f360ebc65c55265a74d23d7fe27f957870158a1", + "reference": "5f360ebc65c55265a74d23d7fe27f957870158a1", "shasum": "" }, "require": { @@ -7332,7 +7336,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.3.1" + "source": "https://github.com/symfony/console/tree/v7.3.2" }, "funding": [ { @@ -7343,25 +7347,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-06-27T19:55:54+00:00" + "time": "2025-07-30T17:13:41+00:00" }, { "name": "symfony/filesystem", - "version": "v7.3.0", + "version": "v7.3.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb" + "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb", - "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/edcbb768a186b5c3f25d0643159a787d3e63b7fd", + "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd", "shasum": "" }, "require": { @@ -7398,7 +7406,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.3.0" + "source": "https://github.com/symfony/filesystem/tree/v7.3.2" }, "funding": [ { @@ -7409,25 +7417,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-10-25T15:15:23+00:00" + "time": "2025-07-07T08:17:47+00:00" }, { "name": "symfony/finder", - "version": "v7.3.0", + "version": "v7.3.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "ec2344cf77a48253bbca6939aa3d2477773ea63d" + "reference": "2a6614966ba1074fa93dae0bc804227422df4dfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ec2344cf77a48253bbca6939aa3d2477773ea63d", - "reference": "ec2344cf77a48253bbca6939aa3d2477773ea63d", + "url": "https://api.github.com/repos/symfony/finder/zipball/2a6614966ba1074fa93dae0bc804227422df4dfe", + "reference": "2a6614966ba1074fa93dae0bc804227422df4dfe", "shasum": "" }, "require": { @@ -7462,7 +7474,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.3.0" + "source": "https://github.com/symfony/finder/tree/v7.3.2" }, "funding": [ { @@ -7473,25 +7485,29 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-12-30T19:00:26+00:00" + "time": "2025-07-15T13:41:35+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.3.0", + "version": "v7.3.2", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "afb9a8038025e5dbc657378bfab9198d75f10fca" + "reference": "119bcf13e67dbd188e5dbc74228b1686f66acd37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/afb9a8038025e5dbc657378bfab9198d75f10fca", - "reference": "afb9a8038025e5dbc657378bfab9198d75f10fca", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/119bcf13e67dbd188e5dbc74228b1686f66acd37", + "reference": "119bcf13e67dbd188e5dbc74228b1686f66acd37", "shasum": "" }, "require": { @@ -7529,7 +7545,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.3.0" + "source": "https://github.com/symfony/options-resolver/tree/v7.3.2" }, "funding": [ { @@ -7540,12 +7556,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-04-04T13:12:05+00:00" + "time": "2025-07-15T11:36:08+00:00" }, { "name": "symfony/polyfill-ctype", @@ -7924,16 +7944,16 @@ }, { "name": "symfony/string", - "version": "v7.3.0", + "version": "v7.3.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125" + "reference": "42f505aff654e62ac7ac2ce21033818297ca89ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/f3570b8c61ca887a9e2938e85cb6458515d2b125", - "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125", + "url": "https://api.github.com/repos/symfony/string/zipball/42f505aff654e62ac7ac2ce21033818297ca89ca", + "reference": "42f505aff654e62ac7ac2ce21033818297ca89ca", "shasum": "" }, "require": { @@ -7991,7 +8011,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.3.0" + "source": "https://github.com/symfony/string/tree/v7.3.2" }, "funding": [ { @@ -8002,12 +8022,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-04-20T20:19:01+00:00" + "time": "2025-07-10T08:47:49+00:00" }, { "name": "textalk/websocket", diff --git a/docs/sdks/dotnet/CHANGELOG.md b/docs/sdks/dotnet/CHANGELOG.md index 935bd6c8de..bbfee108a7 100644 --- a/docs/sdks/dotnet/CHANGELOG.md +++ b/docs/sdks/dotnet/CHANGELOG.md @@ -1,10 +1,11 @@ # Change Log -## 0.14.1 +## 0.15.0 * Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service * Add `encrypt` support to `StringAttribute` model * Add `sequence` support to `Document` model +* Fix: pass enum value as string in API params ## 0.14.0 From 59bebe6be9bf673bd274a688cfc6882a720316b9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 1 Aug 2025 09:13:34 +0530 Subject: [PATCH 26/28] fix: 500 errors on robots and humans txt files --- 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 42e26b6fbe..c98d59d89a 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1380,7 +1380,7 @@ App::get('/robots.txt') ->inject('apiKey') ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey) { $host = $request->getHostname() ?? ''; - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); if (($host === $mainDomain || $host === 'localhost') && empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); @@ -1413,7 +1413,7 @@ App::get('/humans.txt') ->inject('apiKey') ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey) { $host = $request->getHostname() ?? ''; - $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); if (($host === $mainDomain || $host === 'localhost') && empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); From 471d261114103584dab983274c919336aa8faeac Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 1 Aug 2025 09:28:07 +0530 Subject: [PATCH 27/28] chore: fallback to main domain --- app/controllers/general.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index c98d59d89a..d5b0979441 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1380,9 +1380,10 @@ App::get('/robots.txt') ->inject('apiKey') ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey) { $host = $request->getHostname() ?? ''; - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $consoleDomain = System::getEnv('_APP_CONSOLE_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); - if (($host === $mainDomain || $host === 'localhost') && empty($previewHostname)) { + if (($host === $consoleDomain || $host === $mainDomain || $host === 'localhost') && empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { @@ -1413,9 +1414,10 @@ App::get('/humans.txt') ->inject('apiKey') ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey) { $host = $request->getHostname() ?? ''; - $mainDomain = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); + $consoleDomain = System::getEnv('_APP_CONSOLE_DOMAIN', ''); + $mainDomain = System::getEnv('_APP_DOMAIN', ''); - if (($host === $mainDomain || $host === 'localhost') && empty($previewHostname)) { + if (($host === $consoleDomain || $host === $mainDomain || $host === 'localhost') && empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { From 58d556aab52727650a4949802954771f21e6b0c2 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 1 Aug 2025 15:52:27 +0530 Subject: [PATCH 28/28] chore: update metric naming --- app/controllers/shared/api.php | 16 ++++++---------- app/init/resources.php | 4 ---- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index f627d0ddfe..2ef992764f 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -31,7 +31,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Queue\Publisher; use Utopia\System\System; -use Utopia\Telemetry\Counter; +use Utopia\Telemetry\Adapter as Telemetry; use Utopia\Validator\WhiteList; $parseLabel = function (string $label, array $responsePayload, array $requestParams, Document $user) { @@ -422,8 +422,8 @@ App::init() ->inject('apiKey') ->inject('plan') ->inject('devKey') - ->inject('storageCacheOperationsCounter') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Counter $storageCacheOperationsCounter) use ($usageDatabaseListener, $eventDatabaseListener) { + ->inject('telemetry') + ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Telemetry $telemetry) use ($usageDatabaseListener, $eventDatabaseListener) { $route = $utopia->getRoute(); @@ -556,6 +556,7 @@ App::init() )); $useCache = $route->getLabel('cache', false); + $storageCacheOperationsCounter = $telemetry->createCounter('storage.cache.operations.load'); if ($useCache) { $route = $utopia->match($request); $isImageTransformation = $route->getPath() === '/v1/storage/buckets/:bucketId/files/:fileId/preview'; @@ -621,17 +622,12 @@ App::init() ->addHeader('Cache-Control', sprintf('private, max-age=%d', $timestamp)) ->addHeader('X-Appwrite-Cache', 'hit') ->setContentType($cacheLog->getAttribute('mimeType')); - $storageCacheOperationsCounter->add(1, [ - 'result' => 'hit', - 'resourceType' => $type, - ]); + $storageCacheOperationsCounter->add(1, ['result' => 'hit']); if (!$isImageTransformation || !$isDisabled) { $response->send($data); } } else { - $storageCacheOperationsCounter->add(1, [ - 'result' => 'miss', - ]); + $storageCacheOperationsCounter->add(1, ['result' => 'miss']); $response ->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate') ->addHeader('Pragma', 'no-cache') diff --git a/app/init/resources.php b/app/init/resources.php index ec62a6c0bb..162eab1973 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -1009,7 +1009,3 @@ App::setResource('httpReferrerSafe', function (Request $request, string $httpRef $referrer = (!empty($protocol) ? $protocol : $request->getProtocol()) . '://' . $origin . (!empty($port) ? ':' . $port : ''); return $referrer; }, ['request', 'httpReferrer', 'platforms', 'dbForPlatform', 'project', 'utopia']); - -App::setResource('storageCacheOperationsCounter', function (Telemetry $telemetry) { - return $telemetry->createCounter('storage.cache.operations.total'); -}, ['telemetry']);