From 55b34b581c957fc98f912943d94dcdc7079f191e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 8 Mar 2024 11:27:58 +0000 Subject: [PATCH 01/23] Introduce auth instance --- composer.json | 2 +- composer.lock | 78 ++++++++++++++++++-------------- src/Abuse/Adapters/TimeLimit.php | 15 +++--- 3 files changed, 55 insertions(+), 40 deletions(-) diff --git a/composer.json b/composer.json index 29d77f51d5..dc3e6c0cb1 100755 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php": ">=8.0", "ext-pdo": "*", "ext-curl": "*", - "utopia-php/database": "0.49.*" + "utopia-php/database": "dev-feat-framework-v2 as 0.49.99" }, "require-dev": { "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index 4179b93ab4..9c8ec72f89 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f78eeda391d225f378154fe10e288486", + "content-hash": "1b7e75223ec175933d427857707d8c4c", "packages": [ { "name": "jean85/pretty-package-versions", - "version": "2.0.5", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af" + "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/ae547e455a3d8babd07b96966b17d7fd21d9c6af", - "reference": "ae547e455a3d8babd07b96966b17d7fd21d9c6af", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/f9fdd29ad8e6d024f52678b570e5593759b550b4", + "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4", "shasum": "" }, "require": { @@ -25,9 +25,9 @@ "php": "^7.1|^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.17", + "friendsofphp/php-cs-fixer": "^3.2", "jean85/composer-provided-replaced-stub-package": "^1.0", - "phpstan/phpstan": "^0.12.66", + "phpstan/phpstan": "^1.4", "phpunit/phpunit": "^7.5|^8.5|^9.4", "vimeo/psalm": "^4.3" }, @@ -61,9 +61,9 @@ ], "support": { "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.5" + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.6" }, - "time": "2021-10-08T21:21:46+00:00" + "time": "2024-03-08T09:58:59+00:00" }, { "name": "mongodb/mongodb", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.49.1", + "version": "dev-feat-framework-v2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "4199fe8f00f4e181c7782c4a6862845d591c1f03" + "reference": "bdd9140e40c77faadb0cf2f5050b466c34eef673" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/4199fe8f00f4e181c7782c4a6862845d591c1f03", - "reference": "4199fe8f00f4e181c7782c4a6862845d591c1f03", + "url": "https://api.github.com/repos/utopia-php/database/zipball/bdd9140e40c77faadb0cf2f5050b466c34eef673", + "reference": "bdd9140e40c77faadb0cf2f5050b466c34eef673", "shasum": "" }, "require": { @@ -284,7 +284,7 @@ "php": ">=8.0", "utopia-php/cache": "0.9.*", "utopia-php/fetch": "0.1.*", - "utopia-php/framework": "0.33.*", + "utopia-php/framework": "0.34.*", "utopia-php/mongo": "0.3.*" }, "require-dev": { @@ -295,7 +295,7 @@ "phpunit/phpunit": "^9.4", "rregeer/phpunit-coverage-check": "^0.3.1", "swoole/ide-helper": "4.8.0", - "utopia-php/cli": "^0.14.0" + "utopia-php/cli": "0.17.*" }, "type": "library", "autoload": { @@ -317,9 +317,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.49.1" + "source": "https://github.com/utopia-php/database/tree/feat-framework-v2" }, - "time": "2024-03-06T11:35:53+00:00" + "time": "2024-03-07T16:55:44+00:00" }, { "name": "utopia-php/fetch", @@ -362,48 +362,51 @@ }, { "name": "utopia-php/framework", - "version": "0.33.2", + "version": "0.34.2", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "b1423ca3e3b61c6c4c2e619d2cb80672809a19f3" + "reference": "fd126c02b78cc80678c9638f7b335dfb4a841b78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/b1423ca3e3b61c6c4c2e619d2cb80672809a19f3", - "reference": "b1423ca3e3b61c6c4c2e619d2cb80672809a19f3", + "url": "https://api.github.com/repos/utopia-php/http/zipball/fd126c02b78cc80678c9638f7b335dfb4a841b78", + "reference": "fd126c02b78cc80678c9638f7b335dfb4a841b78", "shasum": "" }, "require": { + "ext-swoole": "*", "php": ">=8.0" }, "require-dev": { "laravel/pint": "^1.2", "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.25" + "phpunit/phpunit": "^9.5.25", + "swoole/ide-helper": "4.8.3" }, "type": "library", "autoload": { "psr-4": { - "Utopia\\": "src/" + "Utopia\\Http\\": "src/Http" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "A simple, light and advanced PHP framework", + "description": "A simple, light and advanced PHP HTTP framework", "keywords": [ "framework", + "http", "php", "upf" ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.2" + "source": "https://github.com/utopia-php/http/tree/0.34.2" }, - "time": "2024-01-31T10:35:59+00:00" + "time": "2024-02-20T11:36:56+00:00" }, { "name": "utopia-php/mongo", @@ -840,16 +843,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.59", + "version": "1.10.60", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e607609388d3a6d418a50a49f7940e8086798281" + "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", - "reference": "e607609388d3a6d418a50a49f7940e8086798281", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/95dcea7d6c628a3f2f56d091d8a0219485a86bbe", + "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe", "shasum": "" }, "require": { @@ -898,7 +901,7 @@ "type": "tidelift" } ], - "time": "2024-02-20T13:59:13+00:00" + "time": "2024-03-07T13:30:19+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2337,9 +2340,18 @@ "time": "2024-03-03T12:36:25+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-feat-framework-v2", + "alias": "0.49.99", + "alias_normalized": "0.49.99.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Abuse/Adapters/TimeLimit.php b/src/Abuse/Adapters/TimeLimit.php index 038f32c0db..4ce97ca9ab 100644 --- a/src/Abuse/Adapters/TimeLimit.php +++ b/src/Abuse/Adapters/TimeLimit.php @@ -48,14 +48,17 @@ class TimeLimit implements Adapter */ protected array $params = []; + protected Authorization $auth; + /** * @param string $key * @param int $seconds * @param int $limit * @param Database $db */ - public function __construct(string $key, int $limit, int $seconds, Database $db) + public function __construct(string $key, int $limit, int $seconds, Database $db, Authorization $auth) { + $this->auth = $auth; $this->key = $key; $time = (int) \date('U', (int) (\floor(\time() / $seconds)) * $seconds); // todo: any good Idea without time()? $this->time = DateTime::format((new \DateTime())->setTimestamp($time)); @@ -70,7 +73,7 @@ class TimeLimit implements Adapter public function setup(): void { if (! $this->db->exists($this->db->getDatabase())) { - throw new Exception('You need to create database before running timelimit setup'); + throw new \Exception('You need to create database before running timelimit setup'); } $attributes = [ @@ -191,7 +194,7 @@ class TimeLimit implements Adapter } /** @var array $result */ - $result = Authorization::skip(function () use ($key, $datetime) { + $result = $this->auth->skip(function () use ($key, $datetime) { return $this->db->find(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -223,7 +226,7 @@ class TimeLimit implements Adapter return; } - Authorization::skip(function () use ($datetime, $key) { + $this->auth->skip(function () use ($datetime, $key) { $data = $this->db->findOne(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -280,7 +283,7 @@ class TimeLimit implements Adapter public function getLogs(?int $offset = null, ?int $limit = 25): array { /** @var array $results */ - $results = Authorization::skip(function () use ($offset, $limit) { + $results = $this->auth->skip(function () use ($offset, $limit) { $queries = []; $queries[] = Query::orderDesc(''); @@ -307,7 +310,7 @@ class TimeLimit implements Adapter */ public function cleanup(string $datetime): bool { - Authorization::skip(function () use ($datetime) { + $this->auth->skip(function () use ($datetime) { do { $documents = $this->db->find(TimeLimit::COLLECTION, [ Query::lessThan('time', $datetime), From 36113abc0d4f98556b09cfba2af479b806672206 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 17 Apr 2024 16:38:33 +0300 Subject: [PATCH 02/23] composer.lock --- composer.lock | 53 +++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/composer.lock b/composer.lock index 9c8ec72f89..c0917024dc 100644 --- a/composer.lock +++ b/composer.lock @@ -216,16 +216,16 @@ }, { "name": "utopia-php/cache", - "version": "0.9.0", + "version": "0.9.1", "source": { "type": "git", "url": "https://github.com/utopia-php/cache.git", - "reference": "4fc7b4789b5f0ce74835c1ecfec4f3afe6f0e34e" + "reference": "552b4c554bb14d0c529631ce304cdf4a2b9d06a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cache/zipball/4fc7b4789b5f0ce74835c1ecfec4f3afe6f0e34e", - "reference": "4fc7b4789b5f0ce74835c1ecfec4f3afe6f0e34e", + "url": "https://api.github.com/repos/utopia-php/cache/zipball/552b4c554bb14d0c529631ce304cdf4a2b9d06a6", + "reference": "552b4c554bb14d0c529631ce304cdf4a2b9d06a6", "shasum": "" }, "require": { @@ -260,9 +260,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cache/issues", - "source": "https://github.com/utopia-php/cache/tree/0.9.0" + "source": "https://github.com/utopia-php/cache/tree/0.9.1" }, - "time": "2024-01-07T18:11:23+00:00" + "time": "2024-03-19T17:07:20+00:00" }, { "name": "utopia-php/database", @@ -843,16 +843,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.60", + "version": "1.10.67", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe" + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/95dcea7d6c628a3f2f56d091d8a0219485a86bbe", - "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", "shasum": "" }, "require": { @@ -895,13 +895,9 @@ { "url": "https://github.com/phpstan", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" } ], - "time": "2024-03-07T13:30:19+00:00" + "time": "2024-04-16T07:22:02+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1224,16 +1220,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.17", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -1307,7 +1303,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -1323,7 +1319,7 @@ "type": "tidelift" } ], - "time": "2024-02-23T13:14:51+00:00" + "time": "2024-04-05T04:35:58+00:00" }, { "name": "sebastian/cli-parser", @@ -2127,16 +2123,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -2148,7 +2144,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2169,8 +2165,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -2178,7 +2173,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", From 46f3177ce2f91a8c8468e42e18e0d3c16febb79d Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 17 Apr 2024 18:55:23 +0300 Subject: [PATCH 03/23] composer.lock --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index c0917024dc..54a78c576e 100644 --- a/composer.lock +++ b/composer.lock @@ -270,12 +270,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "bdd9140e40c77faadb0cf2f5050b466c34eef673" + "reference": "0645d8550cbcdb921d072b05f05b0f979442d94f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/bdd9140e40c77faadb0cf2f5050b466c34eef673", - "reference": "bdd9140e40c77faadb0cf2f5050b466c34eef673", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0645d8550cbcdb921d072b05f05b0f979442d94f", + "reference": "0645d8550cbcdb921d072b05f05b0f979442d94f", "shasum": "" }, "require": { @@ -319,7 +319,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/feat-framework-v2" }, - "time": "2024-03-07T16:55:44+00:00" + "time": "2024-04-17T14:28:28+00:00" }, { "name": "utopia-php/fetch", From 88f74c0726938769ea1ff82c77bd1213816c7c04 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 17 Apr 2024 19:32:58 +0300 Subject: [PATCH 04/23] auth test --- src/Abuse/Adapters/TimeLimit.php | 28 ++++++++++++++++++---------- tests/Abuse/AbuseTest.php | 6 ++++-- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/Abuse/Adapters/TimeLimit.php b/src/Abuse/Adapters/TimeLimit.php index 4ce97ca9ab..36d647806f 100644 --- a/src/Abuse/Adapters/TimeLimit.php +++ b/src/Abuse/Adapters/TimeLimit.php @@ -7,12 +7,12 @@ use Utopia\Abuse\Adapter; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Exception; use Utopia\Database\Exception\Authorization as AuthorizationException; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Structure; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; -use Utopia\Exception; class TimeLimit implements Adapter { @@ -51,10 +51,11 @@ class TimeLimit implements Adapter protected Authorization $auth; /** - * @param string $key - * @param int $seconds - * @param int $limit - * @param Database $db + * @param string $key + * @param int $limit + * @param int $seconds + * @param Database $db + * @param Authorization $auth */ public function __construct(string $key, int $limit, int $seconds, Database $db, Authorization $auth) { @@ -68,12 +69,12 @@ class TimeLimit implements Adapter /** * @throws Duplicate - * @throws Exception|\Exception + * @throws Exception */ public function setup(): void { if (! $this->db->exists($this->db->getDatabase())) { - throw new \Exception('You need to create database before running timelimit setup'); + throw new Exception('You need to create database before running timelimit setup'); } $attributes = [ @@ -194,6 +195,14 @@ class TimeLimit implements Adapter } /** @var array $result */ + + /** + * todo: why we are using + * $this->auth->skip + * and not ? + * $this->db->getAuthorization()->skip + */ + $result = $this->auth->skip(function () use ($key, $datetime) { return $this->db->find(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), @@ -250,7 +259,7 @@ class TimeLimit implements Adapter Query::equal('time', [$datetime]), ]); - if ($data !== false && $data instanceof Document) { + if ($data instanceof Document) { $count = $data->getAttribute('count', 0); if (\is_numeric($count)) { $this->count = intval($count); @@ -261,7 +270,6 @@ class TimeLimit implements Adapter } } } else { - /** @var Document $data */ $this->db->increaseDocumentAttribute(TimeLimit::COLLECTION, $data->getId(), 'count'); } }); @@ -332,7 +340,7 @@ class TimeLimit implements Adapter * * @return bool * - * @throws \Exception|Throwable + * @throws Throwable */ public function check(): bool { diff --git a/tests/Abuse/AbuseTest.php b/tests/Abuse/AbuseTest.php index 755b6e6d67..7f02ab90e9 100755 --- a/tests/Abuse/AbuseTest.php +++ b/tests/Abuse/AbuseTest.php @@ -12,7 +12,8 @@ use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; use Utopia\Database\DateTime; -use Utopia\Exception; +use Utopia\Database\Exception; +use Utopia\Database\Validator\Authorization; class AbuseTest extends TestCase { @@ -39,9 +40,10 @@ class AbuseTest extends TestCase $db = new Database(new MySQL($pdo), new Cache(new NoCache())); $db->setDatabase('utopiaTests'); $db->setNamespace('namespace'); + $db->setAuthorization(new Authorization()); $this->db = $db; - $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db); + $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db, new Authorization()); if (! $db->exists('utopiaTests')) { $db->create(); $adapter->setup(); From 7cd611bbf82115dd53805b36424a8c0b96c1f13d Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 17 Apr 2024 19:43:34 +0300 Subject: [PATCH 05/23] Question --- src/Abuse/Adapters/TimeLimit.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Abuse/Adapters/TimeLimit.php b/src/Abuse/Adapters/TimeLimit.php index 36d647806f..63ef629430 100644 --- a/src/Abuse/Adapters/TimeLimit.php +++ b/src/Abuse/Adapters/TimeLimit.php @@ -201,6 +201,7 @@ class TimeLimit implements Adapter * $this->auth->skip * and not ? * $this->db->getAuthorization()->skip + * are they different objects? */ $result = $this->auth->skip(function () use ($key, $datetime) { From a58454e367a827285415092e7e393559025f3faf Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 17 Apr 2024 20:05:33 +0300 Subject: [PATCH 06/23] Add objects --- tests/Abuse/AbuseTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/Abuse/AbuseTest.php b/tests/Abuse/AbuseTest.php index 7f02ab90e9..0f5c384cb2 100755 --- a/tests/Abuse/AbuseTest.php +++ b/tests/Abuse/AbuseTest.php @@ -22,6 +22,7 @@ class AbuseTest extends TestCase protected Abuse $abuseIp; protected Database $db; + protected Authorization $authorization; /** * @throws Exception @@ -40,10 +41,13 @@ class AbuseTest extends TestCase $db = new Database(new MySQL($pdo), new Cache(new NoCache())); $db->setDatabase('utopiaTests'); $db->setNamespace('namespace'); - $db->setAuthorization(new Authorization()); + + $this->authorization = new Authorization(); + $db->setAuthorization($this->authorization); $this->db = $db; - $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db, new Authorization()); + // todo do I need to pass a new $auth ? or can I use the one from DB? + $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db, $this->authorization); if (! $db->exists('utopiaTests')) { $db->create(); $adapter->setup(); @@ -63,7 +67,7 @@ class AbuseTest extends TestCase $key = '{{ip}}'; $value = '0.0.0.10'; - $adapter = new TimeLimit($key, 1, 1, $this->db); + $adapter = new TimeLimit($key, 1, 1, $this->db, new Authorization()); $adapter->setParam($key, $value); $this->abuseIp = new Abuse($adapter); $this->assertEquals($this->abuseIp->check(), false); @@ -71,7 +75,7 @@ class AbuseTest extends TestCase sleep(1); - $adapter = new TimeLimit($key, 1, 1, $this->db); + $adapter = new TimeLimit($key, 1, 1, $this->db, new Authorization()); $adapter->setParam($key, $value); $this->abuseIp = new Abuse($adapter); From db3dbb5603c62e1e8f87480e77f9b66553bed43a Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 17 Apr 2024 20:08:09 +0300 Subject: [PATCH 07/23] Question --- tests/Abuse/AbuseTest.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/Abuse/AbuseTest.php b/tests/Abuse/AbuseTest.php index 0f5c384cb2..31f149dce3 100755 --- a/tests/Abuse/AbuseTest.php +++ b/tests/Abuse/AbuseTest.php @@ -22,7 +22,6 @@ class AbuseTest extends TestCase protected Abuse $abuseIp; protected Database $db; - protected Authorization $authorization; /** * @throws Exception @@ -42,12 +41,12 @@ class AbuseTest extends TestCase $db->setDatabase('utopiaTests'); $db->setNamespace('namespace'); - $this->authorization = new Authorization(); - $db->setAuthorization($this->authorization); + $auth = new Authorization(); + $db->setAuthorization($auth); $this->db = $db; - // todo do I need to pass a new $auth ? or can I use the one from DB? - $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db, $this->authorization); + // todo: Should I create a new Authorization() or can I use $auth from the db? + $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db, $auth); if (! $db->exists('utopiaTests')) { $db->create(); $adapter->setup(); From 70a3a0a9aa6dfea5562be88d0f2e16a92e4e95ac Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 18 Apr 2024 16:07:17 +0300 Subject: [PATCH 08/23] Use db auth --- composer.lock | 8 ++++---- src/Abuse/Adapters/TimeLimit.php | 22 +++++----------------- tests/Abuse/AbuseTest.php | 4 ++-- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/composer.lock b/composer.lock index 54a78c576e..db03c55975 100644 --- a/composer.lock +++ b/composer.lock @@ -270,12 +270,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "0645d8550cbcdb921d072b05f05b0f979442d94f" + "reference": "6b8264a4e269d679182fc376179281b7108a4242" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/0645d8550cbcdb921d072b05f05b0f979442d94f", - "reference": "0645d8550cbcdb921d072b05f05b0f979442d94f", + "url": "https://api.github.com/repos/utopia-php/database/zipball/6b8264a4e269d679182fc376179281b7108a4242", + "reference": "6b8264a4e269d679182fc376179281b7108a4242", "shasum": "" }, "require": { @@ -319,7 +319,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/feat-framework-v2" }, - "time": "2024-04-17T14:28:28+00:00" + "time": "2024-04-18T12:50:22+00:00" }, { "name": "utopia-php/fetch", diff --git a/src/Abuse/Adapters/TimeLimit.php b/src/Abuse/Adapters/TimeLimit.php index 63ef629430..b01d4b7853 100644 --- a/src/Abuse/Adapters/TimeLimit.php +++ b/src/Abuse/Adapters/TimeLimit.php @@ -48,18 +48,14 @@ class TimeLimit implements Adapter */ protected array $params = []; - protected Authorization $auth; - /** * @param string $key * @param int $limit * @param int $seconds * @param Database $db - * @param Authorization $auth */ - public function __construct(string $key, int $limit, int $seconds, Database $db, Authorization $auth) + public function __construct(string $key, int $limit, int $seconds, Database $db) { - $this->auth = $auth; $this->key = $key; $time = (int) \date('U', (int) (\floor(\time() / $seconds)) * $seconds); // todo: any good Idea without time()? $this->time = DateTime::format((new \DateTime())->setTimestamp($time)); @@ -196,15 +192,7 @@ class TimeLimit implements Adapter /** @var array $result */ - /** - * todo: why we are using - * $this->auth->skip - * and not ? - * $this->db->getAuthorization()->skip - * are they different objects? - */ - - $result = $this->auth->skip(function () use ($key, $datetime) { + $result = $this->db->getAuthorization()->skip(function () use ($key, $datetime) { return $this->db->find(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -236,7 +224,7 @@ class TimeLimit implements Adapter return; } - $this->auth->skip(function () use ($datetime, $key) { + $this->db->getAuthorization()->skip(function () use ($datetime, $key) { $data = $this->db->findOne(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -292,7 +280,7 @@ class TimeLimit implements Adapter public function getLogs(?int $offset = null, ?int $limit = 25): array { /** @var array $results */ - $results = $this->auth->skip(function () use ($offset, $limit) { + $results = $this->db->getAuthorization()->skip(function () use ($offset, $limit) { $queries = []; $queries[] = Query::orderDesc(''); @@ -319,7 +307,7 @@ class TimeLimit implements Adapter */ public function cleanup(string $datetime): bool { - $this->auth->skip(function () use ($datetime) { + $this->db->getAuthorization()->skip(function () use ($datetime) { do { $documents = $this->db->find(TimeLimit::COLLECTION, [ Query::lessThan('time', $datetime), diff --git a/tests/Abuse/AbuseTest.php b/tests/Abuse/AbuseTest.php index 31f149dce3..0497311e5e 100755 --- a/tests/Abuse/AbuseTest.php +++ b/tests/Abuse/AbuseTest.php @@ -66,7 +66,7 @@ class AbuseTest extends TestCase $key = '{{ip}}'; $value = '0.0.0.10'; - $adapter = new TimeLimit($key, 1, 1, $this->db, new Authorization()); + $adapter = new TimeLimit($key, 1, 1, $this->db); $adapter->setParam($key, $value); $this->abuseIp = new Abuse($adapter); $this->assertEquals($this->abuseIp->check(), false); @@ -74,7 +74,7 @@ class AbuseTest extends TestCase sleep(1); - $adapter = new TimeLimit($key, 1, 1, $this->db, new Authorization()); + $adapter = new TimeLimit($key, 1, 1, $this->db); $adapter->setParam($key, $value); $this->abuseIp = new Abuse($adapter); From 56e67231ed156a27fcd605eb2a4a890ee2342fa1 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 18 Apr 2024 17:38:55 +0300 Subject: [PATCH 09/23] setAuthorization --- tests/Abuse/AbuseTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/Abuse/AbuseTest.php b/tests/Abuse/AbuseTest.php index 0497311e5e..2247a15ca0 100755 --- a/tests/Abuse/AbuseTest.php +++ b/tests/Abuse/AbuseTest.php @@ -40,13 +40,10 @@ class AbuseTest extends TestCase $db = new Database(new MySQL($pdo), new Cache(new NoCache())); $db->setDatabase('utopiaTests'); $db->setNamespace('namespace'); - - $auth = new Authorization(); - $db->setAuthorization($auth); + $db->setAuthorization(new Authorization()); $this->db = $db; - // todo: Should I create a new Authorization() or can I use $auth from the db? - $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db, $auth); + $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db); if (! $db->exists('utopiaTests')) { $db->create(); $adapter->setup(); From fffd9c0a4d1f0d0b8f5730a5523c91c75977a0dc Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 18 Apr 2024 17:55:04 +0300 Subject: [PATCH 10/23] remove setAuthorization --- tests/Abuse/AbuseTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Abuse/AbuseTest.php b/tests/Abuse/AbuseTest.php index 2247a15ca0..26fbd3d47a 100755 --- a/tests/Abuse/AbuseTest.php +++ b/tests/Abuse/AbuseTest.php @@ -40,7 +40,6 @@ class AbuseTest extends TestCase $db = new Database(new MySQL($pdo), new Cache(new NoCache())); $db->setDatabase('utopiaTests'); $db->setNamespace('namespace'); - $db->setAuthorization(new Authorization()); $this->db = $db; $adapter = new TimeLimit('login-attempt-from-{{ip}}', 3, 60 * 5, $db); From a2292d71da901ea13129d56f89876626ba92adf0 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 18 Apr 2024 20:04:17 +0300 Subject: [PATCH 11/23] Formatting --- src/Abuse/Adapters/TimeLimit.php | 1 - tests/Abuse/AbuseTest.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Abuse/Adapters/TimeLimit.php b/src/Abuse/Adapters/TimeLimit.php index b01d4b7853..1308f09f62 100644 --- a/src/Abuse/Adapters/TimeLimit.php +++ b/src/Abuse/Adapters/TimeLimit.php @@ -12,7 +12,6 @@ use Utopia\Database\Exception\Authorization as AuthorizationException; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Structure; use Utopia\Database\Query; -use Utopia\Database\Validator\Authorization; class TimeLimit implements Adapter { diff --git a/tests/Abuse/AbuseTest.php b/tests/Abuse/AbuseTest.php index 26fbd3d47a..5f6048de40 100755 --- a/tests/Abuse/AbuseTest.php +++ b/tests/Abuse/AbuseTest.php @@ -13,7 +13,6 @@ use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Exception; -use Utopia\Database\Validator\Authorization; class AbuseTest extends TestCase { From b3105b361311d601069697c7691517d70f1bd32d Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:13:52 -0400 Subject: [PATCH 12/23] chore: merge --- composer.lock | 170 +++++++++++++++------------- src/Abuse/Adapters/Database.php | 77 ++++++++++++- tests/Abuse/Bench/DatabaseBench.php | 2 +- tests/Abuse/DatabaseTest.php | 2 +- tests/Abuse/RedisTest.php | 2 +- 5 files changed, 166 insertions(+), 87 deletions(-) diff --git a/composer.lock b/composer.lock index e2fb9e98a5..d6512ad546 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": "1e53afffe12ae95f750f420f449e4c19", + "content-hash": "9a0fc06bf721ea900f18ce30dc40b628", "packages": [ { "name": "jean85/pretty-package-versions", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.50.0", + "version": "dev-feat-framework-v2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "ce3eaccb2f3bbd34b2b97419836fec633b26b8f7" + "reference": "5b0d6ba40141dd9d4983d3aac018782f8ecdfc8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/ce3eaccb2f3bbd34b2b97419836fec633b26b8f7", - "reference": "ce3eaccb2f3bbd34b2b97419836fec633b26b8f7", + "url": "https://api.github.com/repos/utopia-php/database/zipball/5b0d6ba40141dd9d4983d3aac018782f8ecdfc8a", + "reference": "5b0d6ba40141dd9d4983d3aac018782f8ecdfc8a", "shasum": "" }, "require": { @@ -283,7 +283,7 @@ "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.10.*", - "utopia-php/framework": "0.33.*", + "utopia-php/framework": "0.34.*", "utopia-php/mongo": "0.3.*" }, "require-dev": { @@ -294,7 +294,7 @@ "phpunit/phpunit": "^9.4", "rregeer/phpunit-coverage-check": "^0.3.1", "swoole/ide-helper": "4.8.0", - "utopia-php/cli": "^0.14.0" + "utopia-php/cli": "0.17.*" }, "type": "library", "autoload": { @@ -316,54 +316,58 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.50.0" + "source": "https://github.com/utopia-php/database/tree/feat-framework-v2" }, - "time": "2024-06-21T03:21:42+00:00" + "time": "2024-06-06T00:07:47+00:00" }, { "name": "utopia-php/framework", - "version": "0.33.6", + "version": "0.34.3", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "8fe57da0cecd57e3b17cd395b4a666a24f4c07a6" + "reference": "e3bbca07c1df4e908ea9d3ce4f59367a7696b66b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/8fe57da0cecd57e3b17cd395b4a666a24f4c07a6", - "reference": "8fe57da0cecd57e3b17cd395b4a666a24f4c07a6", + "url": "https://api.github.com/repos/utopia-php/http/zipball/e3bbca07c1df4e908ea9d3ce4f59367a7696b66b", + "reference": "e3bbca07c1df4e908ea9d3ce4f59367a7696b66b", "shasum": "" }, "require": { + "ext-swoole": "*", "php": ">=8.0" }, "require-dev": { "laravel/pint": "^1.2", "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.25" + "phpunit/phpunit": "^9.5.25", + "swoole/ide-helper": "4.8.3" }, "type": "library", "autoload": { "psr-4": { - "Utopia\\": "src/" + "Utopia\\": "src/", + "Tests\\E2E\\": "tests/e2e" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "A simple, light and advanced PHP framework", + "description": "A simple, light and advanced PHP HTTP framework", "keywords": [ "framework", + "http", "php", "upf" ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.6" + "source": "https://github.com/utopia-php/http/tree/0.34.3" }, - "time": "2024-03-21T18:10:57+00:00" + "time": "2024-07-02T15:08:46+00:00" }, { "name": "utopia-php/mongo", @@ -778,16 +782,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -798,7 +802,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -830,9 +834,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "phar-io/manifest", @@ -1056,16 +1060,16 @@ }, { "name": "phpbench/phpbench", - "version": "1.2.15", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/phpbench/phpbench.git", - "reference": "f7000319695cfad04a57fc64bf7ef7abdf4c437c" + "reference": "a3e1ef08d9d7736d43a7fbd444893d6a073c0ca0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpbench/phpbench/zipball/f7000319695cfad04a57fc64bf7ef7abdf4c437c", - "reference": "f7000319695cfad04a57fc64bf7ef7abdf4c437c", + "url": "https://api.github.com/repos/phpbench/phpbench/zipball/a3e1ef08d9d7736d43a7fbd444893d6a073c0ca0", + "reference": "a3e1ef08d9d7736d43a7fbd444893d6a073c0ca0", "shasum": "" }, "require": { @@ -1077,29 +1081,30 @@ "ext-spl": "*", "ext-tokenizer": "*", "php": "^8.1", - "phpbench/container": "^2.1", + "phpbench/container": "^2.2", "phpbench/dom": "~0.3.3", "psr/log": "^1.1 || ^2.0 || ^3.0", "seld/jsonlint": "^1.1", - "symfony/console": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/filesystem": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/finder": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/options-resolver": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/process": "^4.2 || ^5.0 || ^6.0 || ^7.0", + "symfony/console": "^6.1 || ^7.0", + "symfony/filesystem": "^6.1 || ^7.0", + "symfony/finder": "^6.1 || ^7.0", + "symfony/options-resolver": "^6.1 || ^7.0", + "symfony/process": "^6.1 || ^7.0", "webmozart/glob": "^4.6" }, "require-dev": { "dantleech/invoke": "^2.0", + "ergebnis/composer-normalize": "^2.39", "friendsofphp/php-cs-fixer": "^3.0", "jangregor/phpstan-prophecy": "^1.0", "phpspec/prophecy": "dev-master", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^10.0", - "rector/rector": "^0.18.10", - "symfony/error-handler": "^5.2 || ^6.0 || ^7.0", - "symfony/var-dumper": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^10.4", + "rector/rector": "^0.18.11 || ^1.0.0", + "symfony/error-handler": "^6.1 || ^7.0", + "symfony/var-dumper": "^6.1 || ^7.0" }, "suggest": { "ext-xdebug": "For Xdebug profiling extension." @@ -1142,7 +1147,7 @@ ], "support": { "issues": "https://github.com/phpbench/phpbench/issues", - "source": "https://github.com/phpbench/phpbench/tree/1.2.15" + "source": "https://github.com/phpbench/phpbench/tree/1.3.1" }, "funding": [ { @@ -1150,20 +1155,20 @@ "type": "github" } ], - "time": "2023-11-29T12:21:11+00:00" + "time": "2024-06-30T11:04:37+00:00" }, { "name": "phpstan/phpstan", - "version": "1.11.5", + "version": "1.11.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443" + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d", + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d", "shasum": "" }, "require": { @@ -1208,7 +1213,7 @@ "type": "github" } ], - "time": "2024-06-17T15:10:54+00:00" + "time": "2024-07-06T11:17:41+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1531,45 +1536,45 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.19", + "version": "9.6.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" + "reference": "49d7820565836236411f5dc002d16dd689cde42f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", + "reference": "49d7820565836236411f5dc002d16dd689cde42f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -1614,7 +1619,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" }, "funding": [ { @@ -1630,7 +1635,7 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:35:58+00:00" + "time": "2024-07-10T11:45:39+00:00" }, { "name": "psr/cache", @@ -2749,23 +2754,23 @@ }, { "name": "seld/jsonlint", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259" + "reference": "1748aaf847fc731cfad7725aec413ee46f0cc3a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9bb7db07b5d66d90f6ebf542f09fc67d800e5259", - "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/1748aaf847fc731cfad7725aec413ee46f0cc3a2", + "reference": "1748aaf847fc731cfad7725aec413ee46f0cc3a2", "shasum": "" }, "require": { "php": "^5.3 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.5", + "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13" }, "bin": [ @@ -2797,7 +2802,7 @@ ], "support": { "issues": "https://github.com/Seldaek/jsonlint/issues", - "source": "https://github.com/Seldaek/jsonlint/tree/1.10.2" + "source": "https://github.com/Seldaek/jsonlint/tree/1.11.0" }, "funding": [ { @@ -2809,7 +2814,7 @@ "type": "tidelift" } ], - "time": "2024-02-07T12:57:50+00:00" + "time": "2024-07-11T14:55:45+00:00" }, { "name": "symfony/console", @@ -3817,9 +3822,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-feat-framework-v2", + "alias": "0.49.99", + "alias_normalized": "0.49.99.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Abuse/Adapters/Database.php b/src/Abuse/Adapters/Database.php index 534ee49904..b4c8a8be14 100644 --- a/src/Abuse/Adapters/Database.php +++ b/src/Abuse/Adapters/Database.php @@ -9,8 +9,7 @@ use Utopia\Database\Exception\Authorization as AuthorizationException; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Structure; use Utopia\Database\Query; -use Utopia\Database\Validator\Authorization; -use Utopia\Exception; +use Utopia\Http\Exception; class Database extends TimeLimit { @@ -127,7 +126,7 @@ class Database extends TimeLimit } /** @var array $result */ - $result = Authorization::skip(function () use ($key, $datetime) { + $result = $this->db->getAuthorization()->skip(function () use ($key, $datetime) { return $this->db->find(Database::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -159,7 +158,7 @@ class Database extends TimeLimit return; } - Authorization::skip(function () use ($datetime, $key) { + $this->db->getAuthorization()->skip(function () use ($datetime, $key) { $data = $this->db->findOne(Database::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -216,7 +215,7 @@ class Database extends TimeLimit public function getLogs(?int $offset = null, ?int $limit = 25): array { /** @var array $results */ - $results = Authorization::skip(function () use ($offset, $limit) { + $results = $this->db->getAuthorization()->skip(function () use ($offset, $limit) { $queries = []; $queries[] = Query::orderDesc(''); @@ -243,7 +242,7 @@ class Database extends TimeLimit */ public function cleanup(string $datetime): bool { - Authorization::skip(function () use ($datetime) { + $this->db->getAuthorization()->skip(function () use ($datetime) { do { $documents = $this->db->find(Database::COLLECTION, [ Query::lessThan('time', $datetime), @@ -257,4 +256,70 @@ class Database extends TimeLimit return true; } + + /** + * Check + * + * Checks if number of counts is bigger or smaller than current limit. limit 0 is equal to unlimited + * + * @return bool + * + * @throws \Throwable + */ + public function check(): bool + { + if (0 == $this->limit) { + return false; + } + + $key = $this->parseKey(); + + if ($this->limit > $this->count($key, $this->time)) { + $this->hit($key, $this->time); + + return false; + } + + return true; + } + + /** + * Remaining + * + * Returns the number of current remaining counts + * + * @return int + * + * @throws \Exception + */ + public function remaining(): int + { + $left = $this->limit - ($this->count($this->parseKey(), $this->time) + 1); // Add one because we need to say how many left not how many done + + return (0 > $left) ? 0 : $left; + } + + /** + * Limit + * + * Return the limit integer + * + * @return int + */ + public function limit(): int + { + return $this->limit; + } + + /** + * Time + * + * Return the Datetime + * + * @return string + */ + public function time(): string + { + return $this->time; + } } diff --git a/tests/Abuse/Bench/DatabaseBench.php b/tests/Abuse/Bench/DatabaseBench.php index fcba9517fd..833d25396c 100644 --- a/tests/Abuse/Bench/DatabaseBench.php +++ b/tests/Abuse/Bench/DatabaseBench.php @@ -10,7 +10,7 @@ use Utopia\Cache\Cache; use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; -use Utopia\Exception; +use Utopia\Http\Exception; class DatabaseBench extends Base { diff --git a/tests/Abuse/DatabaseTest.php b/tests/Abuse/DatabaseTest.php index 5927d0f72f..7def059f89 100755 --- a/tests/Abuse/DatabaseTest.php +++ b/tests/Abuse/DatabaseTest.php @@ -12,7 +12,7 @@ use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; use Utopia\Database\DateTime; -use Utopia\Exception; +use Utopia\Http\Exception; class DatabaseTest extends Base { diff --git a/tests/Abuse/RedisTest.php b/tests/Abuse/RedisTest.php index b29b568085..4f938635dc 100644 --- a/tests/Abuse/RedisTest.php +++ b/tests/Abuse/RedisTest.php @@ -7,7 +7,7 @@ use Utopia\Abuse\Adapter; use Utopia\Abuse\Abuse; use Utopia\Abuse\Adapters\Redis; use Redis as Client; -use Utopia\Exception; +use Utopia\Http\Exception; class RedisTest extends Base { From 4f49bbba8235dc2ed8220482e1e1b46f1e4598df Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:35:18 -0400 Subject: [PATCH 13/23] chore: updating to latest database --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 593015fe28..1a9f23284d 100755 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-pdo": "*", "ext-curl": "*", "ext-redis": "*", - "utopia-php/database": "dev-feat-framework-v2 as 0.49.99" + "utopia-php/database": "0.51.*" }, "require-dev": { "phpunit/phpunit": "^9.4", From 7ff88da05716acb20a2ca479635a677c40e8ca1c Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:49:58 -0400 Subject: [PATCH 14/23] chore: updating to the latest database --- composer.json | 4 +- composer.lock | 213 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 155 insertions(+), 62 deletions(-) diff --git a/composer.json b/composer.json index 1a9f23284d..8842ebb964 100755 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "library", "keywords": ["php","framework", "upf", "utopia", "abuse"], "license": "MIT", - "minimum-stability": "stable", + "minimum-stability": "RC", "autoload": { "psr-4": {"Utopia\\Abuse\\": "src/Abuse"} }, @@ -22,7 +22,7 @@ "ext-pdo": "*", "ext-curl": "*", "ext-redis": "*", - "utopia-php/database": "0.51.*" + "utopia-php/database": "1.0.*" }, "require-dev": { "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index d6512ad546..26b23d6fb6 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": "9a0fc06bf721ea900f18ce30dc40b628", + "content-hash": "e6a6611ef5abc949f69ba822126ffd75", "packages": [ { "name": "jean85/pretty-package-versions", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "dev-feat-framework-v2", + "version": "1.0.0-RC1", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "5b0d6ba40141dd9d4983d3aac018782f8ecdfc8a" + "reference": "36720e88125e3c16fb770bf2422a757fcec68050" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/5b0d6ba40141dd9d4983d3aac018782f8ecdfc8a", - "reference": "5b0d6ba40141dd9d4983d3aac018782f8ecdfc8a", + "url": "https://api.github.com/repos/utopia-php/database/zipball/36720e88125e3c16fb770bf2422a757fcec68050", + "reference": "36720e88125e3c16fb770bf2422a757fcec68050", "shasum": "" }, "require": { @@ -283,7 +283,7 @@ "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.10.*", - "utopia-php/framework": "0.34.*", + "utopia-php/framework": "1.0.*", "utopia-php/mongo": "0.3.*" }, "require-dev": { @@ -294,7 +294,7 @@ "phpunit/phpunit": "^9.4", "rregeer/phpunit-coverage-check": "^0.3.1", "swoole/ide-helper": "4.8.0", - "utopia-php/cli": "0.17.*" + "utopia-php/cli": "1.0.*" }, "type": "library", "autoload": { @@ -316,27 +316,26 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/feat-framework-v2" + "source": "https://github.com/utopia-php/database/tree/1.0.0-RC1" }, - "time": "2024-06-06T00:07:47+00:00" + "time": "2024-08-09T17:41:07+00:00" }, { - "name": "utopia-php/framework", - "version": "0.34.3", + "name": "utopia-php/di", + "version": "0.1.0", "source": { "type": "git", - "url": "https://github.com/utopia-php/http.git", - "reference": "e3bbca07c1df4e908ea9d3ce4f59367a7696b66b" + "url": "https://github.com/utopia-php/di.git", + "reference": "22490c95f7ac3898ed1c33f1b1b5dd577305ee31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/e3bbca07c1df4e908ea9d3ce4f59367a7696b66b", - "reference": "e3bbca07c1df4e908ea9d3ce4f59367a7696b66b", + "url": "https://api.github.com/repos/utopia-php/di/zipball/22490c95f7ac3898ed1c33f1b1b5dd577305ee31", + "reference": "22490c95f7ac3898ed1c33f1b1b5dd577305ee31", "shasum": "" }, "require": { - "ext-swoole": "*", - "php": ">=8.0" + "php": ">=8.2" }, "require-dev": { "laravel/pint": "^1.2", @@ -356,6 +355,56 @@ "license": [ "MIT" ], + "description": "A simple and lite library for managing dependency injections", + "keywords": [ + "framework", + "http", + "php", + "upf" + ], + "support": { + "issues": "https://github.com/utopia-php/di/issues", + "source": "https://github.com/utopia-php/di/tree/0.1.0" + }, + "time": "2024-08-08T14:35:19+00:00" + }, + { + "name": "utopia-php/framework", + "version": "1.0.0-RC2", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/http.git", + "reference": "d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/http/zipball/d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7", + "reference": "d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7", + "shasum": "" + }, + "require": { + "ext-swoole": "*", + "php": ">=8.0", + "utopia-php/servers": "0.1.* " + }, + "require-dev": { + "ext-xdebug": "*", + "laravel/pint": "^1.2", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5.25", + "swoole/ide-helper": "4.8.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], "description": "A simple, light and advanced PHP HTTP framework", "keywords": [ "framework", @@ -365,9 +414,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.34.3" + "source": "https://github.com/utopia-php/http/tree/1.0.0-RC2" }, - "time": "2024-07-02T15:08:46+00:00" + "time": "2024-08-08T14:46:41+00:00" }, { "name": "utopia-php/mongo", @@ -428,6 +477,59 @@ "source": "https://github.com/utopia-php/mongo/tree/0.3.1" }, "time": "2023-09-01T17:25:28+00:00" + }, + { + "name": "utopia-php/servers", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/servers.git", + "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", + "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "utopia-php/di": "0.1.*" + }, + "require-dev": { + "laravel/pint": "^0.2.3", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Servers\\": "src/Servers" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Team Appwrite", + "email": "team@appwrite.io" + } + ], + "description": "A base library for building Utopia style servers.", + "keywords": [ + "framework", + "php", + "servers", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/servers/issues", + "source": "https://github.com/utopia-php/servers/tree/0.1.0" + }, + "time": "2024-08-08T14:31:39+00:00" } ], "packages-dev": [ @@ -1159,16 +1261,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.7", + "version": "1.11.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d" + "reference": "640410b32995914bde3eed26fa89552f9c2c082f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d", - "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/640410b32995914bde3eed26fa89552f9c2c082f", + "reference": "640410b32995914bde3eed26fa89552f9c2c082f", "shasum": "" }, "require": { @@ -1213,7 +1315,7 @@ "type": "github" } ], - "time": "2024-07-06T11:17:41+00:00" + "time": "2024-08-08T09:02:50+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2818,16 +2920,16 @@ }, { "name": "symfony/console", - "version": "v7.1.2", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", + "url": "https://api.github.com/repos/symfony/console/zipball/cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", "shasum": "" }, "require": { @@ -2891,7 +2993,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.2" + "source": "https://github.com/symfony/console/tree/v7.1.3" }, "funding": [ { @@ -2907,7 +3009,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-07-26T12:41:01+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3044,16 +3146,16 @@ }, { "name": "symfony/finder", - "version": "v7.1.1", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6" + "reference": "717c6329886f32dc65e27461f80f2a465412fdca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/fbb0ba67688b780efbc886c1a0a0948dcf7205d6", - "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6", + "url": "https://api.github.com/repos/symfony/finder/zipball/717c6329886f32dc65e27461f80f2a465412fdca", + "reference": "717c6329886f32dc65e27461f80f2a465412fdca", "shasum": "" }, "require": { @@ -3088,7 +3190,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.1" + "source": "https://github.com/symfony/finder/tree/v7.1.3" }, "funding": [ { @@ -3104,7 +3206,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-07-24T07:08:44+00:00" }, { "name": "symfony/options-resolver", @@ -3493,16 +3595,16 @@ }, { "name": "symfony/process", - "version": "v7.1.1", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "febf90124323a093c7ee06fdb30e765ca3c20028" + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/febf90124323a093c7ee06fdb30e765ca3c20028", - "reference": "febf90124323a093c7ee06fdb30e765ca3c20028", + "url": "https://api.github.com/repos/symfony/process/zipball/7f2f542c668ad6c313dc4a5e9c3321f733197eca", + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca", "shasum": "" }, "require": { @@ -3534,7 +3636,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.1" + "source": "https://github.com/symfony/process/tree/v7.1.3" }, "funding": [ { @@ -3550,7 +3652,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-07-26T12:44:47+00:00" }, { "name": "symfony/service-contracts", @@ -3637,16 +3739,16 @@ }, { "name": "symfony/string", - "version": "v7.1.2", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", + "url": "https://api.github.com/repos/symfony/string/zipball/ea272a882be7f20cad58d5d78c215001617b7f07", + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07", "shasum": "" }, "require": { @@ -3704,7 +3806,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.2" + "source": "https://github.com/symfony/string/tree/v7.1.3" }, "funding": [ { @@ -3720,7 +3822,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:27:18+00:00" + "time": "2024-07-22T10:25:37+00:00" }, { "name": "theseer/tokenizer", @@ -3822,18 +3924,9 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [ - { - "package": "utopia-php/database", - "version": "dev-feat-framework-v2", - "alias": "0.49.99", - "alias_normalized": "0.49.99.0" - } - ], - "minimum-stability": "stable", - "stability-flags": { - "utopia-php/database": 20 - }, + "aliases": [], + "minimum-stability": "RC", + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 0059ae5daec97edd85276bb5c7eb501484b79ad5 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:14:29 -0400 Subject: [PATCH 15/23] chore: merge, lint --- composer.lock | 194 +++++++++++++++++----- src/Abuse/Adapters/Database/TimeLimit.php | 4 +- 2 files changed, 152 insertions(+), 46 deletions(-) diff --git a/composer.lock b/composer.lock index 152575410f..03a120a02e 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": "6522b9fb8652f6801bd7c5664430c672", + "content-hash": "e6a6611ef5abc949f69ba822126ffd75", "packages": [ { "name": "jean85/pretty-package-versions", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.53.0", + "version": "1.0.0-RC2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "2e116d544b14e8b2edfcb5b793d214136ff64f42" + "reference": "d70eb76c7cf5ee596752209a4d57e4d08fe8a986" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/2e116d544b14e8b2edfcb5b793d214136ff64f42", - "reference": "2e116d544b14e8b2edfcb5b793d214136ff64f42", + "url": "https://api.github.com/repos/utopia-php/database/zipball/d70eb76c7cf5ee596752209a4d57e4d08fe8a986", + "reference": "d70eb76c7cf5ee596752209a4d57e4d08fe8a986", "shasum": "" }, "require": { @@ -283,7 +283,7 @@ "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.10.*", - "utopia-php/framework": "0.33.*", + "utopia-php/framework": "1.0.*", "utopia-php/mongo": "0.3.*" }, "require-dev": { @@ -294,7 +294,7 @@ "phpunit/phpunit": "9.6.*", "rregeer/phpunit-coverage-check": "0.3.*", "swoole/ide-helper": "5.1.3", - "utopia-php/cli": "0.14.*" + "utopia-php/cli": "1.0.*" }, "type": "library", "autoload": { @@ -316,32 +316,84 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.53.0" + "source": "https://github.com/utopia-php/database/tree/1.0.0-RC2" }, - "time": "2024-08-30T04:32:56+00:00" + "time": "2024-09-04T17:58:16+00:00" }, { - "name": "utopia-php/framework", - "version": "0.33.8", + "name": "utopia-php/di", + "version": "0.1.0", "source": { "type": "git", - "url": "https://github.com/utopia-php/http.git", - "reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5" + "url": "https://github.com/utopia-php/di.git", + "reference": "22490c95f7ac3898ed1c33f1b1b5dd577305ee31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/a7f577540a25cb90896fef2b64767bf8d700f3c5", - "reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5", + "url": "https://api.github.com/repos/utopia-php/di/zipball/22490c95f7ac3898ed1c33f1b1b5dd577305ee31", + "reference": "22490c95f7ac3898ed1c33f1b1b5dd577305ee31", "shasum": "" }, "require": { - "php": ">=8.0" + "php": ">=8.2" }, "require-dev": { "laravel/pint": "^1.2", "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.25" + "phpunit/phpunit": "^9.5.25", + "swoole/ide-helper": "4.8.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\": "src/", + "Tests\\E2E\\": "tests/e2e" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A simple and lite library for managing dependency injections", + "keywords": [ + "framework", + "http", + "php", + "upf" + ], + "support": { + "issues": "https://github.com/utopia-php/di/issues", + "source": "https://github.com/utopia-php/di/tree/0.1.0" + }, + "time": "2024-08-08T14:35:19+00:00" + }, + { + "name": "utopia-php/framework", + "version": "1.0.0-RC2", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/http.git", + "reference": "d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/http/zipball/d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7", + "reference": "d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7", + "shasum": "" + }, + "require": { + "ext-swoole": "*", + "php": ">=8.0", + "utopia-php/servers": "0.1.* " + }, + "require-dev": { + "ext-xdebug": "*", + "laravel/pint": "^1.2", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5.25", + "swoole/ide-helper": "4.8.3" }, "type": "library", "autoload": { @@ -353,17 +405,18 @@ "license": [ "MIT" ], - "description": "A simple, light and advanced PHP framework", + "description": "A simple, light and advanced PHP HTTP framework", "keywords": [ "framework", + "http", "php", "upf" ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.8" + "source": "https://github.com/utopia-php/http/tree/1.0.0-RC2" }, - "time": "2024-08-15T14:10:09+00:00" + "time": "2024-08-08T14:46:41+00:00" }, { "name": "utopia-php/mongo", @@ -424,6 +477,59 @@ "source": "https://github.com/utopia-php/mongo/tree/0.3.1" }, "time": "2023-09-01T17:25:28+00:00" + }, + { + "name": "utopia-php/servers", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/servers.git", + "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", + "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "utopia-php/di": "0.1.*" + }, + "require-dev": { + "laravel/pint": "^0.2.3", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Servers\\": "src/Servers" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Team Appwrite", + "email": "team@appwrite.io" + } + ], + "description": "A base library for building Utopia style servers.", + "keywords": [ + "framework", + "php", + "servers", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/servers/issues", + "source": "https://github.com/utopia-php/servers/tree/0.1.0" + }, + "time": "2024-08-08T14:31:39+00:00" } ], "packages-dev": [ @@ -1155,16 +1261,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "384af967d35b2162f69526c7276acadce534d0e1" + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", - "reference": "384af967d35b2162f69526c7276acadce534d0e1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", "shasum": "" }, "require": { @@ -1209,7 +1315,7 @@ "type": "github" } ], - "time": "2024-08-27T09:18:05+00:00" + "time": "2024-09-03T19:55:22+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2814,16 +2920,16 @@ }, { "name": "symfony/console", - "version": "v7.1.3", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9" + "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", - "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", + "url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111", + "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111", "shasum": "" }, "require": { @@ -2887,7 +2993,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.3" + "source": "https://github.com/symfony/console/tree/v7.1.4" }, "funding": [ { @@ -2903,7 +3009,7 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:41:01+00:00" + "time": "2024-08-15T22:48:53+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3040,16 +3146,16 @@ }, { "name": "symfony/finder", - "version": "v7.1.3", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "717c6329886f32dc65e27461f80f2a465412fdca" + "reference": "d95bbf319f7d052082fb7af147e0f835a695e823" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/717c6329886f32dc65e27461f80f2a465412fdca", - "reference": "717c6329886f32dc65e27461f80f2a465412fdca", + "url": "https://api.github.com/repos/symfony/finder/zipball/d95bbf319f7d052082fb7af147e0f835a695e823", + "reference": "d95bbf319f7d052082fb7af147e0f835a695e823", "shasum": "" }, "require": { @@ -3084,7 +3190,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.3" + "source": "https://github.com/symfony/finder/tree/v7.1.4" }, "funding": [ { @@ -3100,7 +3206,7 @@ "type": "tidelift" } ], - "time": "2024-07-24T07:08:44+00:00" + "time": "2024-08-13T14:28:19+00:00" }, { "name": "symfony/options-resolver", @@ -3633,16 +3739,16 @@ }, { "name": "symfony/string", - "version": "v7.1.3", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ea272a882be7f20cad58d5d78c215001617b7f07" + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ea272a882be7f20cad58d5d78c215001617b7f07", - "reference": "ea272a882be7f20cad58d5d78c215001617b7f07", + "url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b", + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b", "shasum": "" }, "require": { @@ -3700,7 +3806,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.3" + "source": "https://github.com/symfony/string/tree/v7.1.4" }, "funding": [ { @@ -3716,7 +3822,7 @@ "type": "tidelift" } ], - "time": "2024-07-22T10:25:37+00:00" + "time": "2024-08-12T09:59:40+00:00" }, { "name": "theseer/tokenizer", @@ -3819,7 +3925,7 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "RC", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, diff --git a/src/Abuse/Adapters/Database/TimeLimit.php b/src/Abuse/Adapters/Database/TimeLimit.php index e5940936f0..2527442cfb 100644 --- a/src/Abuse/Adapters/Database/TimeLimit.php +++ b/src/Abuse/Adapters/Database/TimeLimit.php @@ -128,7 +128,7 @@ class TimeLimit extends TimeLimitAdapter /** @var array $result */ $result = $this->db->getAuthorization()->skip(function () use ($key, $datetime) { - return $this->db->find(Database::COLLECTION, [ + return $this->db->find(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), ]); @@ -160,7 +160,7 @@ class TimeLimit extends TimeLimitAdapter } $this->db->getAuthorization()->skip(function () use ($datetime, $key) { - $data = $this->db->findOne(Database::COLLECTION, [ + $data = $this->db->findOne(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), ]); From 40080354a1b3c972b1680dfe27e6dbeb6556c0da Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 5 Sep 2024 12:05:55 -0400 Subject: [PATCH 16/23] chore: updating to latest database --- composer.json | 2 +- composer.lock | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 8842ebb964..ce4baf2f2b 100755 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-pdo": "*", "ext-curl": "*", "ext-redis": "*", - "utopia-php/database": "1.0.*" + "utopia-php/database": "0.54.*" }, "require-dev": { "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index 03a120a02e..8ab1de626e 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": "e6a6611ef5abc949f69ba822126ffd75", + "content-hash": "7601e6576cde00888812fb6e2e732dbe", "packages": [ { "name": "jean85/pretty-package-versions", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "1.0.0-RC2", + "version": "0.54.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "d70eb76c7cf5ee596752209a4d57e4d08fe8a986" + "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/d70eb76c7cf5ee596752209a4d57e4d08fe8a986", - "reference": "d70eb76c7cf5ee596752209a4d57e4d08fe8a986", + "url": "https://api.github.com/repos/utopia-php/database/zipball/1e97fc8b212a8daf9b9a68244677ed34c9db143e", + "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e", "shasum": "" }, "require": { @@ -294,7 +294,7 @@ "phpunit/phpunit": "9.6.*", "rregeer/phpunit-coverage-check": "0.3.*", "swoole/ide-helper": "5.1.3", - "utopia-php/cli": "1.0.*" + "utopia-php/cli": "0.19.*" }, "type": "library", "autoload": { @@ -316,9 +316,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/1.0.0-RC2" + "source": "https://github.com/utopia-php/database/tree/0.54.0" }, - "time": "2024-09-04T17:58:16+00:00" + "time": "2024-09-05T16:00:42+00:00" }, { "name": "utopia-php/di", @@ -370,22 +370,22 @@ }, { "name": "utopia-php/framework", - "version": "1.0.0-RC2", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7" + "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7", - "reference": "d1e9674dbf33bed03fa53854ec1f2c6e074cf4d7", + "url": "https://api.github.com/repos/utopia-php/http/zipball/cc880ec41f7f163d4f9956fec26cc6be51b412cf", + "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf", "shasum": "" }, "require": { "ext-swoole": "*", "php": ">=8.0", - "utopia-php/servers": "0.1.* " + "utopia-php/servers": "0.1.*" }, "require-dev": { "ext-xdebug": "*", @@ -414,9 +414,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/1.0.0-RC2" + "source": "https://github.com/utopia-php/http/tree/1.0.0" }, - "time": "2024-08-08T14:46:41+00:00" + "time": "2024-09-05T15:38:08+00:00" }, { "name": "utopia-php/mongo", @@ -535,16 +535,16 @@ "packages-dev": [ { "name": "doctrine/annotations", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" + "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/901c2ee5d26eb64ff43c47976e114bf00843acf7", + "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7", "shasum": "" }, "require": { @@ -556,10 +556,10 @@ "require-dev": { "doctrine/cache": "^2.0", "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.8.0", + "phpstan/phpstan": "^1.10.28", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^5.4 || ^6", - "vimeo/psalm": "^4.10" + "symfony/cache": "^5.4 || ^6.4 || ^7", + "vimeo/psalm": "^4.30 || ^5.14" }, "suggest": { "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" @@ -605,9 +605,9 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/2.0.1" + "source": "https://github.com/doctrine/annotations/tree/2.0.2" }, - "time": "2023-02-02T22:02:53+00:00" + "time": "2024-09-05T10:17:24+00:00" }, { "name": "doctrine/instantiator", From 6f0a7dc02a167c67fd3d8bfc298f9ff9b000a7c4 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 5 Sep 2024 12:08:08 -0400 Subject: [PATCH 17/23] chore: changing to stable --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ce4baf2f2b..823856bc1b 100755 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "library", "keywords": ["php","framework", "upf", "utopia", "abuse"], "license": "MIT", - "minimum-stability": "RC", + "minimum-stability": "stable", "autoload": { "psr-4": {"Utopia\\Abuse\\": "src/Abuse"} }, From 1c7d4680b5d9a385a88c6b2f5622b3d4b3611bea Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 17 Sep 2024 18:20:53 +0900 Subject: [PATCH 18/23] Chore: findOne now returns empty documents instead of false on miss --- src/Abuse/Adapters/Database/TimeLimit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Abuse/Adapters/Database/TimeLimit.php b/src/Abuse/Adapters/Database/TimeLimit.php index 2527442cfb..0f1e779295 100644 --- a/src/Abuse/Adapters/Database/TimeLimit.php +++ b/src/Abuse/Adapters/Database/TimeLimit.php @@ -165,7 +165,7 @@ class TimeLimit extends TimeLimitAdapter Query::equal('time', [$datetime]), ]); - if ($data === false) { + if ($data->isEmpty()) { $data = [ '$permissions' => [], 'key' => $key, @@ -183,7 +183,7 @@ class TimeLimit extends TimeLimitAdapter Query::equal('time', [$datetime]), ]); - if ($data !== false && $data instanceof Document) { + if (!$data->isEmpty()) { $count = $data->getAttribute('count', 0); if (\is_numeric($count)) { $this->count = intval($count); From 4198352039d096c258d01e8e1442126069eba48c Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Wed, 18 Sep 2024 13:15:57 +0900 Subject: [PATCH 19/23] Chore: Update Database Library --- composer.json | 2 +- composer.lock | 144 +++++++++++++++++++++++++------------------------- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/composer.json b/composer.json index 823856bc1b..79685c2ffa 100755 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-pdo": "*", "ext-curl": "*", "ext-redis": "*", - "utopia-php/database": "0.54.*" + "utopia-php/database": "0.55.*" }, "require-dev": { "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index 8ab1de626e..055b1ecad7 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": "7601e6576cde00888812fb6e2e732dbe", + "content-hash": "4ae74a41329275b52e4722de01c60285", "packages": [ { "name": "jean85/pretty-package-versions", @@ -136,20 +136,20 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -196,7 +196,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -212,7 +212,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "utopia-php/cache", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.54.0", + "version": "0.55", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e" + "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/1e97fc8b212a8daf9b9a68244677ed34c9db143e", - "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0ad2eb1c163196cd79253c59f1896c5b03d6ba91", + "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91", "shasum": "" }, "require": { @@ -316,9 +316,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.54.0" + "source": "https://github.com/utopia-php/database/tree/0.55" }, - "time": "2024-09-05T16:00:42+00:00" + "time": "2024-09-18T04:00:12+00:00" }, { "name": "utopia-php/di", @@ -370,16 +370,16 @@ }, { "name": "utopia-php/framework", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf" + "reference": "fc63ec61c720190a5ea5bb484c615145850951e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/cc880ec41f7f163d4f9956fec26cc6be51b412cf", - "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf", + "url": "https://api.github.com/repos/utopia-php/http/zipball/fc63ec61c720190a5ea5bb484c615145850951e6", + "reference": "fc63ec61c720190a5ea5bb484c615145850951e6", "shasum": "" }, "require": { @@ -414,9 +414,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/1.0.0" + "source": "https://github.com/utopia-php/http/tree/1.0.2" }, - "time": "2024-09-05T15:38:08+00:00" + "time": "2024-09-10T09:04:19+00:00" }, { "name": "utopia-php/mongo", @@ -480,16 +480,16 @@ }, { "name": "utopia-php/servers", - "version": "0.1.0", + "version": "0.1.1", "source": { "type": "git", "url": "https://github.com/utopia-php/servers.git", - "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c" + "reference": "fd5c8d32778f265256c1936372a071b944f5ba8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/servers/zipball/7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", - "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/fd5c8d32778f265256c1936372a071b944f5ba8a", + "reference": "fd5c8d32778f265256c1936372a071b944f5ba8a", "shasum": "" }, "require": { @@ -527,9 +527,9 @@ ], "support": { "issues": "https://github.com/utopia-php/servers/issues", - "source": "https://github.com/utopia-php/servers/tree/0.1.0" + "source": "https://github.com/utopia-php/servers/tree/0.1.1" }, - "time": "2024-08-08T14:31:39+00:00" + "time": "2024-09-06T02:25:56+00:00" } ], "packages-dev": [ @@ -884,16 +884,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -936,9 +936,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "phar-io/manifest", @@ -1261,16 +1261,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.1", + "version": "1.12.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", "shasum": "" }, "require": { @@ -1315,7 +1315,7 @@ "type": "github" } ], - "time": "2024-09-03T19:55:22+00:00" + "time": "2024-09-09T08:10:35+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1843,16 +1843,16 @@ }, { "name": "psr/log", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "79dff0b268932c640297f5208d6298f71855c03e" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e", - "reference": "79dff0b268932c640297f5208d6298f71855c03e", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -1887,9 +1887,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.1" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2024-08-21T13:31:24+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "sebastian/cli-parser", @@ -3277,20 +3277,20 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -3336,7 +3336,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -3352,24 +3352,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", - "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -3414,7 +3414,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" }, "funding": [ { @@ -3430,24 +3430,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", - "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -3495,7 +3495,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" }, "funding": [ { @@ -3511,24 +3511,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -3575,7 +3575,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -3591,7 +3591,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/process", @@ -3925,7 +3925,7 @@ } ], "aliases": [], - "minimum-stability": "RC", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, From b76dd683c3e2877251aca4b38fd9c015911066fe Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 7 Oct 2024 19:07:20 +0000 Subject: [PATCH 20/23] chore: update db library --- composer.lock | 96 +++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/composer.lock b/composer.lock index 055b1ecad7..82030d2556 100644 --- a/composer.lock +++ b/composer.lock @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.55", + "version": "0.55.1", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91" + "reference": "6f44079999491feb0ef85686f6b2ac7ef54db828" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/0ad2eb1c163196cd79253c59f1896c5b03d6ba91", - "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91", + "url": "https://api.github.com/repos/utopia-php/database/zipball/6f44079999491feb0ef85686f6b2ac7ef54db828", + "reference": "6f44079999491feb0ef85686f6b2ac7ef54db828", "shasum": "" }, "require": { @@ -316,9 +316,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.55" + "source": "https://github.com/utopia-php/database/tree/0.55.1" }, - "time": "2024-09-18T04:00:12+00:00" + "time": "2024-10-07T18:52:26+00:00" }, { "name": "utopia-php/di", @@ -884,16 +884,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.2.0", + "version": "v5.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" + "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a", + "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a", "shasum": "" }, "require": { @@ -936,9 +936,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0" }, - "time": "2024-09-15T16:40:33+00:00" + "time": "2024-09-29T13:56:26+00:00" }, { "name": "phar-io/manifest", @@ -1261,16 +1261,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.3", + "version": "1.12.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", "shasum": "" }, "require": { @@ -1315,7 +1315,7 @@ "type": "github" } ], - "time": "2024-09-09T08:10:35+00:00" + "time": "2024-10-06T15:03:59+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1638,16 +1638,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.20", + "version": "9.6.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "49d7820565836236411f5dc002d16dd689cde42f" + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", - "reference": "49d7820565836236411f5dc002d16dd689cde42f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", "shasum": "" }, "require": { @@ -1662,7 +1662,7 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-code-coverage": "^9.2.32", "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.4", @@ -1721,7 +1721,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" }, "funding": [ { @@ -1737,7 +1737,7 @@ "type": "tidelift" } ], - "time": "2024-07-10T11:45:39+00:00" + "time": "2024-09-19T10:50:18+00:00" }, { "name": "psr/cache", @@ -2920,16 +2920,16 @@ }, { "name": "symfony/console", - "version": "v7.1.4", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111" + "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111", - "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111", + "url": "https://api.github.com/repos/symfony/console/zipball/0fa539d12b3ccf068a722bbbffa07ca7079af9ee", + "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee", "shasum": "" }, "require": { @@ -2993,7 +2993,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.4" + "source": "https://github.com/symfony/console/tree/v7.1.5" }, "funding": [ { @@ -3009,7 +3009,7 @@ "type": "tidelift" } ], - "time": "2024-08-15T22:48:53+00:00" + "time": "2024-09-20T08:28:38+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3080,16 +3080,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.1.2", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" + "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", - "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/61fe0566189bf32e8cfee78335d8776f64a66f5a", + "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a", "shasum": "" }, "require": { @@ -3126,7 +3126,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.2" + "source": "https://github.com/symfony/filesystem/tree/v7.1.5" }, "funding": [ { @@ -3142,7 +3142,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-09-17T09:16:35+00:00" }, { "name": "symfony/finder", @@ -3595,16 +3595,16 @@ }, { "name": "symfony/process", - "version": "v7.1.3", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca" + "reference": "5c03ee6369281177f07f7c68252a280beccba847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/7f2f542c668ad6c313dc4a5e9c3321f733197eca", - "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca", + "url": "https://api.github.com/repos/symfony/process/zipball/5c03ee6369281177f07f7c68252a280beccba847", + "reference": "5c03ee6369281177f07f7c68252a280beccba847", "shasum": "" }, "require": { @@ -3636,7 +3636,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.3" + "source": "https://github.com/symfony/process/tree/v7.1.5" }, "funding": [ { @@ -3652,7 +3652,7 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:44:47+00:00" + "time": "2024-09-19T21:48:23+00:00" }, { "name": "symfony/service-contracts", @@ -3739,16 +3739,16 @@ }, { "name": "symfony/string", - "version": "v7.1.4", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b" + "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b", - "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b", + "url": "https://api.github.com/repos/symfony/string/zipball/d66f9c343fa894ec2037cc928381df90a7ad4306", + "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306", "shasum": "" }, "require": { @@ -3806,7 +3806,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.4" + "source": "https://github.com/symfony/string/tree/v7.1.5" }, "funding": [ { @@ -3822,7 +3822,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:59:40+00:00" + "time": "2024-09-20T08:28:38+00:00" }, { "name": "theseer/tokenizer", From b3e9735cb3dd9298ac93b0f2ec1377cfc6054a79 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 18 Dec 2024 20:10:18 +0530 Subject: [PATCH 21/23] Revert "chore: update db library" --- composer.lock | 96 +++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/composer.lock b/composer.lock index 82030d2556..055b1ecad7 100644 --- a/composer.lock +++ b/composer.lock @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.55.1", + "version": "0.55", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "6f44079999491feb0ef85686f6b2ac7ef54db828" + "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/6f44079999491feb0ef85686f6b2ac7ef54db828", - "reference": "6f44079999491feb0ef85686f6b2ac7ef54db828", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0ad2eb1c163196cd79253c59f1896c5b03d6ba91", + "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91", "shasum": "" }, "require": { @@ -316,9 +316,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.55.1" + "source": "https://github.com/utopia-php/database/tree/0.55" }, - "time": "2024-10-07T18:52:26+00:00" + "time": "2024-09-18T04:00:12+00:00" }, { "name": "utopia-php/di", @@ -884,16 +884,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.3.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a", - "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -936,9 +936,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-09-29T13:56:26+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "phar-io/manifest", @@ -1261,16 +1261,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.6", + "version": "1.12.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", - "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", "shasum": "" }, "require": { @@ -1315,7 +1315,7 @@ "type": "github" } ], - "time": "2024-10-06T15:03:59+00:00" + "time": "2024-09-09T08:10:35+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1638,16 +1638,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.21", + "version": "9.6.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" + "reference": "49d7820565836236411f5dc002d16dd689cde42f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", - "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", + "reference": "49d7820565836236411f5dc002d16dd689cde42f", "shasum": "" }, "require": { @@ -1662,7 +1662,7 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", + "phpunit/php-code-coverage": "^9.2.31", "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.4", @@ -1721,7 +1721,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" }, "funding": [ { @@ -1737,7 +1737,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T10:50:18+00:00" + "time": "2024-07-10T11:45:39+00:00" }, { "name": "psr/cache", @@ -2920,16 +2920,16 @@ }, { "name": "symfony/console", - "version": "v7.1.5", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee" + "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0fa539d12b3ccf068a722bbbffa07ca7079af9ee", - "reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee", + "url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111", + "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111", "shasum": "" }, "require": { @@ -2993,7 +2993,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.5" + "source": "https://github.com/symfony/console/tree/v7.1.4" }, "funding": [ { @@ -3009,7 +3009,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:28:38+00:00" + "time": "2024-08-15T22:48:53+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3080,16 +3080,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.1.5", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a" + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/61fe0566189bf32e8cfee78335d8776f64a66f5a", - "reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", "shasum": "" }, "require": { @@ -3126,7 +3126,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.5" + "source": "https://github.com/symfony/filesystem/tree/v7.1.2" }, "funding": [ { @@ -3142,7 +3142,7 @@ "type": "tidelift" } ], - "time": "2024-09-17T09:16:35+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/finder", @@ -3595,16 +3595,16 @@ }, { "name": "symfony/process", - "version": "v7.1.5", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5c03ee6369281177f07f7c68252a280beccba847" + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5c03ee6369281177f07f7c68252a280beccba847", - "reference": "5c03ee6369281177f07f7c68252a280beccba847", + "url": "https://api.github.com/repos/symfony/process/zipball/7f2f542c668ad6c313dc4a5e9c3321f733197eca", + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca", "shasum": "" }, "require": { @@ -3636,7 +3636,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.5" + "source": "https://github.com/symfony/process/tree/v7.1.3" }, "funding": [ { @@ -3652,7 +3652,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T21:48:23+00:00" + "time": "2024-07-26T12:44:47+00:00" }, { "name": "symfony/service-contracts", @@ -3739,16 +3739,16 @@ }, { "name": "symfony/string", - "version": "v7.1.5", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306" + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d66f9c343fa894ec2037cc928381df90a7ad4306", - "reference": "d66f9c343fa894ec2037cc928381df90a7ad4306", + "url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b", + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b", "shasum": "" }, "require": { @@ -3806,7 +3806,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.5" + "source": "https://github.com/symfony/string/tree/v7.1.4" }, "funding": [ { @@ -3822,7 +3822,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:28:38+00:00" + "time": "2024-08-12T09:59:40+00:00" }, { "name": "theseer/tokenizer", From 9760fee979d6aa7fdabec7a465f00e977c953654 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 18 Dec 2024 20:13:09 +0530 Subject: [PATCH 22/23] Revert "Chore: findOne now returns empty documents instead of false on miss" --- composer.json | 2 +- composer.lock | 144 +++++++++++----------- src/Abuse/Adapters/Database/TimeLimit.php | 4 +- 3 files changed, 75 insertions(+), 75 deletions(-) diff --git a/composer.json b/composer.json index 79685c2ffa..823856bc1b 100755 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-pdo": "*", "ext-curl": "*", "ext-redis": "*", - "utopia-php/database": "0.55.*" + "utopia-php/database": "0.54.*" }, "require-dev": { "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index 055b1ecad7..8ab1de626e 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": "4ae74a41329275b52e4722de01c60285", + "content-hash": "7601e6576cde00888812fb6e2e732dbe", "packages": [ { "name": "jean85/pretty-package-versions", @@ -136,20 +136,20 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.31.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=7.1" }, "type": "library", "extra": { @@ -196,7 +196,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -212,7 +212,7 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "utopia-php/cache", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.55", + "version": "0.54.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91" + "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/0ad2eb1c163196cd79253c59f1896c5b03d6ba91", - "reference": "0ad2eb1c163196cd79253c59f1896c5b03d6ba91", + "url": "https://api.github.com/repos/utopia-php/database/zipball/1e97fc8b212a8daf9b9a68244677ed34c9db143e", + "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e", "shasum": "" }, "require": { @@ -316,9 +316,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.55" + "source": "https://github.com/utopia-php/database/tree/0.54.0" }, - "time": "2024-09-18T04:00:12+00:00" + "time": "2024-09-05T16:00:42+00:00" }, { "name": "utopia-php/di", @@ -370,16 +370,16 @@ }, { "name": "utopia-php/framework", - "version": "1.0.2", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "fc63ec61c720190a5ea5bb484c615145850951e6" + "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/fc63ec61c720190a5ea5bb484c615145850951e6", - "reference": "fc63ec61c720190a5ea5bb484c615145850951e6", + "url": "https://api.github.com/repos/utopia-php/http/zipball/cc880ec41f7f163d4f9956fec26cc6be51b412cf", + "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf", "shasum": "" }, "require": { @@ -414,9 +414,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/1.0.2" + "source": "https://github.com/utopia-php/http/tree/1.0.0" }, - "time": "2024-09-10T09:04:19+00:00" + "time": "2024-09-05T15:38:08+00:00" }, { "name": "utopia-php/mongo", @@ -480,16 +480,16 @@ }, { "name": "utopia-php/servers", - "version": "0.1.1", + "version": "0.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/servers.git", - "reference": "fd5c8d32778f265256c1936372a071b944f5ba8a" + "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/servers/zipball/fd5c8d32778f265256c1936372a071b944f5ba8a", - "reference": "fd5c8d32778f265256c1936372a071b944f5ba8a", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", + "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", "shasum": "" }, "require": { @@ -527,9 +527,9 @@ ], "support": { "issues": "https://github.com/utopia-php/servers/issues", - "source": "https://github.com/utopia-php/servers/tree/0.1.1" + "source": "https://github.com/utopia-php/servers/tree/0.1.0" }, - "time": "2024-09-06T02:25:56+00:00" + "time": "2024-08-08T14:31:39+00:00" } ], "packages-dev": [ @@ -884,16 +884,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.2.0", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -936,9 +936,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-09-15T16:40:33+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "phar-io/manifest", @@ -1261,16 +1261,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.3", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", "shasum": "" }, "require": { @@ -1315,7 +1315,7 @@ "type": "github" } ], - "time": "2024-09-09T08:10:35+00:00" + "time": "2024-09-03T19:55:22+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1843,16 +1843,16 @@ }, { "name": "psr/log", - "version": "3.0.2", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + "reference": "79dff0b268932c640297f5208d6298f71855c03e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e", + "reference": "79dff0b268932c640297f5208d6298f71855c03e", "shasum": "" }, "require": { @@ -1887,9 +1887,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.2" + "source": "https://github.com/php-fig/log/tree/3.0.1" }, - "time": "2024-09-11T13:17:53+00:00" + "time": "2024-08-21T13:31:24+00:00" }, { "name": "sebastian/cli-parser", @@ -3277,20 +3277,20 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.31.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=7.1" }, "provide": { "ext-ctype": "*" @@ -3336,7 +3336,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -3352,24 +3352,24 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.31.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", - "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -3414,7 +3414,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -3430,24 +3430,24 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.31.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "3833d7255cc303546435cb650316bff708a1c75c" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", - "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -3495,7 +3495,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -3511,24 +3511,24 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=7.1" }, "provide": { "ext-mbstring": "*" @@ -3575,7 +3575,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -3591,7 +3591,7 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/process", @@ -3925,7 +3925,7 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "RC", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, diff --git a/src/Abuse/Adapters/Database/TimeLimit.php b/src/Abuse/Adapters/Database/TimeLimit.php index 0f1e779295..2527442cfb 100644 --- a/src/Abuse/Adapters/Database/TimeLimit.php +++ b/src/Abuse/Adapters/Database/TimeLimit.php @@ -165,7 +165,7 @@ class TimeLimit extends TimeLimitAdapter Query::equal('time', [$datetime]), ]); - if ($data->isEmpty()) { + if ($data === false) { $data = [ '$permissions' => [], 'key' => $key, @@ -183,7 +183,7 @@ class TimeLimit extends TimeLimitAdapter Query::equal('time', [$datetime]), ]); - if (!$data->isEmpty()) { + if ($data !== false && $data instanceof Document) { $count = $data->getAttribute('count', 0); if (\is_numeric($count)) { $this->count = intval($count); From f0c49a64fd80bdf7e2f7f10ec727c7d466f3e2e7 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 18 Dec 2024 20:16:53 +0530 Subject: [PATCH 23/23] Revert "Framework" --- composer.json | 2 +- composer.lock | 208 +++++------------- src/Abuse/Adapters/Database/TimeLimit.php | 77 +------ tests/Abuse/Base.php | 0 tests/Abuse/Bench/Database/TimeLimitBench.php | 2 +- tests/Abuse/DatabaseTest.php | 2 +- tests/Abuse/RedisTest.php | 2 +- 7 files changed, 61 insertions(+), 232 deletions(-) mode change 100755 => 100644 tests/Abuse/Base.php diff --git a/composer.json b/composer.json index 823856bc1b..6283871b3a 100755 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-pdo": "*", "ext-curl": "*", "ext-redis": "*", - "utopia-php/database": "0.54.*" + "utopia-php/database": "0.53.*" }, "require-dev": { "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index 8ab1de626e..152575410f 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": "7601e6576cde00888812fb6e2e732dbe", + "content-hash": "6522b9fb8652f6801bd7c5664430c672", "packages": [ { "name": "jean85/pretty-package-versions", @@ -266,16 +266,16 @@ }, { "name": "utopia-php/database", - "version": "0.54.0", + "version": "0.53.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e" + "reference": "2e116d544b14e8b2edfcb5b793d214136ff64f42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/1e97fc8b212a8daf9b9a68244677ed34c9db143e", - "reference": "1e97fc8b212a8daf9b9a68244677ed34c9db143e", + "url": "https://api.github.com/repos/utopia-php/database/zipball/2e116d544b14e8b2edfcb5b793d214136ff64f42", + "reference": "2e116d544b14e8b2edfcb5b793d214136ff64f42", "shasum": "" }, "require": { @@ -283,7 +283,7 @@ "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.10.*", - "utopia-php/framework": "1.0.*", + "utopia-php/framework": "0.33.*", "utopia-php/mongo": "0.3.*" }, "require-dev": { @@ -294,7 +294,7 @@ "phpunit/phpunit": "9.6.*", "rregeer/phpunit-coverage-check": "0.3.*", "swoole/ide-helper": "5.1.3", - "utopia-php/cli": "0.19.*" + "utopia-php/cli": "0.14.*" }, "type": "library", "autoload": { @@ -316,84 +316,32 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.54.0" + "source": "https://github.com/utopia-php/database/tree/0.53.0" }, - "time": "2024-09-05T16:00:42+00:00" - }, - { - "name": "utopia-php/di", - "version": "0.1.0", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/di.git", - "reference": "22490c95f7ac3898ed1c33f1b1b5dd577305ee31" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/di/zipball/22490c95f7ac3898ed1c33f1b1b5dd577305ee31", - "reference": "22490c95f7ac3898ed1c33f1b1b5dd577305ee31", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "laravel/pint": "^1.2", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.25", - "swoole/ide-helper": "4.8.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\": "src/", - "Tests\\E2E\\": "tests/e2e" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A simple and lite library for managing dependency injections", - "keywords": [ - "framework", - "http", - "php", - "upf" - ], - "support": { - "issues": "https://github.com/utopia-php/di/issues", - "source": "https://github.com/utopia-php/di/tree/0.1.0" - }, - "time": "2024-08-08T14:35:19+00:00" + "time": "2024-08-30T04:32:56+00:00" }, { "name": "utopia-php/framework", - "version": "1.0.0", + "version": "0.33.8", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf" + "reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/cc880ec41f7f163d4f9956fec26cc6be51b412cf", - "reference": "cc880ec41f7f163d4f9956fec26cc6be51b412cf", + "url": "https://api.github.com/repos/utopia-php/http/zipball/a7f577540a25cb90896fef2b64767bf8d700f3c5", + "reference": "a7f577540a25cb90896fef2b64767bf8d700f3c5", "shasum": "" }, "require": { - "ext-swoole": "*", - "php": ">=8.0", - "utopia-php/servers": "0.1.*" + "php": ">=8.0" }, "require-dev": { - "ext-xdebug": "*", "laravel/pint": "^1.2", "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.25", - "swoole/ide-helper": "4.8.3" + "phpunit/phpunit": "^9.5.25" }, "type": "library", "autoload": { @@ -405,18 +353,17 @@ "license": [ "MIT" ], - "description": "A simple, light and advanced PHP HTTP framework", + "description": "A simple, light and advanced PHP framework", "keywords": [ "framework", - "http", "php", "upf" ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/1.0.0" + "source": "https://github.com/utopia-php/http/tree/0.33.8" }, - "time": "2024-09-05T15:38:08+00:00" + "time": "2024-08-15T14:10:09+00:00" }, { "name": "utopia-php/mongo", @@ -477,74 +424,21 @@ "source": "https://github.com/utopia-php/mongo/tree/0.3.1" }, "time": "2023-09-01T17:25:28+00:00" - }, - { - "name": "utopia-php/servers", - "version": "0.1.0", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/servers.git", - "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/servers/zipball/7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", - "reference": "7d9e4f364fb1ab1889fb89ca96eb9946467cb09c", - "shasum": "" - }, - "require": { - "php": ">=8.0", - "utopia-php/di": "0.1.*" - }, - "require-dev": { - "laravel/pint": "^0.2.3", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.5.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Servers\\": "src/Servers" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Team Appwrite", - "email": "team@appwrite.io" - } - ], - "description": "A base library for building Utopia style servers.", - "keywords": [ - "framework", - "php", - "servers", - "upf", - "utopia" - ], - "support": { - "issues": "https://github.com/utopia-php/servers/issues", - "source": "https://github.com/utopia-php/servers/tree/0.1.0" - }, - "time": "2024-08-08T14:31:39+00:00" } ], "packages-dev": [ { "name": "doctrine/annotations", - "version": "2.0.2", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7" + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/901c2ee5d26eb64ff43c47976e114bf00843acf7", - "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", "shasum": "" }, "require": { @@ -556,10 +450,10 @@ "require-dev": { "doctrine/cache": "^2.0", "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.10.28", + "phpstan/phpstan": "^1.8.0", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^5.4 || ^6.4 || ^7", - "vimeo/psalm": "^4.30 || ^5.14" + "symfony/cache": "^5.4 || ^6", + "vimeo/psalm": "^4.10" }, "suggest": { "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" @@ -605,9 +499,9 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/2.0.2" + "source": "https://github.com/doctrine/annotations/tree/2.0.1" }, - "time": "2024-09-05T10:17:24+00:00" + "time": "2023-02-02T22:02:53+00:00" }, { "name": "doctrine/instantiator", @@ -1261,16 +1155,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" + "reference": "384af967d35b2162f69526c7276acadce534d0e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", + "reference": "384af967d35b2162f69526c7276acadce534d0e1", "shasum": "" }, "require": { @@ -1315,7 +1209,7 @@ "type": "github" } ], - "time": "2024-09-03T19:55:22+00:00" + "time": "2024-08-27T09:18:05+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2920,16 +2814,16 @@ }, { "name": "symfony/console", - "version": "v7.1.4", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111" + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111", - "reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111", + "url": "https://api.github.com/repos/symfony/console/zipball/cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", "shasum": "" }, "require": { @@ -2993,7 +2887,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.4" + "source": "https://github.com/symfony/console/tree/v7.1.3" }, "funding": [ { @@ -3009,7 +2903,7 @@ "type": "tidelift" } ], - "time": "2024-08-15T22:48:53+00:00" + "time": "2024-07-26T12:41:01+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3146,16 +3040,16 @@ }, { "name": "symfony/finder", - "version": "v7.1.4", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823" + "reference": "717c6329886f32dc65e27461f80f2a465412fdca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d95bbf319f7d052082fb7af147e0f835a695e823", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823", + "url": "https://api.github.com/repos/symfony/finder/zipball/717c6329886f32dc65e27461f80f2a465412fdca", + "reference": "717c6329886f32dc65e27461f80f2a465412fdca", "shasum": "" }, "require": { @@ -3190,7 +3084,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.4" + "source": "https://github.com/symfony/finder/tree/v7.1.3" }, "funding": [ { @@ -3206,7 +3100,7 @@ "type": "tidelift" } ], - "time": "2024-08-13T14:28:19+00:00" + "time": "2024-07-24T07:08:44+00:00" }, { "name": "symfony/options-resolver", @@ -3739,16 +3633,16 @@ }, { "name": "symfony/string", - "version": "v7.1.4", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b" + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b", - "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b", + "url": "https://api.github.com/repos/symfony/string/zipball/ea272a882be7f20cad58d5d78c215001617b7f07", + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07", "shasum": "" }, "require": { @@ -3806,7 +3700,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.4" + "source": "https://github.com/symfony/string/tree/v7.1.3" }, "funding": [ { @@ -3822,7 +3716,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:59:40+00:00" + "time": "2024-07-22T10:25:37+00:00" }, { "name": "theseer/tokenizer", @@ -3925,7 +3819,7 @@ } ], "aliases": [], - "minimum-stability": "RC", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, diff --git a/src/Abuse/Adapters/Database/TimeLimit.php b/src/Abuse/Adapters/Database/TimeLimit.php index 2527442cfb..0d408295ed 100644 --- a/src/Abuse/Adapters/Database/TimeLimit.php +++ b/src/Abuse/Adapters/Database/TimeLimit.php @@ -10,7 +10,8 @@ use Utopia\Database\Exception\Authorization as AuthorizationException; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Structure; use Utopia\Database\Query; -use Utopia\Http\Exception; +use Utopia\Database\Validator\Authorization; +use Utopia\Exception; class TimeLimit extends TimeLimitAdapter { @@ -127,7 +128,7 @@ class TimeLimit extends TimeLimitAdapter } /** @var array $result */ - $result = $this->db->getAuthorization()->skip(function () use ($key, $datetime) { + $result = Authorization::skip(function () use ($key, $datetime) { return $this->db->find(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -159,7 +160,7 @@ class TimeLimit extends TimeLimitAdapter return; } - $this->db->getAuthorization()->skip(function () use ($datetime, $key) { + Authorization::skip(function () use ($datetime, $key) { $data = $this->db->findOne(TimeLimit::COLLECTION, [ Query::equal('key', [$key]), Query::equal('time', [$datetime]), @@ -216,7 +217,7 @@ class TimeLimit extends TimeLimitAdapter public function getLogs(?int $offset = null, ?int $limit = 25): array { /** @var array $results */ - $results = $this->db->getAuthorization()->skip(function () use ($offset, $limit) { + $results = Authorization::skip(function () use ($offset, $limit) { $queries = []; $queries[] = Query::orderDesc(''); @@ -243,7 +244,7 @@ class TimeLimit extends TimeLimitAdapter */ public function cleanup(string $datetime): bool { - $this->db->getAuthorization()->skip(function () use ($datetime) { + Authorization::skip(function () use ($datetime) { do { $documents = $this->db->find(TimeLimit::COLLECTION, [ Query::lessThan('time', $datetime), @@ -257,70 +258,4 @@ class TimeLimit extends TimeLimitAdapter return true; } - - /** - * Check - * - * Checks if number of counts is bigger or smaller than current limit. limit 0 is equal to unlimited - * - * @return bool - * - * @throws \Throwable - */ - public function check(): bool - { - if (0 == $this->limit) { - return false; - } - - $key = $this->parseKey(); - - if ($this->limit > $this->count($key, $this->time)) { - $this->hit($key, $this->time); - - return false; - } - - return true; - } - - /** - * Remaining - * - * Returns the number of current remaining counts - * - * @return int - * - * @throws \Exception - */ - public function remaining(): int - { - $left = $this->limit - ($this->count($this->parseKey(), $this->time) + 1); // Add one because we need to say how many left not how many done - - return (0 > $left) ? 0 : $left; - } - - /** - * Limit - * - * Return the limit integer - * - * @return int - */ - public function limit(): int - { - return $this->limit; - } - - /** - * Time - * - * Return the Datetime - * - * @return string - */ - public function time(): string - { - return $this->time; - } } diff --git a/tests/Abuse/Base.php b/tests/Abuse/Base.php old mode 100755 new mode 100644 diff --git a/tests/Abuse/Bench/Database/TimeLimitBench.php b/tests/Abuse/Bench/Database/TimeLimitBench.php index 8f2a5be2cb..e2a110c6b7 100644 --- a/tests/Abuse/Bench/Database/TimeLimitBench.php +++ b/tests/Abuse/Bench/Database/TimeLimitBench.php @@ -10,8 +10,8 @@ use Utopia\Cache\Cache; use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; +use Utopia\Exception; use Utopia\Tests\Bench\Base; -use Utopia\Http\Exception; class TimeLimitBench extends Base { diff --git a/tests/Abuse/DatabaseTest.php b/tests/Abuse/DatabaseTest.php index fc6c1ed197..b3820e6aa4 100755 --- a/tests/Abuse/DatabaseTest.php +++ b/tests/Abuse/DatabaseTest.php @@ -12,7 +12,7 @@ use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; use Utopia\Database\DateTime; -use Utopia\Http\Exception; +use Utopia\Exception; class DatabaseTest extends Base { diff --git a/tests/Abuse/RedisTest.php b/tests/Abuse/RedisTest.php index 4ecd92dd50..517ee94777 100644 --- a/tests/Abuse/RedisTest.php +++ b/tests/Abuse/RedisTest.php @@ -7,7 +7,7 @@ use Redis as Client; use Utopia\Abuse\Abuse; use Utopia\Abuse\Adapter; use Utopia\Abuse\Adapters\Redis\TimeLimit; -use Utopia\Http\Exception; +use Utopia\Exception; class RedisTest extends Base {