From ae3535de0dc27774672645ed903b8b4aef78bdf3 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 20 Feb 2023 19:03:15 +1300 Subject: [PATCH 01/15] Remove count, limit and offset limitations --- app/controllers/api/account.php | 6 +-- app/controllers/api/databases.php | 26 +++++------ app/controllers/api/functions.php | 6 +-- app/controllers/api/projects.php | 6 +-- app/controllers/api/storage.php | 6 +-- app/controllers/api/teams.php | 11 ++--- app/controllers/api/users.php | 8 ++-- app/init.php | 1 - composer.json | 6 +-- composer.lock | 78 +++++++++++++++++++------------ 10 files changed, 84 insertions(+), 70 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 1a5d6f7b00..1174469313 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1397,7 +1397,7 @@ App::get('/v1/account/logs') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) - ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('user') ->inject('locale') @@ -1407,8 +1407,8 @@ App::get('/v1/account/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; - $offset = $grouped['offset'] ?? 0; + $limit = $grouped['limit'] ?? null; + $offset = $grouped['offset'] ?? null; $audit = new EventAudit($dbForProject); diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 88242482a1..11de905af6 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -265,7 +265,7 @@ App::get('/v1/databases') $response->dynamic(new Document([ 'databases' => $dbForProject->find('databases', $queries), - 'total' => $dbForProject->count('databases', $filterQueries, APP_LIMIT_COUNT), + 'total' => $dbForProject->count('databases', $filterQueries), ]), Response::MODEL_DATABASE_LIST); }); @@ -307,7 +307,7 @@ App::get('/v1/databases/:databaseId/logs') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') @@ -322,8 +322,8 @@ App::get('/v1/databases/:databaseId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; - $offset = $grouped['offset'] ?? 0; + $limit = $grouped['limit'] ?? null; + $offset = $grouped['offset'] ?? null; $audit = new Audit($dbForProject); $resource = 'database/' . $databaseId; @@ -590,7 +590,7 @@ App::get('/v1/databases/:databaseId/collections') $response->dynamic(new Document([ 'collections' => $dbForProject->find('database_' . $database->getInternalId(), $queries), - 'total' => $dbForProject->count('database_' . $database->getInternalId(), $filterQueries, APP_LIMIT_COUNT), + 'total' => $dbForProject->count('database_' . $database->getInternalId(), $filterQueries), ]), Response::MODEL_COLLECTION_LIST); }); @@ -645,7 +645,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/logs') ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID.') - ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') @@ -666,8 +666,8 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; - $offset = $grouped['offset'] ?? 0; + $limit = $grouped['limit'] ?? null; + $offset = $grouped['offset'] ?? null; $audit = new Audit($dbForProject); $resource = 'database/' . $databaseId . '/collection/' . $collectionId; @@ -2036,10 +2036,10 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents') if ($documentSecurity && !$valid) { $documents = $dbForProject->find('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $queries); - $total = $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries, APP_LIMIT_COUNT); + $total = $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries); } else { $documents = Authorization::skip(fn () => $dbForProject->find('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $queries)); - $total = Authorization::skip(fn () => $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries, APP_LIMIT_COUNT)); + $total = Authorization::skip(fn () => $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries)); } /** @@ -2136,7 +2136,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID.') ->param('documentId', '', new UID(), 'Document ID.') - ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') @@ -2163,8 +2163,8 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; - $offset = $grouped['offset'] ?? 0; + $limit = $grouped['limit'] ?? null; + $offset = $grouped['offset'] ?? null; $audit = new Audit($dbForProject); $resource = 'database/' . $databaseId . '/collection/' . $collectionId . '/document/' . $document->getId(); diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 049d2cb850..e0cf4d3c8d 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -156,7 +156,7 @@ App::get('/v1/functions') $response->dynamic(new Document([ 'functions' => $dbForProject->find('functions', $queries), - 'total' => $dbForProject->count('functions', $filterQueries, APP_LIMIT_COUNT), + 'total' => $dbForProject->count('functions', $filterQueries), ]), Response::MODEL_FUNCTION_LIST); }); @@ -831,7 +831,7 @@ App::get('/v1/functions/:functionId/deployments') $filterQueries = Query::groupByType($queries)['filters']; $results = $dbForProject->find('deployments', $queries); - $total = $dbForProject->count('deployments', $filterQueries, APP_LIMIT_COUNT); + $total = $dbForProject->count('deployments', $filterQueries); foreach ($results as $result) { $build = $dbForProject->getDocument('builds', $result->getAttribute('buildId', '')); @@ -1265,7 +1265,7 @@ App::get('/v1/functions/:functionId/executions') $filterQueries = Query::groupByType($queries)['filters']; $results = $dbForProject->find('executions', $queries); - $total = $dbForProject->count('executions', $filterQueries, APP_LIMIT_COUNT); + $total = $dbForProject->count('executions', $filterQueries); $roles = Authorization::getRoles(); $isPrivilegedUser = Auth::isPrivilegedUser($roles); diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 29a193748d..d33283f41e 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -215,7 +215,7 @@ App::get('/v1/projects') $response->dynamic(new Document([ 'projects' => $dbForConsole->find('projects', $queries), - 'total' => $dbForConsole->count('projects', $filterQueries, APP_LIMIT_COUNT), + 'total' => $dbForConsole->count('projects', $filterQueries), ]), Response::MODEL_PROJECT_LIST); }); @@ -726,7 +726,6 @@ App::get('/v1/projects/:projectId/webhooks') $webhooks = $dbForConsole->find('webhooks', [ Query::equal('projectInternalId', [$project->getInternalId()]), - Query::limit(5000), ]); $response->dynamic(new Document([ @@ -974,7 +973,6 @@ App::get('/v1/projects/:projectId/keys') $keys = $dbForConsole->find('keys', [ Query::equal('projectInternalId', [$project->getInternalId()]), - Query::limit(5000), ]); $response->dynamic(new Document([ @@ -1176,7 +1174,6 @@ App::get('/v1/projects/:projectId/platforms') $platforms = $dbForConsole->find('platforms', [ Query::equal('projectId', [$project->getId()]), - Query::limit(5000), ]); $response->dynamic(new Document([ @@ -1394,7 +1391,6 @@ App::get('/v1/projects/:projectId/domains') $domains = $dbForConsole->find('domains', [ Query::equal('projectInternalId', [$project->getInternalId()]), - Query::limit(5000), ]); $response->dynamic(new Document([ diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 271f2af6b3..c42919282c 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -185,7 +185,7 @@ App::get('/v1/storage/buckets') $response->dynamic(new Document([ 'buckets' => $dbForProject->find('buckets', $queries), - 'total' => $dbForProject->count('buckets', $filterQueries, APP_LIMIT_COUNT), + 'total' => $dbForProject->count('buckets', $filterQueries), ]), Response::MODEL_BUCKET_LIST); }); @@ -730,10 +730,10 @@ App::get('/v1/storage/buckets/:bucketId/files') if ($fileSecurity && !$valid) { $files = $dbForProject->find('bucket_' . $bucket->getInternalId(), $queries); - $total = $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries, APP_LIMIT_COUNT); + $total = $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries); } else { $files = Authorization::skip(fn () => $dbForProject->find('bucket_' . $bucket->getInternalId(), $queries)); - $total = Authorization::skip(fn () => $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries, APP_LIMIT_COUNT)); + $total = Authorization::skip(fn () => $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries)); } $response->dynamic(new Document([ diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index f7ebae6381..0e33fd6049 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -163,7 +163,7 @@ App::get('/v1/teams') $filterQueries = Query::groupByType($queries)['filters']; $results = $dbForProject->find('teams', $queries); - $total = $dbForProject->count('teams', $filterQueries, APP_LIMIT_COUNT); + $total = $dbForProject->count('teams', $filterQueries); $response->dynamic(new Document([ 'teams' => $results, @@ -542,8 +542,7 @@ App::get('/v1/teams/:teamId/memberships') $total = $dbForProject->count( collection: 'memberships', - queries: $filterQueries, - max: APP_LIMIT_COUNT + queries: $filterQueries ); $memberships = array_filter($memberships, fn(Document $membership) => !empty($membership->getAttribute('userId'))); @@ -890,7 +889,7 @@ App::get('/v1/teams/:teamId/logs') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('teamId', '', new UID(), 'Team ID.') - ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') @@ -905,8 +904,8 @@ App::get('/v1/teams/:teamId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; - $offset = $grouped['offset'] ?? 0; + $limit = $grouped['limit'] ?? null; + $offset = $grouped['offset'] ?? null; $audit = new Audit($dbForProject); $resource = 'team/' . $team->getId(); diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 2a84c06675..4cc832975f 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -390,7 +390,7 @@ App::get('/v1/users') $response->dynamic(new Document([ 'users' => $dbForProject->find('users', $queries), - 'total' => $dbForProject->count('users', $filterQueries, APP_LIMIT_COUNT), + 'total' => $dbForProject->count('users', $filterQueries), ]), Response::MODEL_USER_LIST); }); @@ -543,7 +543,7 @@ App::get('/v1/users/:userId/logs') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('userId', '', new UID(), 'User ID.') - ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') @@ -558,8 +558,8 @@ App::get('/v1/users/:userId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; - $offset = $grouped['offset'] ?? 0; + $limit = $grouped['limit'] ?? null; + $offset = $grouped['offset'] ?? null; $audit = new Audit($dbForProject); diff --git a/app/init.php b/app/init.php index 44cda7a688..a37542c613 100644 --- a/app/init.php +++ b/app/init.php @@ -84,7 +84,6 @@ const APP_USERAGENT = APP_NAME . '-Server v%s. Please report abuse at %s'; const APP_MODE_DEFAULT = 'default'; const APP_MODE_ADMIN = 'admin'; const APP_PAGING_LIMIT = 12; -const APP_LIMIT_COUNT = 5000; const APP_LIMIT_USERS = 10000; const APP_LIMIT_USER_SESSIONS_MAX = 100; const APP_LIMIT_USER_SESSIONS_DEFAULT = 10; diff --git a/composer.json b/composer.json index 1711407ece..d5658104f3 100644 --- a/composer.json +++ b/composer.json @@ -43,13 +43,13 @@ "ext-sockets": "*", "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.11.*", - "utopia-php/abuse": "0.18.*", + "utopia-php/abuse": "dev-feat-remove-limits as 0.18.0", "utopia-php/analytics": "0.2.*", - "utopia-php/audit": "0.20.*", + "utopia-php/audit": "dev-feat-remove-limits as 0.20.0", "utopia-php/cache": "0.8.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.30.*", + "utopia-php/database": "dev-refactor-limits as 0.30.1", "utopia-php/preloader": "0.2.*", "utopia-php/domains": "1.1.*", "utopia-php/framework": "0.26.*", diff --git a/composer.lock b/composer.lock index 82a9de301f..f82c13c063 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": "ac80cafdd8c2c6deaec3dfe628084655", + "content-hash": "3143c47027eeb7f880d909543cc66a48", "packages": [ { "name": "adhocore/jwt", @@ -1808,29 +1808,28 @@ }, { "name": "utopia-php/abuse", - "version": "0.18.0", + "version": "dev-feat-remove-limits", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf" + "reference": "51dfdc53125eba3c377322976104a5eca45651b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", - "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/51dfdc53125eba3c377322976104a5eca45651b9", + "reference": "51dfdc53125eba3c377322976104a5eca45651b9", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.30.*" + "utopia-php/database": "dev-refactor-limits as 0.30.1" }, "require-dev": { "laravel/pint": "1.2.*", - "phpstan/phpstan": "1.9.x-dev", - "phpunit/phpunit": "^9.4", - "vimeo/psalm": "4.0.1" + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.4" }, "type": "library", "autoload": { @@ -1852,9 +1851,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.18.0" + "source": "https://github.com/utopia-php/abuse/tree/feat-remove-limits" }, - "time": "2023-02-14T09:56:04+00:00" + "time": "2023-02-20T04:11:09+00:00" }, { "name": "utopia-php/analytics", @@ -1913,28 +1912,26 @@ }, { "name": "utopia-php/audit", - "version": "0.20.0", + "version": "dev-feat-remove-limits", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "3fce3f4ad3ea9dfcb39b79668abd76331412a5ed" + "reference": "c3fe31ead91bdb7cd41e61df4dde76ef4a58661e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/3fce3f4ad3ea9dfcb39b79668abd76331412a5ed", - "reference": "3fce3f4ad3ea9dfcb39b79668abd76331412a5ed", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/c3fe31ead91bdb7cd41e61df4dde76ef4a58661e", + "reference": "c3fe31ead91bdb7cd41e61df4dde76ef4a58661e", "shasum": "" }, "require": { - "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.30.*" + "utopia-php/database": "dev-refactor-limits as 0.30.1" }, "require-dev": { "laravel/pint": "1.2.*", "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "autoload": { @@ -1956,9 +1953,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.20.0" + "source": "https://github.com/utopia-php/audit/tree/feat-remove-limits" }, - "time": "2023-02-14T09:46:54+00:00" + "time": "2023-02-20T03:50:56+00:00" }, { "name": "utopia-php/cache", @@ -2115,16 +2112,16 @@ }, { "name": "utopia-php/database", - "version": "0.30.1", + "version": "dev-refactor-limits", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65" + "reference": "d83a3e820c641ba0132c076172be9397df943a89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/1cea72c1217357bf0747ae4f28ebef57e9dc0e65", - "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65", + "url": "https://api.github.com/repos/utopia-php/database/zipball/d83a3e820c641ba0132c076172be9397df943a89", + "reference": "d83a3e820c641ba0132c076172be9397df943a89", "shasum": "" }, "require": { @@ -2163,9 +2160,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.30.1" + "source": "https://github.com/utopia-php/database/tree/refactor-limits" }, - "time": "2023-02-14T06:25:03+00:00" + "time": "2023-02-15T07:32:21+00:00" }, { "name": "utopia-php/domains", @@ -5564,9 +5561,32 @@ "time": "2023-02-08T07:49:20+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/abuse", + "version": "dev-feat-remove-limits", + "alias": "0.18.0", + "alias_normalized": "0.18.0.0" + }, + { + "package": "utopia-php/audit", + "version": "dev-feat-remove-limits", + "alias": "0.20.0", + "alias_normalized": "0.20.0.0" + }, + { + "package": "utopia-php/database", + "version": "dev-refactor-limits", + "alias": "0.30.1", + "alias_normalized": "0.30.1.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/abuse": 20, + "utopia-php/audit": 20, + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From 94c58c367b790e4eb3356b708dd55f4b18bdc0b2 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 20 Feb 2023 19:18:19 +1300 Subject: [PATCH 02/15] Add back configurable limit for offset/limit --- app/controllers/api/account.php | 2 +- app/controllers/api/databases.php | 8 ++++---- app/controllers/api/teams.php | 2 +- app/controllers/api/users.php | 2 +- src/Appwrite/Utopia/Database/Validator/Query/Limit.php | 2 +- src/Appwrite/Utopia/Database/Validator/Query/Offset.php | 3 +-- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 1174469313..9ab6cb9ca8 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1397,7 +1397,7 @@ App::get('/v1/account/logs') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) - ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('user') ->inject('locale') diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 11de905af6..3c433e8570 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -307,7 +307,7 @@ App::get('/v1/databases/:databaseId/logs') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('databaseId', '', new UID(), 'Database ID.') - ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') @@ -645,7 +645,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/logs') ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID.') - ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') @@ -2004,7 +2004,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents') } // Validate queries - $queriesValidator = new Documents($collection->getAttribute('attributes'), $collection->getAttribute('indexes')); + $queriesValidator = new Documents($collection->getAttribute('attributes')); $validQueries = $queriesValidator->isValid($queries); if (!$validQueries) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, $queriesValidator->getDescription()); @@ -2136,7 +2136,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID.') ->param('documentId', '', new UID(), 'Document ID.') - ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 0e33fd6049..b459e82a30 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -889,7 +889,7 @@ App::get('/v1/teams/:teamId/logs') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('teamId', '', new UID(), 'Team ID.') - ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 4cc832975f..9c625f4c38 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -543,7 +543,7 @@ App::get('/v1/users/:userId/logs') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_LOG_LIST) ->param('userId', '', new UID(), 'User ID.') - ->param('queries', [], new Queries(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) + ->param('queries', [], new Queries(new Limit(), new Offset()), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset', true) ->inject('response') ->inject('dbForProject') ->inject('locale') diff --git a/src/Appwrite/Utopia/Database/Validator/Query/Limit.php b/src/Appwrite/Utopia/Database/Validator/Query/Limit.php index 232df93666..7a99825bcd 100644 --- a/src/Appwrite/Utopia/Database/Validator/Query/Limit.php +++ b/src/Appwrite/Utopia/Database/Validator/Query/Limit.php @@ -15,7 +15,7 @@ class Limit extends Base * * @param int $maxLimit */ - public function __construct(int $maxLimit = 100) + public function __construct(int $maxLimit = PHP_INT_MAX) { $this->maxLimit = $maxLimit; } diff --git a/src/Appwrite/Utopia/Database/Validator/Query/Offset.php b/src/Appwrite/Utopia/Database/Validator/Query/Offset.php index 9f832a7c62..0bcbb909fa 100644 --- a/src/Appwrite/Utopia/Database/Validator/Query/Offset.php +++ b/src/Appwrite/Utopia/Database/Validator/Query/Offset.php @@ -2,7 +2,6 @@ namespace Appwrite\Utopia\Database\Validator\Query; -use Appwrite\Utopia\Database\Validator\Query\Base; use Utopia\Database\Query; use Utopia\Validator\Range; @@ -15,7 +14,7 @@ class Offset extends Base * * @param int $maxOffset */ - public function __construct(int $maxOffset = 5000) + public function __construct(int $maxOffset = PHP_INT_MAX) { $this->maxOffset = $maxOffset; } From 17fec2690a99761784819fbf1d044e2162f26ab4 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 20 Feb 2023 19:26:17 +1300 Subject: [PATCH 03/15] Add back param --- app/controllers/api/databases.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 3c433e8570..9b13600a86 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -2004,7 +2004,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents') } // Validate queries - $queriesValidator = new Documents($collection->getAttribute('attributes')); + $queriesValidator = new Documents($collection->getAttribute('attributes'), $collection->getAttribute('indexes')); $validQueries = $queriesValidator->isValid($queries); if (!$validQueries) { throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, $queriesValidator->getDescription()); From 32fd00031dc31c38fe3380114f1808b5833645bc Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 21 Feb 2023 14:21:23 +1300 Subject: [PATCH 04/15] Update audit --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index f82c13c063..b35a6d76b9 100644 --- a/composer.lock +++ b/composer.lock @@ -1916,12 +1916,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "c3fe31ead91bdb7cd41e61df4dde76ef4a58661e" + "reference": "e34e229ccd3a0a68b1bdf9f45196eb0cac595bc7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/c3fe31ead91bdb7cd41e61df4dde76ef4a58661e", - "reference": "c3fe31ead91bdb7cd41e61df4dde76ef4a58661e", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/e34e229ccd3a0a68b1bdf9f45196eb0cac595bc7", + "reference": "e34e229ccd3a0a68b1bdf9f45196eb0cac595bc7", "shasum": "" }, "require": { @@ -1955,7 +1955,7 @@ "issues": "https://github.com/utopia-php/audit/issues", "source": "https://github.com/utopia-php/audit/tree/feat-remove-limits" }, - "time": "2023-02-20T03:50:56+00:00" + "time": "2023-02-20T09:26:53+00:00" }, { "name": "utopia-php/cache", From b2fc7cc25adace9a323090b0b47acb54626c5150 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 21 Feb 2023 17:59:10 +1300 Subject: [PATCH 05/15] Remove redundant test --- tests/e2e/Services/Users/UsersBase.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index fde65e94ec..416be18079 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -1080,15 +1080,6 @@ trait UsersBase $this->assertEquals($response['headers']['status-code'], 400); - $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => ['limit(101)'] - ]); - - $this->assertEquals($response['headers']['status-code'], 400); - $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], From 8c5220f4559cff3c79da38bd2c333ea2cafe0899 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 21 Feb 2023 19:43:59 +1300 Subject: [PATCH 06/15] Remove redundant test --- tests/e2e/Services/Users/UsersBase.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index 416be18079..ae523a06f0 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -1089,14 +1089,6 @@ trait UsersBase $this->assertEquals($response['headers']['status-code'], 400); - $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => ['offset(5001)'] - ]); - - $this->assertEquals($response['headers']['status-code'], 400); $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ 'content-type' => 'application/json', From 73a47b56247cf022634511813654bc4de9a5cb7f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 28 Feb 2023 16:40:25 +1300 Subject: [PATCH 07/15] Revert "Remove redundant test" This reverts commit 8c5220f4559cff3c79da38bd2c333ea2cafe0899. --- tests/e2e/Services/Users/UsersBase.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index ae523a06f0..416be18079 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -1089,6 +1089,14 @@ trait UsersBase $this->assertEquals($response['headers']['status-code'], 400); + $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => ['offset(5001)'] + ]); + + $this->assertEquals($response['headers']['status-code'], 400); $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ 'content-type' => 'application/json', From 04c1d3ca7f093a73b22d23c622a52cdf595d1a00 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 28 Feb 2023 16:40:52 +1300 Subject: [PATCH 08/15] Revert "Remove redundant test" This reverts commit b2fc7cc25adace9a323090b0b47acb54626c5150. --- tests/e2e/Services/Users/UsersBase.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index 416be18079..fde65e94ec 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -1080,6 +1080,15 @@ trait UsersBase $this->assertEquals($response['headers']['status-code'], 400); + $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => ['limit(101)'] + ]); + + $this->assertEquals($response['headers']['status-code'], 400); + $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], From 84f48131353b742418857b23b9a55efcc92ec7ba Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 28 Feb 2023 16:42:21 +1300 Subject: [PATCH 09/15] Revert "Remove count, limit and offset limitations" This reverts commit ae3535de0dc27774672645ed903b8b4aef78bdf3. # Conflicts: # composer.lock --- app/controllers/api/account.php | 4 +- app/controllers/api/databases.php | 20 ++++----- app/controllers/api/functions.php | 6 +-- app/controllers/api/projects.php | 6 ++- app/controllers/api/storage.php | 6 +-- app/controllers/api/teams.php | 9 ++-- app/controllers/api/users.php | 6 +-- app/init.php | 1 + composer.json | 6 +-- composer.lock | 70 +++++++++++-------------------- 10 files changed, 60 insertions(+), 74 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 9ab6cb9ca8..1a5d6f7b00 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1407,8 +1407,8 @@ App::get('/v1/account/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? null; - $offset = $grouped['offset'] ?? null; + $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; + $offset = $grouped['offset'] ?? 0; $audit = new EventAudit($dbForProject); diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 9b13600a86..88242482a1 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -265,7 +265,7 @@ App::get('/v1/databases') $response->dynamic(new Document([ 'databases' => $dbForProject->find('databases', $queries), - 'total' => $dbForProject->count('databases', $filterQueries), + 'total' => $dbForProject->count('databases', $filterQueries, APP_LIMIT_COUNT), ]), Response::MODEL_DATABASE_LIST); }); @@ -322,8 +322,8 @@ App::get('/v1/databases/:databaseId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? null; - $offset = $grouped['offset'] ?? null; + $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; + $offset = $grouped['offset'] ?? 0; $audit = new Audit($dbForProject); $resource = 'database/' . $databaseId; @@ -590,7 +590,7 @@ App::get('/v1/databases/:databaseId/collections') $response->dynamic(new Document([ 'collections' => $dbForProject->find('database_' . $database->getInternalId(), $queries), - 'total' => $dbForProject->count('database_' . $database->getInternalId(), $filterQueries), + 'total' => $dbForProject->count('database_' . $database->getInternalId(), $filterQueries, APP_LIMIT_COUNT), ]), Response::MODEL_COLLECTION_LIST); }); @@ -666,8 +666,8 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? null; - $offset = $grouped['offset'] ?? null; + $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; + $offset = $grouped['offset'] ?? 0; $audit = new Audit($dbForProject); $resource = 'database/' . $databaseId . '/collection/' . $collectionId; @@ -2036,10 +2036,10 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents') if ($documentSecurity && !$valid) { $documents = $dbForProject->find('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $queries); - $total = $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries); + $total = $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries, APP_LIMIT_COUNT); } else { $documents = Authorization::skip(fn () => $dbForProject->find('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $queries)); - $total = Authorization::skip(fn () => $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries)); + $total = Authorization::skip(fn () => $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $filterQueries, APP_LIMIT_COUNT)); } /** @@ -2163,8 +2163,8 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? null; - $offset = $grouped['offset'] ?? null; + $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; + $offset = $grouped['offset'] ?? 0; $audit = new Audit($dbForProject); $resource = 'database/' . $databaseId . '/collection/' . $collectionId . '/document/' . $document->getId(); diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index e0cf4d3c8d..049d2cb850 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -156,7 +156,7 @@ App::get('/v1/functions') $response->dynamic(new Document([ 'functions' => $dbForProject->find('functions', $queries), - 'total' => $dbForProject->count('functions', $filterQueries), + 'total' => $dbForProject->count('functions', $filterQueries, APP_LIMIT_COUNT), ]), Response::MODEL_FUNCTION_LIST); }); @@ -831,7 +831,7 @@ App::get('/v1/functions/:functionId/deployments') $filterQueries = Query::groupByType($queries)['filters']; $results = $dbForProject->find('deployments', $queries); - $total = $dbForProject->count('deployments', $filterQueries); + $total = $dbForProject->count('deployments', $filterQueries, APP_LIMIT_COUNT); foreach ($results as $result) { $build = $dbForProject->getDocument('builds', $result->getAttribute('buildId', '')); @@ -1265,7 +1265,7 @@ App::get('/v1/functions/:functionId/executions') $filterQueries = Query::groupByType($queries)['filters']; $results = $dbForProject->find('executions', $queries); - $total = $dbForProject->count('executions', $filterQueries); + $total = $dbForProject->count('executions', $filterQueries, APP_LIMIT_COUNT); $roles = Authorization::getRoles(); $isPrivilegedUser = Auth::isPrivilegedUser($roles); diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index d33283f41e..29a193748d 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -215,7 +215,7 @@ App::get('/v1/projects') $response->dynamic(new Document([ 'projects' => $dbForConsole->find('projects', $queries), - 'total' => $dbForConsole->count('projects', $filterQueries), + 'total' => $dbForConsole->count('projects', $filterQueries, APP_LIMIT_COUNT), ]), Response::MODEL_PROJECT_LIST); }); @@ -726,6 +726,7 @@ App::get('/v1/projects/:projectId/webhooks') $webhooks = $dbForConsole->find('webhooks', [ Query::equal('projectInternalId', [$project->getInternalId()]), + Query::limit(5000), ]); $response->dynamic(new Document([ @@ -973,6 +974,7 @@ App::get('/v1/projects/:projectId/keys') $keys = $dbForConsole->find('keys', [ Query::equal('projectInternalId', [$project->getInternalId()]), + Query::limit(5000), ]); $response->dynamic(new Document([ @@ -1174,6 +1176,7 @@ App::get('/v1/projects/:projectId/platforms') $platforms = $dbForConsole->find('platforms', [ Query::equal('projectId', [$project->getId()]), + Query::limit(5000), ]); $response->dynamic(new Document([ @@ -1391,6 +1394,7 @@ App::get('/v1/projects/:projectId/domains') $domains = $dbForConsole->find('domains', [ Query::equal('projectInternalId', [$project->getInternalId()]), + Query::limit(5000), ]); $response->dynamic(new Document([ diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index c42919282c..271f2af6b3 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -185,7 +185,7 @@ App::get('/v1/storage/buckets') $response->dynamic(new Document([ 'buckets' => $dbForProject->find('buckets', $queries), - 'total' => $dbForProject->count('buckets', $filterQueries), + 'total' => $dbForProject->count('buckets', $filterQueries, APP_LIMIT_COUNT), ]), Response::MODEL_BUCKET_LIST); }); @@ -730,10 +730,10 @@ App::get('/v1/storage/buckets/:bucketId/files') if ($fileSecurity && !$valid) { $files = $dbForProject->find('bucket_' . $bucket->getInternalId(), $queries); - $total = $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries); + $total = $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries, APP_LIMIT_COUNT); } else { $files = Authorization::skip(fn () => $dbForProject->find('bucket_' . $bucket->getInternalId(), $queries)); - $total = Authorization::skip(fn () => $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries)); + $total = Authorization::skip(fn () => $dbForProject->count('bucket_' . $bucket->getInternalId(), $filterQueries, APP_LIMIT_COUNT)); } $response->dynamic(new Document([ diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index b459e82a30..f7ebae6381 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -163,7 +163,7 @@ App::get('/v1/teams') $filterQueries = Query::groupByType($queries)['filters']; $results = $dbForProject->find('teams', $queries); - $total = $dbForProject->count('teams', $filterQueries); + $total = $dbForProject->count('teams', $filterQueries, APP_LIMIT_COUNT); $response->dynamic(new Document([ 'teams' => $results, @@ -542,7 +542,8 @@ App::get('/v1/teams/:teamId/memberships') $total = $dbForProject->count( collection: 'memberships', - queries: $filterQueries + queries: $filterQueries, + max: APP_LIMIT_COUNT ); $memberships = array_filter($memberships, fn(Document $membership) => !empty($membership->getAttribute('userId'))); @@ -904,8 +905,8 @@ App::get('/v1/teams/:teamId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? null; - $offset = $grouped['offset'] ?? null; + $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; + $offset = $grouped['offset'] ?? 0; $audit = new Audit($dbForProject); $resource = 'team/' . $team->getId(); diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 9c625f4c38..2a84c06675 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -390,7 +390,7 @@ App::get('/v1/users') $response->dynamic(new Document([ 'users' => $dbForProject->find('users', $queries), - 'total' => $dbForProject->count('users', $filterQueries), + 'total' => $dbForProject->count('users', $filterQueries, APP_LIMIT_COUNT), ]), Response::MODEL_USER_LIST); }); @@ -558,8 +558,8 @@ App::get('/v1/users/:userId/logs') $queries = Query::parseQueries($queries); $grouped = Query::groupByType($queries); - $limit = $grouped['limit'] ?? null; - $offset = $grouped['offset'] ?? null; + $limit = $grouped['limit'] ?? APP_LIMIT_COUNT; + $offset = $grouped['offset'] ?? 0; $audit = new Audit($dbForProject); diff --git a/app/init.php b/app/init.php index a37542c613..44cda7a688 100644 --- a/app/init.php +++ b/app/init.php @@ -84,6 +84,7 @@ const APP_USERAGENT = APP_NAME . '-Server v%s. Please report abuse at %s'; const APP_MODE_DEFAULT = 'default'; const APP_MODE_ADMIN = 'admin'; const APP_PAGING_LIMIT = 12; +const APP_LIMIT_COUNT = 5000; const APP_LIMIT_USERS = 10000; const APP_LIMIT_USER_SESSIONS_MAX = 100; const APP_LIMIT_USER_SESSIONS_DEFAULT = 10; diff --git a/composer.json b/composer.json index d5658104f3..1711407ece 100644 --- a/composer.json +++ b/composer.json @@ -43,13 +43,13 @@ "ext-sockets": "*", "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.11.*", - "utopia-php/abuse": "dev-feat-remove-limits as 0.18.0", + "utopia-php/abuse": "0.18.*", "utopia-php/analytics": "0.2.*", - "utopia-php/audit": "dev-feat-remove-limits as 0.20.0", + "utopia-php/audit": "0.20.*", "utopia-php/cache": "0.8.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "dev-refactor-limits as 0.30.1", + "utopia-php/database": "0.30.*", "utopia-php/preloader": "0.2.*", "utopia-php/domains": "1.1.*", "utopia-php/framework": "0.26.*", diff --git a/composer.lock b/composer.lock index b35a6d76b9..01f66a583f 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": "3143c47027eeb7f880d909543cc66a48", + "content-hash": "ac80cafdd8c2c6deaec3dfe628084655", "packages": [ { "name": "adhocore/jwt", @@ -1808,28 +1808,29 @@ }, { "name": "utopia-php/abuse", - "version": "dev-feat-remove-limits", + "version": "0.18.0", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "51dfdc53125eba3c377322976104a5eca45651b9" + "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/51dfdc53125eba3c377322976104a5eca45651b9", - "reference": "51dfdc53125eba3c377322976104a5eca45651b9", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", + "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "dev-refactor-limits as 0.30.1" + "utopia-php/database": "0.30.*" }, "require-dev": { "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.9", - "phpunit/phpunit": "^9.4" + "phpstan/phpstan": "1.9.x-dev", + "phpunit/phpunit": "^9.4", + "vimeo/psalm": "4.0.1" }, "type": "library", "autoload": { @@ -1851,9 +1852,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/feat-remove-limits" + "source": "https://github.com/utopia-php/abuse/tree/0.18.0" }, - "time": "2023-02-20T04:11:09+00:00" + "time": "2023-02-14T09:56:04+00:00" }, { "name": "utopia-php/analytics", @@ -1912,7 +1913,7 @@ }, { "name": "utopia-php/audit", - "version": "dev-feat-remove-limits", + "version": "0.20.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", @@ -1925,13 +1926,15 @@ "shasum": "" }, "require": { + "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "dev-refactor-limits as 0.30.1" + "utopia-php/database": "0.30.*" }, "require-dev": { "laravel/pint": "1.2.*", "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.3", + "vimeo/psalm": "4.0.1" }, "type": "library", "autoload": { @@ -1953,7 +1956,7 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/feat-remove-limits" + "source": "https://github.com/utopia-php/audit/tree/0.20.0" }, "time": "2023-02-20T09:26:53+00:00" }, @@ -2112,16 +2115,16 @@ }, { "name": "utopia-php/database", - "version": "dev-refactor-limits", + "version": "0.30.1", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "d83a3e820c641ba0132c076172be9397df943a89" + "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/d83a3e820c641ba0132c076172be9397df943a89", - "reference": "d83a3e820c641ba0132c076172be9397df943a89", + "url": "https://api.github.com/repos/utopia-php/database/zipball/1cea72c1217357bf0747ae4f28ebef57e9dc0e65", + "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65", "shasum": "" }, "require": { @@ -2160,9 +2163,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/refactor-limits" + "source": "https://github.com/utopia-php/database/tree/0.30.1" }, - "time": "2023-02-15T07:32:21+00:00" + "time": "2023-02-14T06:25:03+00:00" }, { "name": "utopia-php/domains", @@ -5561,32 +5564,9 @@ "time": "2023-02-08T07:49:20+00:00" } ], - "aliases": [ - { - "package": "utopia-php/abuse", - "version": "dev-feat-remove-limits", - "alias": "0.18.0", - "alias_normalized": "0.18.0.0" - }, - { - "package": "utopia-php/audit", - "version": "dev-feat-remove-limits", - "alias": "0.20.0", - "alias_normalized": "0.20.0.0" - }, - { - "package": "utopia-php/database", - "version": "dev-refactor-limits", - "alias": "0.30.1", - "alias_normalized": "0.30.1.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/abuse": 20, - "utopia-php/audit": 20, - "utopia-php/database": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 66a7b652e6fedcb8c0c13271fe5134c3fb29b041 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 28 Feb 2023 16:48:27 +1300 Subject: [PATCH 10/15] Update lock --- composer.json | 8 +++--- composer.lock | 78 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 53 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index 1711407ece..87ef2395b1 100644 --- a/composer.json +++ b/composer.json @@ -43,14 +43,13 @@ "ext-sockets": "*", "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.11.*", - "utopia-php/abuse": "0.18.*", + "utopia-php/abuse": "dev-feat-remove-limits as 0.19.0", "utopia-php/analytics": "0.2.*", - "utopia-php/audit": "0.20.*", + "utopia-php/audit": "dev-feat-remove-limits as 0.21.0", "utopia-php/cache": "0.8.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.30.*", - "utopia-php/preloader": "0.2.*", + "utopia-php/database": "dev-refactor-limits as 0.31.0", "utopia-php/domains": "1.1.*", "utopia-php/framework": "0.26.*", "utopia-php/image": "0.5.*", @@ -58,6 +57,7 @@ "utopia-php/logger": "0.3.*", "utopia-php/messaging": "0.1.*", "utopia-php/orchestration": "0.6.*", + "utopia-php/preloader": "0.2.*", "utopia-php/registry": "0.5.*", "utopia-php/storage": "0.13.*", "utopia-php/swoole": "0.5.*", diff --git a/composer.lock b/composer.lock index 01f66a583f..52c4fe1499 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": "ac80cafdd8c2c6deaec3dfe628084655", + "content-hash": "182c6b70bc5233d72760516c0e975a6a", "packages": [ { "name": "adhocore/jwt", @@ -1808,29 +1808,28 @@ }, { "name": "utopia-php/abuse", - "version": "0.18.0", + "version": "dev-feat-remove-limits", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf" + "reference": "3aec5712305646e37faefb6e0f31b6da1ca5fa94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", - "reference": "8496401234f73a49f8c4259d3e89ab4a7c1f9ecf", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/3aec5712305646e37faefb6e0f31b6da1ca5fa94", + "reference": "3aec5712305646e37faefb6e0f31b6da1ca5fa94", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.30.*" + "utopia-php/database": "dev-refactor-limits as 0.31.0" }, "require-dev": { "laravel/pint": "1.2.*", - "phpstan/phpstan": "1.9.x-dev", - "phpunit/phpunit": "^9.4", - "vimeo/psalm": "4.0.1" + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.4" }, "type": "library", "autoload": { @@ -1852,9 +1851,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.18.0" + "source": "https://github.com/utopia-php/abuse/tree/feat-remove-limits" }, - "time": "2023-02-14T09:56:04+00:00" + "time": "2023-02-28T03:33:13+00:00" }, { "name": "utopia-php/analytics", @@ -1913,28 +1912,26 @@ }, { "name": "utopia-php/audit", - "version": "0.20.0", + "version": "dev-feat-remove-limits", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "e34e229ccd3a0a68b1bdf9f45196eb0cac595bc7" + "reference": "96e63b08935b665923f4bf4071e6714f0170fcd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/e34e229ccd3a0a68b1bdf9f45196eb0cac595bc7", - "reference": "e34e229ccd3a0a68b1bdf9f45196eb0cac595bc7", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/96e63b08935b665923f4bf4071e6714f0170fcd0", + "reference": "96e63b08935b665923f4bf4071e6714f0170fcd0", "shasum": "" }, "require": { - "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "0.30.*" + "utopia-php/database": "dev-refactor-limits as 0.31.0" }, "require-dev": { "laravel/pint": "1.2.*", "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "autoload": { @@ -1956,9 +1953,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.20.0" + "source": "https://github.com/utopia-php/audit/tree/feat-remove-limits" }, - "time": "2023-02-20T09:26:53+00:00" + "time": "2023-02-28T03:35:15+00:00" }, { "name": "utopia-php/cache", @@ -2115,16 +2112,16 @@ }, { "name": "utopia-php/database", - "version": "0.30.1", + "version": "dev-refactor-limits", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65" + "reference": "0cc311fcc6453045c8abfd32d4251a23432dec21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/1cea72c1217357bf0747ae4f28ebef57e9dc0e65", - "reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0cc311fcc6453045c8abfd32d4251a23432dec21", + "reference": "0cc311fcc6453045c8abfd32d4251a23432dec21", "shasum": "" }, "require": { @@ -2163,9 +2160,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.30.1" + "source": "https://github.com/utopia-php/database/tree/refactor-limits" }, - "time": "2023-02-14T06:25:03+00:00" + "time": "2023-02-28T03:27:21+00:00" }, { "name": "utopia-php/domains", @@ -5564,9 +5561,32 @@ "time": "2023-02-08T07:49:20+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/abuse", + "version": "dev-feat-remove-limits", + "alias": "0.19.0", + "alias_normalized": "0.19.0.0" + }, + { + "package": "utopia-php/audit", + "version": "dev-feat-remove-limits", + "alias": "0.21.0", + "alias_normalized": "0.21.0.0" + }, + { + "package": "utopia-php/database", + "version": "dev-refactor-limits", + "alias": "0.31.0", + "alias_normalized": "0.31.0.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/abuse": 20, + "utopia-php/audit": 20, + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From 5f965e6dad3fc4dbde41dd83aef7951dc629b868 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 23 Mar 2023 15:15:57 +1300 Subject: [PATCH 11/15] Trigger workflow --- app/controllers/api/functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 049d2cb850..1d0d5b05d5 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -583,6 +583,7 @@ App::delete('/v1/functions/:functionId') $response->noContent(); }); + App::post('/v1/functions/:functionId/deployments') ->groups(['api', 'functions']) ->desc('Create Deployment') From 18bdb6ae3ef95ac986c874ed56a6db12ac716a3d Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 23 Mar 2023 15:16:24 +1300 Subject: [PATCH 12/15] Revert "Trigger workflow" This reverts commit 5f965e6dad3fc4dbde41dd83aef7951dc629b868. --- app/controllers/api/functions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 1d0d5b05d5..049d2cb850 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -583,7 +583,6 @@ App::delete('/v1/functions/:functionId') $response->noContent(); }); - App::post('/v1/functions/:functionId/deployments') ->groups(['api', 'functions']) ->desc('Create Deployment') From f43ff0d2e9dd84e986fd7652001a2e7e9160f141 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 23 Mar 2023 18:40:05 +1300 Subject: [PATCH 13/15] Update dependencies --- composer.json | 6 +- composer.lock | 281 +++++++++++++++++++++++++++++++------------------- 2 files changed, 180 insertions(+), 107 deletions(-) diff --git a/composer.json b/composer.json index 87ef2395b1..0375d645f2 100644 --- a/composer.json +++ b/composer.json @@ -43,13 +43,13 @@ "ext-sockets": "*", "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.11.*", - "utopia-php/abuse": "dev-feat-remove-limits as 0.19.0", + "utopia-php/abuse": "0.22.*", "utopia-php/analytics": "0.2.*", - "utopia-php/audit": "dev-feat-remove-limits as 0.21.0", + "utopia-php/audit": "0.24.*", "utopia-php/cache": "0.8.*", "utopia-php/cli": "0.13.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "dev-refactor-limits as 0.31.0", + "utopia-php/database": "0.34.*", "utopia-php/domains": "1.1.*", "utopia-php/framework": "0.26.*", "utopia-php/image": "0.5.*", diff --git a/composer.lock b/composer.lock index 52c4fe1499..c51dc6bae1 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": "182c6b70bc5233d72760516c0e975a6a", + "content-hash": "6607a4cd423907c91a43af2609c96b52", "packages": [ { "name": "adhocore/jwt", @@ -693,16 +693,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.4.3", + "version": "2.4.4", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "67c26b443f348a51926030c83481b85718457d3d" + "reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", - "reference": "67c26b443f348a51926030c83481b85718457d3d", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf", + "reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf", "shasum": "" }, "require": { @@ -792,7 +792,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.3" + "source": "https://github.com/guzzle/psr7/tree/2.4.4" }, "funding": [ { @@ -808,7 +808,7 @@ "type": "tidelift" } ], - "time": "2022-10-26T14:07:24+00:00" + "time": "2023-03-09T13:19:02+00:00" }, { "name": "influxdb/influxdb-php", @@ -1658,16 +1658,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", "shasum": "" }, "require": { @@ -1705,7 +1705,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { @@ -1721,7 +1721,7 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:25:55+00:00" }, { "name": "symfony/polyfill-php80", @@ -1808,23 +1808,23 @@ }, { "name": "utopia-php/abuse", - "version": "dev-feat-remove-limits", + "version": "0.22.0", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "3aec5712305646e37faefb6e0f31b6da1ca5fa94" + "reference": "8b873d6ed8e24fb763553093008b215b4a66ce5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/3aec5712305646e37faefb6e0f31b6da1ca5fa94", - "reference": "3aec5712305646e37faefb6e0f31b6da1ca5fa94", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8b873d6ed8e24fb763553093008b215b4a66ce5d", + "reference": "8b873d6ed8e24fb763553093008b215b4a66ce5d", "shasum": "" }, "require": { "ext-curl": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/database": "dev-refactor-limits as 0.31.0" + "utopia-php/database": "0.34.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -1851,9 +1851,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/feat-remove-limits" + "source": "https://github.com/utopia-php/abuse/tree/0.22.0" }, - "time": "2023-02-28T03:33:13+00:00" + "time": "2023-03-23T05:28:32+00:00" }, { "name": "utopia-php/analytics", @@ -1912,21 +1912,21 @@ }, { "name": "utopia-php/audit", - "version": "dev-feat-remove-limits", + "version": "0.24.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "96e63b08935b665923f4bf4071e6714f0170fcd0" + "reference": "38a4988a617890f1c2996bf0d12fec80a6c06da9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/96e63b08935b665923f4bf4071e6714f0170fcd0", - "reference": "96e63b08935b665923f4bf4071e6714f0170fcd0", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/38a4988a617890f1c2996bf0d12fec80a6c06da9", + "reference": "38a4988a617890f1c2996bf0d12fec80a6c06da9", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/database": "dev-refactor-limits as 0.31.0" + "utopia-php/database": "0.34.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -1953,9 +1953,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/feat-remove-limits" + "source": "https://github.com/utopia-php/audit/tree/0.24.0" }, - "time": "2023-02-28T03:35:15+00:00" + "time": "2023-03-23T05:33:06+00:00" }, { "name": "utopia-php/cache", @@ -2112,33 +2112,37 @@ }, { "name": "utopia-php/database", - "version": "dev-refactor-limits", + "version": "0.34.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "0cc311fcc6453045c8abfd32d4251a23432dec21" + "reference": "c0b2d93cd5b867f9816d89aa7883dda7e8373ea5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/0cc311fcc6453045c8abfd32d4251a23432dec21", - "reference": "0cc311fcc6453045c8abfd32d4251a23432dec21", + "url": "https://api.github.com/repos/utopia-php/database/zipball/c0b2d93cd5b867f9816d89aa7883dda7e8373ea5", + "reference": "c0b2d93cd5b867f9816d89aa7883dda7e8373ea5", "shasum": "" }, "require": { + "ext-pdo": "*", "php": ">=8.0", "utopia-php/cache": "0.8.*", "utopia-php/framework": "0.*.*", - "utopia-php/mongo": "0.0.2" + "utopia-php/mongo": "0.1.*" }, "require-dev": { "ext-mongodb": "*", "ext-redis": "*", "fakerphp/faker": "^1.14", + "laravel/pint": "1.4.*", "mongodb/mongodb": "1.8.0", + "pcov/clobber": "^2.0", + "phpstan/phpstan": "1.9.*", "phpunit/phpunit": "^9.4", + "rregeer/phpunit-coverage-check": "^0.3.1", "swoole/ide-helper": "4.8.0", - "utopia-php/cli": "^0.14.0", - "vimeo/psalm": "4.0.1" + "utopia-php/cli": "^0.14.0" }, "type": "library", "autoload": { @@ -2150,7 +2154,7 @@ "license": [ "MIT" ], - "description": "A simple library to manage application persistency using multiple database adapters", + "description": "A simple library to manage application persistence using multiple database adapters", "keywords": [ "database", "framework", @@ -2160,9 +2164,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/refactor-limits" + "source": "https://github.com/utopia-php/database/tree/0.34.0" }, - "time": "2023-02-28T03:27:21+00:00" + "time": "2023-03-23T05:24:05+00:00" }, { "name": "utopia-php/domains", @@ -2468,16 +2472,16 @@ }, { "name": "utopia-php/mongo", - "version": "0.0.2", + "version": "0.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/mongo.git", - "reference": "62f9a9c0201af91b6d0dd4f0aa8a335ec9b56a1e" + "reference": "f4b6ec74c5323ca16c500dd19109518d2eeb1f8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/mongo/zipball/62f9a9c0201af91b6d0dd4f0aa8a335ec9b56a1e", - "reference": "62f9a9c0201af91b6d0dd4f0aa8a335ec9b56a1e", + "url": "https://api.github.com/repos/utopia-php/mongo/zipball/f4b6ec74c5323ca16c500dd19109518d2eeb1f8f", + "reference": "f4b6ec74c5323ca16c500dd19109518d2eeb1f8f", "shasum": "" }, "require": { @@ -2522,9 +2526,9 @@ ], "support": { "issues": "https://github.com/utopia-php/mongo/issues", - "source": "https://github.com/utopia-php/mongo/tree/0.0.2" + "source": "https://github.com/utopia-php/mongo/tree/0.1.0" }, - "time": "2022-11-08T11:58:46+00:00" + "time": "2023-01-12T14:02:08+00:00" }, { "name": "utopia-php/orchestration", @@ -3084,6 +3088,49 @@ }, "time": "2023-02-03T05:44:59+00:00" }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, { "name": "doctrine/instantiator", "version": "1.5.0", @@ -3280,16 +3327,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -3327,7 +3374,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -3335,20 +3382,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -3389,9 +3436,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "phar-io/manifest", @@ -3616,24 +3663,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -3665,9 +3715,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.0" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2023-03-12T10:13:29+00:00" }, { "name": "phpspec/prophecy", @@ -3738,24 +3788,69 @@ "time": "2023-02-02T15:41:36+00:00" }, { - "name": "phpunit/php-code-coverage", - "version": "9.2.24", + "name": "phpstan/phpdoc-parser", + "version": "1.16.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1" + }, + "time": "2023-02-07T18:11:17+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.26", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -3770,8 +3865,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -3804,7 +3899,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" }, "funding": [ { @@ -3812,7 +3907,7 @@ "type": "github" } ], - "time": "2023-01-26T08:26:55+00:00" + "time": "2023-03-06T12:58:08+00:00" }, { "name": "phpunit/php-file-iterator", @@ -5124,16 +5219,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -5169,14 +5264,15 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "swoole/ide-helper", @@ -5561,32 +5657,9 @@ "time": "2023-02-08T07:49:20+00:00" } ], - "aliases": [ - { - "package": "utopia-php/abuse", - "version": "dev-feat-remove-limits", - "alias": "0.19.0", - "alias_normalized": "0.19.0.0" - }, - { - "package": "utopia-php/audit", - "version": "dev-feat-remove-limits", - "alias": "0.21.0", - "alias_normalized": "0.21.0.0" - }, - { - "package": "utopia-php/database", - "version": "dev-refactor-limits", - "alias": "0.31.0", - "alias_normalized": "0.31.0.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/abuse": 20, - "utopia-php/audit": 20, - "utopia-php/database": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 702000ac2f6257fe2a7097f42aee19385376bf7d Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 24 Mar 2023 22:28:39 +1300 Subject: [PATCH 14/15] Remove redundant test --- tests/e2e/Services/Users/UsersBase.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index b12aa27831..13b8aa8b76 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -1080,15 +1080,6 @@ trait UsersBase $this->assertEquals($response['headers']['status-code'], 400); - $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => ['limit(101)'] - ]); - - $this->assertEquals($response['headers']['status-code'], 400); - $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], From 47586fedb5e3b504b8a921add8bd15fe955adb26 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 24 Mar 2023 23:09:49 +1300 Subject: [PATCH 15/15] Remove invalid test --- tests/e2e/Services/Users/UsersBase.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index 13b8aa8b76..9f14c59306 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -1089,15 +1089,6 @@ trait UsersBase $this->assertEquals($response['headers']['status-code'], 400); - $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => ['offset(5001)'] - ]); - - $this->assertEquals($response['headers']['status-code'], 400); - $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/logs', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'],