Compare commits

..
16 changed files with 629 additions and 435 deletions
+3 -3
View File
@@ -1038,7 +1038,7 @@ return [
'$id' => ID::custom('providerUid'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 2048, // Decrease to 128 as in index length?
'size' => 2048,
'signed' => true,
'required' => false,
'default' => null,
@@ -1107,14 +1107,14 @@ return [
'$id' => ID::custom('_key_userInternalId_provider_providerUid'),
'type' => Database::INDEX_UNIQUE,
'attributes' => ['userInternalId', 'provider', 'providerUid'],
'lengths' => [11, 128, 128], // providerUid is length 2000!
'lengths' => [11, 128, 128],
'orders' => [Database::ORDER_ASC, Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_provider_providerUid'),
'type' => Database::INDEX_UNIQUE,
'attributes' => ['provider', 'providerUid'],
'lengths' => [128, 128], // providerUid is length 2000!
'lengths' => [128, 128],
'orders' => [Database::ORDER_ASC, Database::ORDER_ASC],
],
[
+1 -4
View File
@@ -615,10 +615,7 @@ App::post('/v1/teams/:teamId/memberships')
$membership = ($isPrivilegedUser || $isAppUser) ?
Authorization::skip(fn () => $dbForProject->createDocument('memberships', $membership)) :
$dbForProject->createDocument('memberships', $membership);
if ($isPrivilegedUser || $isAppUser) {
Authorization::skip(fn () => $dbForProject->increaseDocumentAttribute('teams', $team->getId(), 'total', 1));
}
Authorization::skip(fn () => $dbForProject->increaseDocumentAttribute('teams', $team->getId(), 'total', 1));
} elseif ($membership->getAttribute('confirm') === false) {
$membership->setAttribute('secret', Auth::hash($secret));
+8 -6
View File
@@ -16,6 +16,8 @@ use Appwrite\Event\Migration;
use Appwrite\Event\Realtime;
use Appwrite\Event\StatsUsage;
use Appwrite\Event\StatsUsageDump;
/** remove */
/** /remove */
use Appwrite\Event\Webhook;
use Appwrite\Platform\Appwrite;
use Swoole\Runtime;
@@ -216,12 +218,12 @@ Server::setResource('abuseRetention', function () {
return time() - (int) System::getEnv('_APP_MAINTENANCE_RETENTION_ABUSE', 86400); // 1 day
});
Server::setResource('auditRetention', function (Document $project) {
if ($project->getId() === 'console') {
return DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT_CONSOLE', 15778800)); // 6 months
}
return DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT', 1209600)); // 14 days
}, ['project']);
Server::setResource('auditRetention', function () {
return [
'project' => DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT', 1209600)), // 14 days
'console' => DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT_CONSOLE', 15778800)) // 6 months
];
});
Server::setResource('executionRetention', function () {
return DateTime::addSeconds(new \DateTime(), -1 * System::getEnv('_APP_MAINTENANCE_RETENTION_EXECUTION', 1209600)); // 14 days
+3 -3
View File
@@ -51,11 +51,11 @@
"utopia-php/cache": "0.12.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "dev-bind-params as 0.64.999",
"utopia-php/database": "0.61.*",
"utopia-php/domains": "0.5.*",
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
"utopia-php/fetch": "0.4.*",
"utopia-php/fetch": "0.3.*",
"utopia-php/image": "0.8.*",
"utopia-php/locale": "0.4.*",
"utopia-php/logger": "0.6.*",
@@ -63,7 +63,7 @@
"utopia-php/migration": "0.8.*",
"utopia-php/orchestration": "0.9.*",
"utopia-php/platform": "0.7.*",
"utopia-php/pools": "0.8.*",
"utopia-php/pools": "0.7.*",
"utopia-php/preloader": "0.2.*",
"utopia-php/queue": "0.9.*",
"utopia-php/registry": "0.5.*",
Generated
+341 -81
View File
@@ -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": "f31906555e33bc99128fb59dc655ba0b",
"content-hash": "e0d7f21b681e4591144fec16c4f0d6aa",
"packages": [
{
"name": "adhocore/jwt",
@@ -709,16 +709,16 @@
},
{
"name": "google/protobuf",
"version": "v4.30.2",
"version": "v4.30.1",
"source": {
"type": "git",
"url": "https://github.com/protocolbuffers/protobuf-php.git",
"reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced"
"reference": "f29ba8a30dfd940efb3a8a75dc44446539101f24"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/a4c4d8565b40b9f76debc9dfeb221412eacb8ced",
"reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/f29ba8a30dfd940efb3a8a75dc44446539101f24",
"reference": "f29ba8a30dfd940efb3a8a75dc44446539101f24",
"shasum": ""
},
"require": {
@@ -747,9 +747,69 @@
"proto"
],
"support": {
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.2"
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.1"
},
"time": "2025-03-26T18:01:50+00:00"
"time": "2025-03-13T21:08:17+00:00"
},
{
"name": "jean85/pretty-package-versions",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/Jean85/pretty-package-versions.git",
"reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/4d7aa5dab42e2a76d99559706022885de0e18e1a",
"reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.1.0",
"php": "^7.4|^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"jean85/composer-provided-replaced-stub-package": "^1.0",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^7.5|^8.5|^9.6",
"rector/rector": "^2.0",
"vimeo/psalm": "^4.3 || ^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Jean85\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alessandro Lai",
"email": "alessandro.lai85@gmail.com"
}
],
"description": "A library to get pretty versions strings of installed dependencies",
"keywords": [
"composer",
"package",
"release",
"versions"
],
"support": {
"issues": "https://github.com/Jean85/pretty-package-versions/issues",
"source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1"
},
"time": "2025-03-19T14:43:43+00:00"
},
{
"name": "league/csv",
@@ -909,6 +969,75 @@
},
"time": "2023-10-02T10:01:54+00:00"
},
{
"name": "mongodb/mongodb",
"version": "1.10.0",
"source": {
"type": "git",
"url": "https://github.com/mongodb/mongo-php-library.git",
"reference": "b0bbd657f84219212487d01a8ffe93a789e1e488"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/b0bbd657f84219212487d01a8ffe93a789e1e488",
"reference": "b0bbd657f84219212487d01a8ffe93a789e1e488",
"shasum": ""
},
"require": {
"ext-hash": "*",
"ext-json": "*",
"ext-mongodb": "^1.11.0",
"jean85/pretty-package-versions": "^1.2 || ^2.0.1",
"php": "^7.1 || ^8.0",
"symfony/polyfill-php80": "^1.19"
},
"require-dev": {
"doctrine/coding-standard": "^9.0",
"squizlabs/php_codesniffer": "^3.6",
"symfony/phpunit-bridge": "^5.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10.x-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"MongoDB\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Andreas Braun",
"email": "andreas.braun@mongodb.com"
},
{
"name": "Jeremy Mikola",
"email": "jmikola@gmail.com"
}
],
"description": "MongoDB driver library",
"homepage": "https://jira.mongodb.org/browse/PHPLIB",
"keywords": [
"database",
"driver",
"mongodb",
"persistence"
],
"support": {
"issues": "https://github.com/mongodb/mongo-php-library/issues",
"source": "https://github.com/mongodb/mongo-php-library/tree/1.10.0"
},
"time": "2021-10-20T22:22:37+00:00"
},
{
"name": "mustangostang/spyc",
"version": "0.6.3",
@@ -2243,16 +2372,16 @@
},
{
"name": "ramsey/collection",
"version": "2.1.1",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/ramsey/collection.git",
"reference": "344572933ad0181accbf4ba763e85a0306a8c5e2"
"reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2",
"reference": "344572933ad0181accbf4ba763e85a0306a8c5e2",
"url": "https://api.github.com/repos/ramsey/collection/zipball/3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109",
"reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109",
"shasum": ""
},
"require": {
@@ -2313,9 +2442,9 @@
],
"support": {
"issues": "https://github.com/ramsey/collection/issues",
"source": "https://github.com/ramsey/collection/tree/2.1.1"
"source": "https://github.com/ramsey/collection/tree/2.1.0"
},
"time": "2025-03-22T05:38:12+00:00"
"time": "2025-03-02T04:48:29+00:00"
},
{
"name": "ramsey/uuid",
@@ -2804,6 +2933,86 @@
],
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-php82",
"version": "v1.31.0",
@@ -3497,16 +3706,16 @@
},
{
"name": "utopia-php/database",
"version": "dev-bind-params",
"version": "0.61.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "9fcaa37c092ae89680590114f3a4d6029eb02bb2"
"reference": "349fbdf4bc088f7775c7dfb8b80239a617a88436"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/9fcaa37c092ae89680590114f3a4d6029eb02bb2",
"reference": "9fcaa37c092ae89680590114f3a4d6029eb02bb2",
"url": "https://api.github.com/repos/utopia-php/database/zipball/349fbdf4bc088f7775c7dfb8b80239a617a88436",
"reference": "349fbdf4bc088f7775c7dfb8b80239a617a88436",
"shasum": ""
},
"require": {
@@ -3515,7 +3724,7 @@
"php": ">=8.1",
"utopia-php/cache": "0.12.*",
"utopia-php/framework": "0.33.*",
"utopia-php/pools": "0.8.*"
"utopia-php/mongo": "0.3.*"
},
"require-dev": {
"fakerphp/faker": "1.23.*",
@@ -3547,9 +3756,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/bind-params"
"source": "https://github.com/utopia-php/database/tree/0.61.2"
},
"time": "2025-03-30T16:53:08+00:00"
"time": "2025-03-15T11:47:42+00:00"
},
{
"name": "utopia-php/domains",
@@ -3660,16 +3869,16 @@
},
{
"name": "utopia-php/fetch",
"version": "0.4.0",
"version": "0.3.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/fetch.git",
"reference": "46e791ff6a95864517750b9df6bbf4a17e3c9c4e"
"reference": "524dd50afa8c64670c4fb18f1df4db9b5bb4b3d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/fetch/zipball/46e791ff6a95864517750b9df6bbf4a17e3c9c4e",
"reference": "46e791ff6a95864517750b9df6bbf4a17e3c9c4e",
"url": "https://api.github.com/repos/utopia-php/fetch/zipball/524dd50afa8c64670c4fb18f1df4db9b5bb4b3d0",
"reference": "524dd50afa8c64670c4fb18f1df4db9b5bb4b3d0",
"shasum": ""
},
"require": {
@@ -3693,9 +3902,9 @@
"description": "A simple library that provides an interface for making HTTP Requests.",
"support": {
"issues": "https://github.com/utopia-php/fetch/issues",
"source": "https://github.com/utopia-php/fetch/tree/0.4.0"
"source": "https://github.com/utopia-php/fetch/tree/0.3.1"
},
"time": "2025-03-11T21:06:56+00:00"
"time": "2025-03-05T18:08:55+00:00"
},
{
"name": "utopia-php/framework",
@@ -3951,16 +4160,16 @@
},
{
"name": "utopia-php/migration",
"version": "0.8.4",
"version": "0.8.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "845fd04ccf5e0edb03c184b864e0596080a432b8"
"reference": "36ec7af2e6bf78de5d86e1b0a953fd7dcdf69dab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/845fd04ccf5e0edb03c184b864e0596080a432b8",
"reference": "845fd04ccf5e0edb03c184b864e0596080a432b8",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/36ec7af2e6bf78de5d86e1b0a953fd7dcdf69dab",
"reference": "36ec7af2e6bf78de5d86e1b0a953fd7dcdf69dab",
"shasum": ""
},
"require": {
@@ -3968,7 +4177,7 @@
"ext-curl": "*",
"ext-openssl": "*",
"php": ">=8.1",
"utopia-php/database": "0.*.*",
"utopia-php/database": "0.61.*",
"utopia-php/dsn": "0.2.*",
"utopia-php/framework": "0.33.*",
"utopia-php/storage": "0.18.*"
@@ -4001,9 +4210,69 @@
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/0.8.4"
"source": "https://github.com/utopia-php/migration/tree/0.8.1"
},
"time": "2025-03-28T02:08:22+00:00"
"time": "2025-03-18T07:48:08+00:00"
},
{
"name": "utopia-php/mongo",
"version": "0.3.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/mongo.git",
"reference": "52326a9a43e2d27ff0c15c48ba746dacbe9a7aee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/mongo/zipball/52326a9a43e2d27ff0c15c48ba746dacbe9a7aee",
"reference": "52326a9a43e2d27ff0c15c48ba746dacbe9a7aee",
"shasum": ""
},
"require": {
"ext-mongodb": "*",
"mongodb/mongodb": "1.10.0",
"php": ">=8.0"
},
"require-dev": {
"fakerphp/faker": "^1.14",
"laravel/pint": "1.2.*",
"phpstan/phpstan": "1.8.*",
"phpunit/phpunit": "^9.4",
"swoole/ide-helper": "4.8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Utopia\\Mongo\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eldad Fux",
"email": "eldad@appwrite.io"
},
{
"name": "Wess",
"email": "wess@appwrite.io"
}
],
"description": "A simple library to manage Mongo database",
"keywords": [
"database",
"mongo",
"php",
"upf",
"utopia"
],
"support": {
"issues": "https://github.com/utopia-php/mongo/issues",
"source": "https://github.com/utopia-php/mongo/tree/0.3.1"
},
"time": "2023-09-01T17:25:28+00:00"
},
{
"name": "utopia-php/orchestration",
@@ -4107,16 +4376,16 @@
},
{
"name": "utopia-php/pools",
"version": "0.8.0",
"version": "0.7.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/pools.git",
"reference": "60733929dc328e7ea47e800579c8bbf0d49df5ba"
"reference": "ad64d45afda08ec8b29e2642a8d18075964d40bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/pools/zipball/60733929dc328e7ea47e800579c8bbf0d49df5ba",
"reference": "60733929dc328e7ea47e800579c8bbf0d49df5ba",
"url": "https://api.github.com/repos/utopia-php/pools/zipball/ad64d45afda08ec8b29e2642a8d18075964d40bf",
"reference": "ad64d45afda08ec8b29e2642a8d18075964d40bf",
"shasum": ""
},
"require": {
@@ -4153,9 +4422,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/pools/issues",
"source": "https://github.com/utopia-php/pools/tree/0.8.0"
"source": "https://github.com/utopia-php/pools/tree/0.7.0"
},
"time": "2025-03-19T10:22:03+00:00"
"time": "2025-03-18T03:55:33+00:00"
},
{
"name": "utopia-php/preloader",
@@ -4212,23 +4481,23 @@
},
{
"name": "utopia-php/queue",
"version": "0.9.1",
"version": "0.9.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/queue.git",
"reference": "32b6f84c55aae761db5a5ae76cc91ca8dbc8bc32"
"reference": "077075f1d57afa430f76c35ed3bf4616e0eee8e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/queue/zipball/32b6f84c55aae761db5a5ae76cc91ca8dbc8bc32",
"reference": "32b6f84c55aae761db5a5ae76cc91ca8dbc8bc32",
"url": "https://api.github.com/repos/utopia-php/queue/zipball/077075f1d57afa430f76c35ed3bf4616e0eee8e7",
"reference": "077075f1d57afa430f76c35ed3bf4616e0eee8e7",
"shasum": ""
},
"require": {
"php": ">=8.3",
"php-amqplib/php-amqplib": "^3.7",
"utopia-php/cli": "0.15.*",
"utopia-php/fetch": "0.4.*",
"utopia-php/fetch": "^0.3.0",
"utopia-php/framework": "0.33.*",
"utopia-php/telemetry": "0.1.*"
},
@@ -4271,9 +4540,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/queue/issues",
"source": "https://github.com/utopia-php/queue/tree/0.9.1"
"source": "https://github.com/utopia-php/queue/tree/0.9.0"
},
"time": "2025-03-28T19:49:36+00:00"
"time": "2025-03-13T12:22:41+00:00"
},
{
"name": "utopia-php/registry",
@@ -4386,16 +4655,16 @@
},
{
"name": "utopia-php/swoole",
"version": "0.8.3",
"version": "0.8.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/swoole.git",
"reference": "1af73dd3e73987cf729c7db399054e4a70befd99"
"reference": "5fa9d42c608ad46a4ce42a6d2b2eae00592fccd4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/swoole/zipball/1af73dd3e73987cf729c7db399054e4a70befd99",
"reference": "1af73dd3e73987cf729c7db399054e4a70befd99",
"url": "https://api.github.com/repos/utopia-php/swoole/zipball/5fa9d42c608ad46a4ce42a6d2b2eae00592fccd4",
"reference": "5fa9d42c608ad46a4ce42a6d2b2eae00592fccd4",
"shasum": ""
},
"require": {
@@ -4431,9 +4700,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/swoole/issues",
"source": "https://github.com/utopia-php/swoole/tree/0.8.3"
"source": "https://github.com/utopia-php/swoole/tree/0.8.2"
},
"time": "2025-03-26T10:09:05+00:00"
"time": "2024-02-01T14:54:12+00:00"
},
{
"name": "utopia-php/system",
@@ -4776,16 +5045,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.40.11",
"version": "0.40.9",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "0ec5f4a60c15e33e208bc3444ba6148b1d0f0027"
"reference": "dbb45a5db22cdc3368fe2573c07ba6088f188fa4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/0ec5f4a60c15e33e208bc3444ba6148b1d0f0027",
"reference": "0ec5f4a60c15e33e208bc3444ba6148b1d0f0027",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/dbb45a5db22cdc3368fe2573c07ba6088f188fa4",
"reference": "dbb45a5db22cdc3368fe2573c07ba6088f188fa4",
"shasum": ""
},
"require": {
@@ -4821,9 +5090,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.40.11"
"source": "https://github.com/appwrite/sdk-generator/tree/0.40.9"
},
"time": "2025-03-26T10:53:16+00:00"
"time": "2025-03-17T18:39:14+00:00"
},
{
"name": "doctrine/annotations",
@@ -7155,16 +7424,16 @@
},
{
"name": "symfony/console",
"version": "v7.2.5",
"version": "v7.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "e51498ea18570c062e7df29d05a7003585b19b88"
"reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/e51498ea18570c062e7df29d05a7003585b19b88",
"reference": "e51498ea18570c062e7df29d05a7003585b19b88",
"url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3",
"reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3",
"shasum": ""
},
"require": {
@@ -7228,7 +7497,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.2.5"
"source": "https://github.com/symfony/console/tree/v7.2.1"
},
"funding": [
{
@@ -7244,7 +7513,7 @@
"type": "tidelift"
}
],
"time": "2025-03-12T08:11:12+00:00"
"time": "2024-12-11T03:49:26+00:00"
},
{
"name": "symfony/filesystem",
@@ -7759,16 +8028,16 @@
},
{
"name": "symfony/process",
"version": "v7.2.5",
"version": "v7.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "87b7c93e57df9d8e39a093d32587702380ff045d"
"reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/87b7c93e57df9d8e39a093d32587702380ff045d",
"reference": "87b7c93e57df9d8e39a093d32587702380ff045d",
"url": "https://api.github.com/repos/symfony/process/zipball/d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf",
"reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf",
"shasum": ""
},
"require": {
@@ -7800,7 +8069,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v7.2.5"
"source": "https://github.com/symfony/process/tree/v7.2.4"
},
"funding": [
{
@@ -7816,7 +8085,7 @@
"type": "tidelift"
}
],
"time": "2025-03-13T12:21:46+00:00"
"time": "2025-02-05T08:33:46+00:00"
},
{
"name": "symfony/string",
@@ -8133,18 +8402,9 @@
"time": "2024-03-07T20:33:40+00:00"
}
],
"aliases": [
{
"package": "utopia-php/database",
"version": "dev-bind-params",
"alias": "0.64.999",
"alias_normalized": "0.64.999.0"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"utopia-php/database": 20
},
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
+2 -1
View File
@@ -10,6 +10,7 @@ use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception;
use Utopia\Database\Query;
use Utopia\System\System;
class V19 extends Migration
{
@@ -730,7 +731,7 @@ class V19 extends Migration
if (empty($document->getAttribute('scheduleId', null))) {
$schedule = $this->consoleDB->createDocument('schedules', new Document([
'region' => $project->getAttribute('region'),
'region' => System::getEnv('_APP_REGION', 'default'), // Todo replace with projects region
'resourceType' => 'function',
'resourceId' => $document->getId(),
'resourceInternalId' => $document->getInternalId(),
+2 -16
View File
@@ -103,15 +103,8 @@ abstract class ScheduleBase extends Action
$paginationQueries[] = Query::cursorAfter($latestDocument);
}
// Temporarly accepting both 'fra' and 'default'
// When all migrated, only use _APP_REGION with 'default' as default value
$regions = [System::getEnv('_APP_REGION', 'default')];
if (!in_array('default', $regions)) {
$regions[] = 'default';
}
$results = $dbForPlatform->find('schedules', \array_merge($paginationQueries, [
Query::equal('region', $regions),
Query::equal('region', [System::getEnv('_APP_REGION', 'default')]),
Query::equal('resourceType', [static::getSupportedResource()]),
Query::equal('active', [true]),
]));
@@ -160,15 +153,8 @@ abstract class ScheduleBase extends Action
$paginationQueries[] = Query::cursorAfter($latestDocument);
}
// Temporarly accepting both 'fra' and 'default'
// When all migrated, only use _APP_REGION with 'default' as default value
$regions = [System::getEnv('_APP_REGION', 'default')];
if (!in_array('default', $regions)) {
$regions[] = 'default';
}
$results = $dbForPlatform->find('schedules', \array_merge($paginationQueries, [
Query::equal('region', $regions),
Query::equal('region', [System::getEnv('_APP_REGION', 'default')]),
Query::equal('resourceType', [static::getSupportedResource()]),
Query::greaterThanEqual('resourceUpdatedAt', $lastSyncUpdate),
]));
+46 -119
View File
@@ -31,8 +31,6 @@ use Utopia\System\System;
class Deletes extends Action
{
protected array $selects = ['$internalId', '$id', '$collection', '$permissions', '$updatedAt'];
public static function getName(): string
{
return 'deletes';
@@ -59,7 +57,7 @@ class Deletes extends Action
->inject('auditRetention')
->inject('log')
->callback(
fn ($message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, string $auditRetention, Log $log) =>
fn ($message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, array $auditRetention, Log $log) =>
$this->action($message, $project, $dbForPlatform, $getProjectDB, $getLogsDB, $deviceForFiles, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $executionRetention, $auditRetention, $log)
);
}
@@ -68,7 +66,7 @@ class Deletes extends Action
* @throws Exception
* @throws Throwable
*/
public function action(Message $message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, string $auditRetention, Log $log): void
public function action(Message $message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, array $auditRetention, Log $log): void
{
$payload = $message->getPayload() ?? [];
@@ -182,17 +180,10 @@ class Deletes extends Action
*/
private function deleteSchedules(Database $dbForPlatform, callable $getProjectDB, string $datetime): void
{
// Temporarly accepting both 'fra' and 'default'
// When all migrated, only use _APP_REGION with 'default' as default value
$regions = [System::getEnv('_APP_REGION', 'default')];
if (!in_array('default', $regions)) {
$regions[] = 'default';
}
$this->listByGroup(
'schedules',
[
Query::equal('region', $regions),
Query::equal('region', [System::getEnv('_APP_REGION', 'default')]),
Query::lessThanEqual('resourceUpdatedAt', $datetime),
Query::equal('active', [false]),
],
@@ -257,8 +248,7 @@ class Deletes extends Action
$this->deleteByGroup(
'subscribers',
[
Query::equal('topicInternalId', [$topic->getInternalId()]),
Query::orderAsc(),
Query::equal('topicInternalId', [$topic->getInternalId()])
],
$getProjectDB($project)
);
@@ -279,8 +269,7 @@ class Deletes extends Action
$this->deleteByGroup(
'subscribers',
[
Query::equal('targetInternalId', [$target->getInternalId()]),
Query::orderAsc(),
Query::equal('targetInternalId', [$target->getInternalId()])
],
$dbForProject,
function (Document $subscriber) use ($dbForProject, $target) {
@@ -317,8 +306,7 @@ class Deletes extends Action
$this->deleteByGroup(
'targets',
[
Query::equal('expired', [true]),
Query::orderAsc(),
Query::equal('expired', [true])
],
$getProjectDB($project),
function (Document $target) use ($getProjectDB, $project) {
@@ -332,8 +320,7 @@ class Deletes extends Action
$this->deleteByGroup(
'targets',
[
Query::equal('sessionInternalId', [$session->getInternalId()]),
Query::orderAsc(),
Query::equal('sessionInternalId', [$session->getInternalId()])
],
$getProjectDB($project),
function (Document $target) use ($getProjectDB, $project) {
@@ -360,20 +347,14 @@ class Deletes extends Action
new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId)
);
$queries = [
Query::equal('resource', [$resource])
];
$query[] = Query::equal('resource', [$resource]);
if (!empty($resourceType)) {
$queries[] = Query::equal('resourceType', [$resourceType]);
$query[] = Query::equal('resourceType', [$resourceType]);
}
$queries[] = Query::select($this->selects);
$queries[] = Query::orderAsc();
$this->deleteByGroup(
'cache',
$queries,
$query,
$dbForProject,
function (Document $document) use ($cache, $projectId) {
$path = APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId . DIRECTORY_SEPARATOR . $document->getId();
@@ -404,16 +385,15 @@ class Deletes extends Action
new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId)
);
$queries = [
Query::select([...$this->selects, 'accessedAt']),
$query = [
Query::lessThan('accessedAt', $datetime),
Query::orderDesc('accessedAt'),
Query::orderDesc(),
Query::orderDesc('$internalId'),
];
$this->deleteByGroup(
'cache',
$queries,
$query,
$dbForProject,
function (Document $document) use ($cache, $projectId) {
$path = APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId . DIRECTORY_SEPARATOR . $document->getId();
@@ -439,15 +419,12 @@ class Deletes extends Action
/** @var Database $dbForProject*/
$dbForProject = $getProjectDB($project);
$selects = [...$this->selects, 'time'];
// Delete Usage stats from projectDB
$this->deleteByGroup('stats', [
Query::select($selects),
Query::equal('period', ['1h']),
Query::lessThan('time', $hourlyUsageRetentionDatetime),
Query::orderDesc('time'),
Query::orderDesc(),
Query::orderDesc('$internalId'),
Query::equal('period', ['1h']),
], $dbForProject);
if ($project->getId() !== 'console') {
@@ -456,11 +433,10 @@ class Deletes extends Action
// Delete Usage stats from logsDB
$this->deleteByGroup('stats', [
Query::select($selects),
Query::equal('period', ['1h']),
Query::lessThan('time', $hourlyUsageRetentionDatetime),
Query::orderDesc('time'),
Query::orderDesc(),
Query::orderDesc('$internalId'),
Query::equal('period', ['1h']),
], $dbForLogs);
}
}
@@ -481,8 +457,7 @@ class Deletes extends Action
$this->deleteByGroup(
'memberships',
[
Query::equal('teamInternalId', [$teamInternalId]),
Query::orderAsc()
Query::equal('teamInternalId', [$teamInternalId])
],
$dbForProject,
function (Document $membership) use ($dbForProject) {
@@ -572,13 +547,7 @@ class Deletes extends Action
if ($projectTables || !\in_array($collection->getId(), $projectCollectionIds)) {
$dbForProject->deleteCollection($collection->getId());
} else {
$this->deleteByGroup(
$collection->getId(),
[
Query::orderAsc()
],
database: $dbForProject
);
$this->deleteByGroup($collection->getId(), [], database: $dbForProject);
}
} catch (Throwable $e) {
Console::error('Error deleting '.$collection->getId().' '.$e->getMessage());
@@ -598,78 +567,58 @@ class Deletes extends Action
// Delete Platforms
$this->deleteByGroup('platforms', [
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
Query::equal('projectInternalId', [$projectInternalId])
], $dbForPlatform);
// Delete project and function rules
$this->deleteByGroup('rules', [
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
Query::equal('projectInternalId', [$projectInternalId])
], $dbForPlatform, function (Document $document) use ($dbForPlatform, $certificates) {
$this->deleteRule($dbForPlatform, $document, $certificates);
});
// Delete Keys
$this->deleteByGroup('keys', [
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
Query::equal('projectInternalId', [$projectInternalId])
], $dbForPlatform);
// Delete Webhooks
$this->deleteByGroup('webhooks', [
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
Query::equal('projectInternalId', [$projectInternalId])
], $dbForPlatform);
// Delete VCS Installations
$this->deleteByGroup('installations', [
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
Query::equal('projectInternalId', [$projectInternalId])
], $dbForPlatform);
// Delete VCS Repositories
$this->deleteByGroup('repositories', [
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
], $dbForPlatform);
// Delete VCS comments
$this->deleteByGroup('vcsComments', [
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
], $dbForPlatform);
// Delete Schedules
// Delete Schedules (No projectInternalId in this collection)
$this->deleteByGroup('schedules', [
Query::equal('projectId', [$projectId]),
Query::orderAsc()
], $dbForPlatform);
// Delete metadata table
if ($projectTables) {
$dbForProject->deleteCollection(Database::METADATA);
} elseif ($sharedTablesV1) {
$this->deleteByGroup(
Database::METADATA,
[
Query::orderAsc()
],
$dbForProject
);
$this->deleteByGroup(Database::METADATA, [], $dbForProject);
} elseif ($sharedTablesV2) {
$queries = \array_map(
fn ($id) => Query::notEqual('$id', $id),
$projectCollectionIds
);
$queries[] = Query::orderAsc();
$this->deleteByGroup(
Database::METADATA,
$queries,
$dbForProject
);
$this->deleteByGroup(Database::METADATA, $queries, $dbForProject);
}
// Delete all storage directories
@@ -694,16 +643,14 @@ class Deletes extends Action
// Delete all sessions of this user from the sessions table and update the sessions field of the user record
$this->deleteByGroup('sessions', [
Query::equal('userInternalId', [$userInternalId]),
Query::orderAsc()
Query::equal('userInternalId', [$userInternalId])
], $dbForProject);
$dbForProject->purgeCachedDocument('users', $userId);
// Delete Memberships and decrement team membership counts
$this->deleteByGroup('memberships', [
Query::equal('userInternalId', [$userInternalId]),
Query::orderAsc()
Query::equal('userInternalId', [$userInternalId])
], $dbForProject, function (Document $document) use ($dbForProject) {
if ($document->getAttribute('confirm')) { // Count only confirmed members
$teamId = $document->getAttribute('teamId');
@@ -716,22 +663,19 @@ class Deletes extends Action
// Delete tokens
$this->deleteByGroup('tokens', [
Query::equal('userInternalId', [$userInternalId]),
Query::orderAsc()
Query::equal('userInternalId', [$userInternalId])
], $dbForProject);
// Delete identities
$this->deleteByGroup('identities', [
Query::equal('userInternalId', [$userInternalId]),
Query::orderAsc()
Query::equal('userInternalId', [$userInternalId])
], $dbForProject);
// Delete targets
$this->deleteByGroup(
'targets',
[
Query::equal('userInternalId', [$userInternalId]),
Query::orderAsc()
Query::equal('userInternalId', [$userInternalId])
],
$dbForProject,
function (Document $target) use ($getProjectDB, $project) {
@@ -753,10 +697,9 @@ class Deletes extends Action
// Delete Executions
$this->deleteByGroup('executions', [
Query::select([...$this->selects, '$createdAt']),
Query::lessThan('$createdAt', $datetime),
Query::orderDesc('$createdAt'),
Query::orderDesc(),
Query::orderDesc('$internalId'),
], $dbForProject);
}
@@ -774,10 +717,9 @@ class Deletes extends Action
// Delete Sessions
$this->deleteByGroup('sessions', [
Query::select([...$this->selects, '$createdAt']),
Query::lessThan('$createdAt', $expired),
Query::orderDesc('$createdAt'),
Query::orderDesc(),
Query::orderDesc('$internalId'),
], $dbForProject);
}
@@ -793,28 +735,27 @@ class Deletes extends Action
$this->deleteByGroup('realtime', [
Query::lessThan('timestamp', $datetime),
Query::orderDesc('timestamp'),
Query::orderAsc(),
Query::orderDesc('$internalId'),
], $dbForPlatform);
}
/**
* @param Database $dbForPlatform
* @param callable $getProjectDB
* @param string $auditRetention
* @param string $datetime
* @return void
* @throws Exception
*/
private function deleteAuditLogs(Document $project, callable $getProjectDB, string $auditRetention): void
private function deleteAuditLogs(Document $project, callable $getProjectDB, array $auditRetention): void
{
$projectId = $project->getId();
$dbForProject = $getProjectDB($project);
try {
$this->deleteByGroup(Audit::COLLECTION, [
Query::select([...$this->selects, 'time']),
Query::lessThan('time', $auditRetention),
Query::lessThan('time', ($projectId === 'console' ? $auditRetention['console'] : $auditRetention['project'])),
Query::orderDesc('time'),
Query::orderAsc(),
Query::orderDesc('$internalId'),
], $dbForProject);
} catch (DatabaseException $e) {
Console::error('Failed to delete audit logs for project ' . $projectId . ': ' . $e->getMessage());
@@ -842,10 +783,9 @@ class Deletes extends Action
*/
Console::info("Deleting rules for function " . $functionId);
$this->deleteByGroup('rules', [
Query::equal('projectInternalId', [$project->getInternalId()]),
Query::equal('resourceInternalId', [$functionInternalId]),
Query::equal('resourceType', ['function']),
Query::orderAsc()
Query::equal('resourceInternalId', [$functionInternalId]),
Query::equal('projectInternalId', [$project->getInternalId()])
], $dbForPlatform, function (Document $document) use ($project, $dbForPlatform, $certificates) {
$this->deleteRule($dbForPlatform, $document, $certificates);
});
@@ -855,9 +795,8 @@ class Deletes extends Action
*/
Console::info("Deleting variables for function " . $functionId);
$this->deleteByGroup('variables', [
Query::equal('resourceInternalId', [$functionInternalId]),
Query::equal('resourceType', ['function']),
Query::orderAsc()
Query::equal('resourceInternalId', [$functionInternalId])
], $dbForProject);
/**
@@ -867,8 +806,7 @@ class Deletes extends Action
$deploymentInternalIds = [];
$this->deleteByGroup('deployments', [
Query::equal('resourceInternalId', [$functionInternalId]),
Query::orderAsc()
Query::equal('resourceInternalId', [$functionInternalId])
], $dbForProject, function (Document $document) use ($deviceForFunctions, &$deploymentInternalIds) {
$deploymentInternalIds[] = $document->getInternalId();
$this->deleteDeploymentFiles($deviceForFunctions, $document);
@@ -881,8 +819,7 @@ class Deletes extends Action
foreach ($deploymentInternalIds as $deploymentInternalId) {
$this->deleteByGroup('builds', [
Query::equal('deploymentInternalId', [$deploymentInternalId]),
Query::orderAsc()
Query::equal('deploymentInternalId', [$deploymentInternalId])
], $dbForProject, function (Document $document) use ($deviceForBuilds) {
$this->deleteBuildFiles($deviceForBuilds, $document);
});
@@ -893,9 +830,7 @@ class Deletes extends Action
*/
Console::info("Deleting executions for function " . $functionId);
$this->deleteByGroup('executions', [
Query::select($this->selects),
Query::equal('functionInternalId', [$functionInternalId]),
Query::orderAsc()
Query::equal('functionInternalId', [$functionInternalId])
], $dbForProject);
/**
@@ -906,15 +841,12 @@ class Deletes extends Action
Query::equal('projectInternalId', [$project->getInternalId()]),
Query::equal('resourceInternalId', [$functionInternalId]),
Query::equal('resourceType', ['function']),
Query::orderAsc()
], $dbForPlatform, function (Document $document) use ($dbForPlatform) {
$providerRepositoryId = $document->getAttribute('providerRepositoryId', '');
$projectInternalId = $document->getAttribute('projectInternalId', '');
$this->deleteByGroup('vcsComments', [
Query::equal('providerRepositoryId', [$providerRepositoryId]),
Query::equal('projectInternalId', [$projectInternalId]),
Query::orderAsc()
], $dbForPlatform);
});
@@ -1014,8 +946,7 @@ class Deletes extends Action
Console::info("Deleting builds for deployment " . $deploymentId);
$this->deleteByGroup('builds', [
Query::equal('deploymentInternalId', [$deploymentInternalId]),
Query::orderAsc()
Query::equal('deploymentInternalId', [$deploymentInternalId])
], $dbForProject, function (Document $document) use ($deviceForBuilds) {
$this->deleteBuildFiles($deviceForBuilds, $document);
});
@@ -1043,10 +974,6 @@ class Deletes extends Action
): void {
$start = \microtime(true);
/**
* deleteDocuments uses a cursor, we need to add a unique order by field or use default
*/
try {
$documents = $database->deleteDocuments($collection, $queries);
} catch (Throwable $th) {
@@ -71,18 +71,12 @@ class Base extends Queries
'array' => false,
]);
$internalId = new Document([
'key' => '$internalId',
'type' => Database::VAR_STRING,
'array' => false,
]);
$validators = [
new Limit(),
new Offset(),
new Cursor(),
new Filter($attributes, APP_DATABASE_QUERY_MAX_VALUES),
new Order([...$attributes, $internalId]),
new Order($attributes),
];
parent::__construct($validators);
+4 -3
View File
@@ -74,7 +74,7 @@ class CompressionTest extends Scope
], $this->getHeaders()));
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertArrayHasKey('content-encoding', $response['headers'], 'Content encoding should be gzip, headers received: ' . json_encode($response['headers'], JSON_PRETTY_PRINT));
$this->assertArrayHasKey('content-encoding', $response['headers'], '`Content-Encoding` should be gzip, instead received response: ' . json_encode($response, JSON_PRETTY_PRINT));
$this->assertLessThan(2000, intval($response['headers']['content-length']));
// get prefs without compression
@@ -116,7 +116,7 @@ class CompressionTest extends Scope
]);
$fileId = $file['body']['$id'];
// get image with header
// get image with accept header
$response = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId, array_merge([
'content-type' => 'application/json',
'accept-encoding' => 'gzip',
@@ -125,7 +125,8 @@ class CompressionTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertArrayNotHasKey('content-encoding', $response['headers']);
// get image without
// get image without accept header
$response = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
+185 -171
View File
@@ -3,10 +3,8 @@
namespace Tests\E2E\General;
use Appwrite\Functions\Specification;
use Appwrite\Tests\Retry;
use CURLFile;
use DateTime;
use PHPUnit\Framework\ExpectationFailedException;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
@@ -23,8 +21,8 @@ class UsageTest extends Scope
use SideServer;
use FunctionsBase;
private const WAIT = 5;
private const CREATE = 20;
private const WAIT = 5; //
private const RESOURCE_COUNT = 10; // Number of resources to create for each test
protected string $projectId;
@@ -77,7 +75,7 @@ class UsageTest extends Scope
$usersTotal = 0;
$requestsTotal = 0;
for ($i = 0; $i < self::CREATE; $i++) {
for ($i = 0; $i < self::RESOURCE_COUNT; $i++) {
$params = [
'userId' => 'unique()',
'email' => uniqid() . 'user@usage.test',
@@ -102,7 +100,7 @@ class UsageTest extends Scope
$usersTotal += 1;
$requestsTotal += 1;
if ($i < (self::CREATE / 2)) {
if ($i < (self::RESOURCE_COUNT / 2)) {
$userId = $response['body']['$id'];
$response = $this->client->call(
@@ -131,40 +129,43 @@ class UsageTest extends Scope
/**
* @depends testPrepareUsersStats
*/
#[Retry(count: 1)]
public function testUsersStats(array $data): array
{
$requestsTotal = $data['requestsTotal'];
$response = $this->client->call(
Client::METHOD_GET,
'/project/usage',
$this->getConsoleHeaders(),
[
'period' => '1h',
'startDate' => self::getToday(),
'endDate' => self::getTomorrow(),
]
);
$this->assertEventually(function () use ($data) {
$response = $this->client->call(
Client::METHOD_GET,
'/project/usage',
$this->getConsoleHeaders(),
[
'period' => '1h',
'startDate' => self::getToday(),
'endDate' => self::getTomorrow(),
]
);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(31, count($response['body']));
$this->validateDates($response['body']['network']);
$this->validateDates($response['body']['requests']);
$this->validateDates($response['body']['users']);
$this->assertArrayHasKey('executionsBreakdown', $response['body']);
$this->assertArrayHasKey('bucketsBreakdown', $response['body']);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(31, count($response['body']));
$this->validateDates($response['body']['network']);
$this->validateDates($response['body']['requests']);
$this->validateDates($response['body']['users']);
$this->assertArrayHasKey('executionsBreakdown', $response['body']);
$this->assertArrayHasKey('bucketsBreakdown', $response['body']);
});
$response = $this->client->call(
Client::METHOD_GET,
'/users/usage?range=90d',
$this->getConsoleHeaders()
);
$this->assertEventually(function () {
$response = $this->client->call(
Client::METHOD_GET,
'/users/usage?range=90d',
$this->getConsoleHeaders()
);
$this->assertEquals('90d', $response['body']['range']);
$this->assertEquals(90, count($response['body']['users']));
$this->assertEquals(90, count($response['body']['sessions']));
$this->assertEquals((self::CREATE / 2), $response['body']['users'][array_key_last($response['body']['users'])]['value']);
$this->assertEquals('90d', $response['body']['range']);
$this->assertEquals(90, count($response['body']['users']));
$this->assertEquals(90, count($response['body']['sessions']));
$this->assertEquals((self::RESOURCE_COUNT / 2), $response['body']['users'][array_key_last($response['body']['users'])]['value']);
});
return array_merge($data, [
'requestsTotal' => $requestsTotal
@@ -180,7 +181,7 @@ class UsageTest extends Scope
$storageTotal = 0;
$filesTotal = 0;
for ($i = 0; $i < self::CREATE; $i++) {
for ($i = 0; $i < self::RESOURCE_COUNT; $i++) {
$name = uniqid() . ' bucket';
$response = $this->client->call(
@@ -212,7 +213,7 @@ class UsageTest extends Scope
$bucketId = $response['body']['$id'];
if ($i < (self::CREATE / 2)) {
if ($i < (self::RESOURCE_COUNT / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/storage/buckets/' . $bucketId,
@@ -250,7 +251,7 @@ class UsageTest extends Scope
],
];
for ($i = 0; $i < self::CREATE; $i++) {
for ($i = 0; $i < self::RESOURCE_COUNT; $i++) {
$file = $files[$i % count($files)];
$response = $this->client->call(
@@ -277,7 +278,7 @@ class UsageTest extends Scope
$fileId = $response['body']['$id'];
if ($i < (self::CREATE / 2)) {
if ($i < (self::RESOURCE_COUNT / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/storage/buckets/' . $bucketId . '/files/' . $fileId,
@@ -307,7 +308,6 @@ class UsageTest extends Scope
/**
* @depends testPrepareStorageStats
*/
#[Retry(count: 10)]
public function testStorageStats(array $data): array
{
$bucketId = $data['bucketId'];
@@ -316,44 +316,50 @@ class UsageTest extends Scope
$storageTotal = $data['storageTotal'];
$filesTotal = $data['filesTotal'];
$response = $this->client->call(
Client::METHOD_GET,
'/project/usage',
$this->getConsoleHeaders(),
[
'period' => '1d',
'startDate' => self::getToday(),
'endDate' => self::getTomorrow(),
]
);
$this->assertEventually(function () use ($requestsTotal, $storageTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/project/usage',
$this->getConsoleHeaders(),
[
'period' => '1d',
'startDate' => self::getToday(),
'endDate' => self::getTomorrow(),
]
);
$this->assertEquals(31, count($response['body']));
$this->assertEquals(1, count($response['body']['requests']));
$this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']);
$this->validateDates($response['body']['requests']);
$this->assertEquals($storageTotal, $response['body']['filesStorageTotal']);
$this->assertEquals(31, count($response['body']));
$this->assertEquals(1, count($response['body']['requests']));
$this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']);
$this->validateDates($response['body']['requests']);
$this->assertEquals($storageTotal, $response['body']['filesStorageTotal']);
});
$response = $this->client->call(
Client::METHOD_GET,
'/storage/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEventually(function () use ($bucketsTotal, $storageTotal, $filesTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/storage/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEquals($storageTotal, $response['body']['storage'][array_key_last($response['body']['storage'])]['value']);
$this->validateDates($response['body']['storage']);
$this->assertEquals($bucketsTotal, $response['body']['buckets'][array_key_last($response['body']['buckets'])]['value']);
$this->validateDates($response['body']['buckets']);
$this->assertEquals($filesTotal, $response['body']['files'][array_key_last($response['body']['files'])]['value']);
$this->validateDates($response['body']['files']);
$this->assertEquals($storageTotal, $response['body']['storage'][array_key_last($response['body']['storage'])]['value']);
$this->validateDates($response['body']['storage']);
$this->assertEquals($bucketsTotal, $response['body']['buckets'][array_key_last($response['body']['buckets'])]['value']);
$this->validateDates($response['body']['buckets']);
$this->assertEquals($filesTotal, $response['body']['files'][array_key_last($response['body']['files'])]['value']);
$this->validateDates($response['body']['files']);
});
$response = $this->client->call(
Client::METHOD_GET,
'/storage/' . $bucketId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEventually(function () use ($bucketId, $storageTotal, $filesTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/storage/' . $bucketId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEquals($storageTotal, $response['body']['storage'][array_key_last($response['body']['storage'])]['value']);
$this->assertEquals($filesTotal, $response['body']['files'][array_key_last($response['body']['files'])]['value']);
$this->assertEquals($storageTotal, $response['body']['storage'][array_key_last($response['body']['storage'])]['value']);
$this->assertEquals($filesTotal, $response['body']['files'][array_key_last($response['body']['files'])]['value']);
});
return $data;
}
@@ -367,7 +373,7 @@ class UsageTest extends Scope
$collectionsTotal = 0;
$documentsTotal = 0;
for ($i = 0; $i < self::CREATE; $i++) {
for ($i = 0; $i < self::RESOURCE_COUNT; $i++) {
$name = uniqid() . ' database';
$response = $this->client->call(
@@ -391,7 +397,7 @@ class UsageTest extends Scope
$databaseId = $response['body']['$id'];
if ($i < (self::CREATE / 2)) {
if ($i < (self::RESOURCE_COUNT / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/databases/' . $databaseId,
@@ -407,7 +413,7 @@ class UsageTest extends Scope
}
}
for ($i = 0; $i < self::CREATE; $i++) {
for ($i = 0; $i < self::RESOURCE_COUNT; $i++) {
$name = uniqid() . ' collection';
$response = $this->client->call(
@@ -438,7 +444,7 @@ class UsageTest extends Scope
$collectionId = $response['body']['$id'];
if ($i < (self::CREATE / 2)) {
if ($i < (self::RESOURCE_COUNT / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/databases/' . $databaseId . '/collections/' . $collectionId,
@@ -474,7 +480,7 @@ class UsageTest extends Scope
$requestsTotal += 1;
for ($i = 0; $i < self::CREATE; $i++) {
for ($i = 0; $i < self::RESOURCE_COUNT; $i++) {
$name = uniqid() . ' collection';
$response = $this->client->call(
@@ -498,7 +504,7 @@ class UsageTest extends Scope
$documentId = $response['body']['$id'];
if ($i < (self::CREATE / 2)) {
if ($i < (self::RESOURCE_COUNT / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId,
@@ -525,7 +531,6 @@ class UsageTest extends Scope
}
/** @depends testPrepareDatabaseStats */
#[Retry(count: 1)]
public function testDatabaseStats(array $data): array
{
$databaseId = $data['databaseId'];
@@ -535,60 +540,66 @@ class UsageTest extends Scope
$collectionsTotal = $data['collectionsTotal'];
$documentsTotal = $data['documentsTotal'];
sleep(self::WAIT);
$this->assertEventually(function () use ($requestsTotal, $databasesTotal, $documentsTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/project/usage',
$this->getConsoleHeaders(),
[
'period' => '1d',
'startDate' => self::getToday(),
'endDate' => self::getTomorrow(),
]
);
$response = $this->client->call(
Client::METHOD_GET,
'/project/usage',
$this->getConsoleHeaders(),
[
'period' => '1d',
'startDate' => self::getToday(),
'endDate' => self::getTomorrow(),
]
);
$this->assertEquals(31, count($response['body']));
$this->assertEquals(1, count($response['body']['requests']));
$this->assertEquals(1, count($response['body']['network']));
$this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']);
$this->validateDates($response['body']['requests']);
$this->assertEquals($databasesTotal, $response['body']['databasesTotal']);
$this->assertEquals($documentsTotal, $response['body']['documentsTotal']);
});
$this->assertEquals(31, count($response['body']));
$this->assertEquals(1, count($response['body']['requests']));
$this->assertEquals(1, count($response['body']['network']));
$this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']);
$this->validateDates($response['body']['requests']);
$this->assertEquals($databasesTotal, $response['body']['databasesTotal']);
$this->assertEquals($documentsTotal, $response['body']['documentsTotal']);
$this->assertEventually(function () use ($databasesTotal, $collectionsTotal, $documentsTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/databases/usage?range=30d',
$this->getConsoleHeaders()
);
$response = $this->client->call(
Client::METHOD_GET,
'/databases/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEquals($databasesTotal, $response['body']['databases'][array_key_last($response['body']['databases'])]['value']);
$this->validateDates($response['body']['databases']);
$this->assertEquals($collectionsTotal, $response['body']['collections'][array_key_last($response['body']['collections'])]['value']);
$this->validateDates($response['body']['collections']);
$this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']);
$this->validateDates($response['body']['documents']);
});
$this->assertEquals($databasesTotal, $response['body']['databases'][array_key_last($response['body']['databases'])]['value']);
$this->validateDates($response['body']['databases']);
$this->assertEquals($collectionsTotal, $response['body']['collections'][array_key_last($response['body']['collections'])]['value']);
$this->validateDates($response['body']['collections']);
$this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']);
$this->validateDates($response['body']['documents']);
$this->assertEventually(function () use ($databaseId, $collectionsTotal, $documentsTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/databases/' . $databaseId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$response = $this->client->call(
Client::METHOD_GET,
'/databases/' . $databaseId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEquals($collectionsTotal, $response['body']['collections'][array_key_last($response['body']['collections'])]['value']);
$this->validateDates($response['body']['collections']);
$this->assertEquals($collectionsTotal, $response['body']['collections'][array_key_last($response['body']['collections'])]['value']);
$this->validateDates($response['body']['collections']);
$this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']);
$this->validateDates($response['body']['documents']);
});
$this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']);
$this->validateDates($response['body']['documents']);
$this->assertEventually(function () use ($databaseId, $collectionId, $documentsTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/databases/' . $databaseId . '/collections/' . $collectionId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$response = $this->client->call(
Client::METHOD_GET,
'/databases/' . $databaseId . '/collections/' . $collectionId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']);
$this->validateDates($response['body']['documents']);
$this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']);
$this->validateDates($response['body']['documents']);
});
return $data;
}
@@ -1010,62 +1021,65 @@ class UsageTest extends Scope
}
/** @depends testPrepareFunctionsStats */
#[Retry(count: 1)]
public function testFunctionsStats(array $data): array
{
$functionId = $data['functionId'];
$executionTime = $data['executionTime'];
$executions = $data['executions'];
$response = $this->client->call(
Client::METHOD_GET,
'/functions/' . $functionId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEventually(function () use ($functionId, $executionTime, $executions) {
$response = $this->client->call(
Client::METHOD_GET,
'/functions/' . $functionId . '/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(19, count($response['body']));
$this->assertEquals('30d', $response['body']['range']);
$this->assertIsArray($response['body']['deployments']);
$this->assertIsArray($response['body']['deploymentsStorage']);
$this->assertIsNumeric($response['body']['deploymentsStorageTotal']);
$this->assertIsNumeric($response['body']['buildsMbSecondsTotal']);
$this->assertIsNumeric($response['body']['executionsMbSecondsTotal']);
$this->assertIsArray($response['body']['builds']);
$this->assertIsArray($response['body']['buildsTime']);
$this->assertIsArray($response['body']['buildsMbSeconds']);
$this->assertIsArray($response['body']['executions']);
$this->assertIsArray($response['body']['executionsTime']);
$this->assertIsArray($response['body']['executionsMbSeconds']);
$this->assertEquals($executions, $response['body']['executions'][array_key_last($response['body']['executions'])]['value']);
$this->validateDates($response['body']['executions']);
$this->assertEquals($executionTime, $response['body']['executionsTime'][array_key_last($response['body']['executionsTime'])]['value']);
$this->validateDates($response['body']['executionsTime']);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(19, count($response['body']));
$this->assertEquals('30d', $response['body']['range']);
$this->assertIsArray($response['body']['deployments']);
$this->assertIsArray($response['body']['deploymentsStorage']);
$this->assertIsNumeric($response['body']['deploymentsStorageTotal']);
$this->assertIsNumeric($response['body']['buildsMbSecondsTotal']);
$this->assertIsNumeric($response['body']['executionsMbSecondsTotal']);
$this->assertIsArray($response['body']['builds']);
$this->assertIsArray($response['body']['buildsTime']);
$this->assertIsArray($response['body']['buildsMbSeconds']);
$this->assertIsArray($response['body']['executions']);
$this->assertIsArray($response['body']['executionsTime']);
$this->assertIsArray($response['body']['executionsMbSeconds']);
$this->assertEquals($executions, $response['body']['executions'][array_key_last($response['body']['executions'])]['value']);
$this->validateDates($response['body']['executions']);
$this->assertEquals($executionTime, $response['body']['executionsTime'][array_key_last($response['body']['executionsTime'])]['value']);
$this->validateDates($response['body']['executionsTime']);
});
$response = $this->client->call(
Client::METHOD_GET,
'/functions/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEventually(function () use ($executionTime, $executions) {
$response = $this->client->call(
Client::METHOD_GET,
'/functions/usage?range=30d',
$this->getConsoleHeaders()
);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(21, count($response['body']));
$this->assertEquals($response['body']['range'], '30d');
$this->assertIsArray($response['body']['functions']);
$this->assertIsArray($response['body']['deployments']);
$this->assertIsArray($response['body']['deploymentsStorage']);
$this->assertIsArray($response['body']['builds']);
$this->assertIsArray($response['body']['buildsTime']);
$this->assertIsArray($response['body']['buildsMbSeconds']);
$this->assertIsArray($response['body']['executions']);
$this->assertIsArray($response['body']['executionsTime']);
$this->assertIsArray($response['body']['executionsMbSeconds']);
$this->assertEquals($executions, $response['body']['executions'][array_key_last($response['body']['executions'])]['value']);
$this->validateDates($response['body']['executions']);
$this->assertEquals($executionTime, $response['body']['executionsTime'][array_key_last($response['body']['executionsTime'])]['value']);
$this->validateDates($response['body']['executionsTime']);
$this->assertGreaterThan(0, $response['body']['buildsTime'][array_key_last($response['body']['buildsTime'])]['value']);
$this->validateDates($response['body']['buildsTime']);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(21, count($response['body']));
$this->assertEquals($response['body']['range'], '30d');
$this->assertIsArray($response['body']['functions']);
$this->assertIsArray($response['body']['deployments']);
$this->assertIsArray($response['body']['deploymentsStorage']);
$this->assertIsArray($response['body']['builds']);
$this->assertIsArray($response['body']['buildsTime']);
$this->assertIsArray($response['body']['buildsMbSeconds']);
$this->assertIsArray($response['body']['executions']);
$this->assertIsArray($response['body']['executionsTime']);
$this->assertIsArray($response['body']['executionsMbSeconds']);
$this->assertEquals($executions, $response['body']['executions'][array_key_last($response['body']['executions'])]['value']);
$this->validateDates($response['body']['executions']);
$this->assertEquals($executionTime, $response['body']['executionsTime'][array_key_last($response['body']['executionsTime'])]['value']);
$this->validateDates($response['body']['executionsTime']);
$this->assertGreaterThan(0, $response['body']['buildsTime'][array_key_last($response['body']['buildsTime'])]['value']);
$this->validateDates($response['body']['buildsTime']);
});
return $data;
}
@@ -1862,10 +1862,11 @@ class AccountCustomClientTest extends Scope
'failure' => 'http://localhost/v1/mock/tests/general/oauth2/failure',
]);
$session = $response['cookies']['a_session_' . $this->getProject()['$id']];
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('success', $response['body']['result']);
$this->assertArrayHasKey('a_session_' . $this->getProject()['$id'], $response['cookies']);
$session = $response['cookies']['a_session_' . $this->getProject()['$id']];
$response = $this->client->call(Client::METHOD_GET, '/account', array_merge([
'origin' => 'http://localhost',
@@ -46,7 +46,7 @@ trait FunctionsBase
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
}, 50000, 500);
}, 120000, 1000);
return $deploymentId;
}
@@ -1926,7 +1926,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEmpty($execution['body']['logs']);
$this->assertEmpty($execution['body']['errors']);
}, 10000, 500);
}, 20000, 1000);
// Domain Executions test
$rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Storage;
use Appwrite\Tests\Async;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
@@ -16,6 +17,7 @@ class StorageCustomServerTest extends Scope
use StorageBase;
use ProjectCustom;
use SideServer;
use Async;
public function testCreateBucket(): array
{
@@ -286,18 +288,21 @@ class StorageCustomServerTest extends Scope
$this->assertEquals(204, $response['headers']['status-code']);
$this->assertEmpty($response['body']);
$response = $this->client->call(
Client::METHOD_GET,
'/storage/buckets/' . $id,
array_merge(
[
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
],
$this->getHeaders()
)
);
$this->assertEquals(404, $response['headers']['status-code']);
$this->assertEventually(function () use ($id) {
$response = $this->client->call(
Client::METHOD_GET,
'/storage/buckets/' . $id,
array_merge(
[
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
],
$this->getHeaders()
)
);
$this->assertEquals(404, $response['headers']['status-code']);
});
return $data;
}
+11 -5
View File
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Teams;
use Appwrite\Tests\Async;
use Tests\E2E\Client;
use Utopia\Database\Document;
use Utopia\Database\Helpers\ID;
@@ -10,6 +11,8 @@ use Utopia\Database\Validator\Datetime as DatetimeValidator;
trait TeamsBase
{
use Async;
public function testCreateTeam(): array
{
/**
@@ -379,12 +382,15 @@ trait TeamsBase
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_GET, '/teams/' . $teamUid, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEventually(function () use ($teamUid) {
$response = $this->client->call(Client::METHOD_GET, '/teams/' . $teamUid, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals(404, $response['headers']['status-code']);
});
$this->assertEquals(404, $response['headers']['status-code']);
return [];
}