Compare commits

...
Author SHA1 Message Date
fogelito fa3c9a5b76 Remove comment 2026-01-12 16:24:42 +02:00
fogelito c388fea5d0 fix Filters 2026-01-12 16:19:48 +02:00
fogelito a407d2ea84 formatting 2026-01-12 15:42:01 +02:00
fogelito da56ef39f8 remove static 2026-01-12 15:39:36 +02:00
fogelito 275b9a1186 coderabbit comments 2026-01-12 15:35:19 +02:00
fogelito 2f514ae55e Fix message 2026-01-12 15:10:52 +02:00
fogelito 38517b8004 Fix message 2026-01-12 15:02:30 +02:00
fogelito 8758e2e5a0 Run 2026-01-12 12:43:53 +02:00
fogelito dacc6a97d0 disbaled internals 2026-01-12 08:28:50 +02:00
fogelito 13fc2222f8 Update message 2026-01-11 16:37:05 +02:00
fogelito 900d8f248e allowedAttributes 2026-01-11 16:22:19 +02:00
fogelito de572c3aa9 composer 2026-01-11 15:06:55 +02:00
fogelito d4fd5e79d9 lock 2026-01-11 14:54:41 +02:00
fogelito 87247826e0 lock 2026-01-11 14:54:25 +02:00
fogelito 05f4d05cf3 lock 2026-01-11 14:42:46 +02:00
fogelito d12d6acd62 revert 2026-01-11 14:42:16 +02:00
fogelito 133eac66e7 upgrade fetch 2026-01-11 14:35:32 +02:00
fogelito 53a6fef69e lock file 2026-01-11 14:15:34 +02:00
fogelito 0c4f540325 Merge branch 'main' of https://github.com/appwrite/appwrite into joins2 2026-01-11 14:02:57 +02:00
fogelito 19e22e1da7 Types 2025-12-25 18:25:14 +02:00
fogelito 23c1e4fb79 remove var dump 2025-12-25 13:10:30 +02:00
fogelito 904b2da8ce Remove dbg 2025-12-25 12:02:54 +02:00
fogelito ee129e28f1 Remove dbg 2025-12-25 12:02:02 +02:00
fogelito c50ba30f1b fomratting 2025-12-25 12:00:33 +02:00
fogelito 265ccdb03a TablesDB tests 2025-12-25 11:03:19 +02:00
fogelito 3b93e925d4 database test 2025-12-25 10:56:58 +02:00
fogelito 10b38c7c6d enums 2025-12-23 16:42:37 +02:00
fogelito adf6b02462 create document fix reference 2025-12-23 12:18:15 +02:00
fogelito f47c484d8d csv queries 2025-12-23 09:35:28 +02:00
fogelito 6e1d2008f8 Fix filter V17 2025-12-22 15:44:10 +02:00
fogelito 38fb9f2814 select query 2025-12-22 12:47:49 +02:00
fogelito 8d37e843e0 Query select 2025-12-22 12:25:14 +02:00
fogelito 975510c6a0 select queries 2025-12-21 17:42:57 +02:00
fogelito a971976587 format 2025-12-21 17:01:17 +02:00
fogelito 9bee2f5a25 Types validator 2025-12-21 16:26:55 +02:00
fogelito 21e830146b composer.lock 2025-12-21 10:47:32 +02:00
30 changed files with 615 additions and 283 deletions
+2 -4
View File
@@ -31,6 +31,7 @@ use Appwrite\URL\URL as URLParser;
use Appwrite\Utopia\Database\Documents\User;
use Appwrite\Utopia\Database\Validator\CustomId;
use Appwrite\Utopia\Database\Validator\Queries\Identities;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use libphonenumber\PhoneNumberUtil;
@@ -55,10 +56,7 @@ use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID;
use Utopia\Emails\Email;
use Utopia\Locale\Locale;
@@ -3033,7 +3031,7 @@ App::get('/v1/account/logs')
],
contentType: ContentType::JSON,
))
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)
->inject('response')
->inject('user')
+5 -7
View File
@@ -23,6 +23,7 @@ use Appwrite\Utopia\Database\Validator\Queries\Providers;
use Appwrite\Utopia\Database\Validator\Queries\Subscribers;
use Appwrite\Utopia\Database\Validator\Queries\Targets;
use Appwrite\Utopia\Database\Validator\Queries\Topics;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Response;
use MaxMind\Db\Reader;
use Utopia\App;
@@ -38,10 +39,7 @@ use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Authorization\Input;
use Utopia\Database\Validator\Datetime as DatetimeValidator;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\Roles;
use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale;
@@ -1141,7 +1139,7 @@ App::get('/v1/messaging/providers/:providerId/logs')
]
))
->param('providerId', '', new UID(), 'Provider 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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)
->inject('response')
->inject('dbForProject')
@@ -2546,7 +2544,7 @@ App::get('/v1/messaging/topics/:topicId/logs')
]
))
->param('topicId', '', new UID(), 'Topic 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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)
->inject('response')
->inject('dbForProject')
@@ -2962,7 +2960,7 @@ App::get('/v1/messaging/subscribers/:subscriberId/logs')
]
))
->param('subscriberId', '', new UID(), 'Subscriber 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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)
->inject('response')
->inject('dbForProject')
@@ -3761,7 +3759,7 @@ App::get('/v1/messaging/messages/:messageId/logs')
],
))
->param('messageId', '', new UID(), 'Message 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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)
->inject('response')
->inject('dbForProject')
+7 -4
View File
@@ -18,8 +18,9 @@ use Utopia\Database\Exception\Order as OrderException;
use Utopia\Database\Exception\Query as QueryException;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Query;
use Utopia\Database\QueryContext;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Queries\Documents;
use Utopia\Database\Validator\Queries\V2 as DocumentsValidator;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\UID;
use Utopia\Migration\Resource;
@@ -547,9 +548,11 @@ App::post('/v1/migrations/csv/exports')
throw new Exception(Exception::COLLECTION_NOT_FOUND);
}
$validator = new Documents(
attributes: $collection->getAttribute('attributes', []),
indexes: $collection->getAttribute('indexes', []),
$context = new QueryContext();
$context->add($collection);
$validator = new DocumentsValidator(
$context,
idAttributeType: $dbForProject->getAdapter()->getIdAttributeType(),
);
+2 -2
View File
@@ -21,6 +21,7 @@ use Appwrite\Utopia\Database\Documents\User;
use Appwrite\Utopia\Database\Validator\CustomId;
use Appwrite\Utopia\Database\Validator\Queries\Memberships;
use Appwrite\Utopia\Database\Validator\Queries\Teams;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use libphonenumber\PhoneNumberUtil;
@@ -49,7 +50,6 @@ use Utopia\Database\Validator\Key;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID;
use Utopia\Emails\Email;
use Utopia\Locale\Locale;
@@ -1465,7 +1465,7 @@ App::get('/v1/teams/:teamId/logs')
]
))
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)
->inject('response')
->inject('dbForProject')
+2 -3
View File
@@ -25,6 +25,7 @@ use Appwrite\Utopia\Database\Validator\CustomId;
use Appwrite\Utopia\Database\Validator\Queries\Identities;
use Appwrite\Utopia\Database\Validator\Queries\Memberships;
use Appwrite\Utopia\Database\Validator\Queries\Targets;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Database\Validator\Queries\Users;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
@@ -57,8 +58,6 @@ use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID;
use Utopia\Emails\Email;
use Utopia\Locale\Locale;
@@ -939,7 +938,7 @@ App::get('/v1/users/:userId/logs')
]
))
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)
->inject('response')
->inject('dbForProject')
+2 -4
View File
@@ -10,6 +10,7 @@ use Appwrite\SDK\Method;
use Appwrite\SDK\MethodType;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Queries\Installations;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use Appwrite\Vcs\Comment;
@@ -30,10 +31,7 @@ use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Detector\Detection\Framework\Analog;
use Utopia\Detector\Detection\Framework\Angular;
use Utopia\Detector\Detection\Framework\Astro;
@@ -1035,7 +1033,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
->param('installationId', '', new Text(256), 'Installation Id')
->param('type', '', new WhiteList(['runtime', 'framework']), 'Detector type. Must be one of the following: runtime, framework')
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', 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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('gitHub')
->inject('response')
->inject('dbForPlatform')
+2 -2
View File
@@ -52,7 +52,7 @@
"utopia-php/cache": "0.13.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "1.*.*",
"utopia-php/database": "4.*",
"utopia-php/database": "dev-joins8 as 4.3.0",
"utopia-php/detector": "0.2.*",
"utopia-php/domains": "0.9.*",
"utopia-php/emails": "0.6.*",
@@ -64,7 +64,7 @@
"utopia-php/locale": "0.8.*",
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.20.*",
"utopia-php/migration": "1.3.*",
"utopia-php/migration": "dev-joins as 1.3.5",
"utopia-php/orchestration": "0.9.*",
"utopia-php/platform": "0.7.*",
"utopia-php/pools": "0.8.*",
Generated
+88 -73
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "99b8126a83fa0cb257df7c34ff2fdef5",
"content-hash": "fe779980651e51a4cb8cde7515d14db1",
"packages": [
{
"name": "adhocore/jwt",
@@ -756,16 +756,16 @@
},
{
"name": "google/protobuf",
"version": "v4.33.2",
"version": "v4.33.3",
"source": {
"type": "git",
"url": "https://github.com/protocolbuffers/protobuf-php.git",
"reference": "fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318"
"reference": "281537d44d6c270606354e65bfa75a0969dbd629"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318",
"reference": "fbd96b7bf1343f4b0d8fb358526c7ba4d72f1318",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/281537d44d6c270606354e65bfa75a0969dbd629",
"reference": "281537d44d6c270606354e65bfa75a0969dbd629",
"shasum": ""
},
"require": {
@@ -794,9 +794,9 @@
"proto"
],
"support": {
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.2"
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.3"
},
"time": "2025-12-05T22:12:22+00:00"
"time": "2026-01-09T21:49:37+00:00"
},
{
"name": "league/csv",
@@ -2673,16 +2673,16 @@
},
{
"name": "symfony/http-client",
"version": "v7.4.1",
"version": "v7.4.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "26cc224ea7103dda90e9694d9e139a389092d007"
"reference": "d01dfac1e0dc99f18da48b18101c23ce57929616"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/26cc224ea7103dda90e9694d9e139a389092d007",
"reference": "26cc224ea7103dda90e9694d9e139a389092d007",
"url": "https://api.github.com/repos/symfony/http-client/zipball/d01dfac1e0dc99f18da48b18101c23ce57929616",
"reference": "d01dfac1e0dc99f18da48b18101c23ce57929616",
"shasum": ""
},
"require": {
@@ -2750,7 +2750,7 @@
"http"
],
"support": {
"source": "https://github.com/symfony/http-client/tree/v7.4.1"
"source": "https://github.com/symfony/http-client/tree/v7.4.3"
},
"funding": [
{
@@ -2770,7 +2770,7 @@
"type": "tidelift"
}
],
"time": "2025-12-04T21:12:57+00:00"
"time": "2025-12-23T14:50:43+00:00"
},
{
"name": "symfony/http-client-contracts",
@@ -3896,16 +3896,16 @@
},
{
"name": "utopia-php/database",
"version": "4.3.0",
"version": "dev-joins8",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "fe7a1326ad623609e65587fe8c01a630a7075fee"
"reference": "467a9ea2aed836e83fc435f0379d177c16f8e45c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/fe7a1326ad623609e65587fe8c01a630a7075fee",
"reference": "fe7a1326ad623609e65587fe8c01a630a7075fee",
"url": "https://api.github.com/repos/utopia-php/database/zipball/467a9ea2aed836e83fc435f0379d177c16f8e45c",
"reference": "467a9ea2aed836e83fc435f0379d177c16f8e45c",
"shasum": ""
},
"require": {
@@ -3948,9 +3948,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/4.3.0"
"source": "https://github.com/utopia-php/database/tree/joins8"
},
"time": "2025-11-14T03:43:10+00:00"
"time": "2025-12-25T08:22:28+00:00"
},
{
"name": "utopia-php/detector",
@@ -4513,16 +4513,16 @@
},
{
"name": "utopia-php/migration",
"version": "1.3.5",
"version": "dev-joins",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "6f366f1d4ac2796e59a97d1ba28cedc355e7122e"
"reference": "01e06cf23b120b20eff6b159bc6531dd412677d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/6f366f1d4ac2796e59a97d1ba28cedc355e7122e",
"reference": "6f366f1d4ac2796e59a97d1ba28cedc355e7122e",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/01e06cf23b120b20eff6b159bc6531dd412677d8",
"reference": "01e06cf23b120b20eff6b159bc6531dd412677d8",
"shasum": ""
},
"require": {
@@ -4531,7 +4531,7 @@
"ext-openssl": "*",
"php": ">=8.1",
"utopia-php/console": "0.0.*",
"utopia-php/database": "4.*",
"utopia-php/database": "dev-joins8 as 4.3.0",
"utopia-php/dsn": "0.2.*",
"utopia-php/storage": "0.18.*"
},
@@ -4562,9 +4562,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/1.3.5"
"source": "https://github.com/utopia-php/migration/tree/joins"
},
"time": "2025-11-25T11:18:29+00:00"
"time": "2025-12-23T05:59:18+00:00"
},
{
"name": "utopia-php/mongo",
@@ -5436,16 +5436,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "1.5.9",
"version": "1.8.10",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "ee434aa00a9185380b9a39bb46bf86d7104d3a93"
"reference": "28217b1d722ad2b217559c3a371eafd4d070614d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ee434aa00a9185380b9a39bb46bf86d7104d3a93",
"reference": "ee434aa00a9185380b9a39bb46bf86d7104d3a93",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/28217b1d722ad2b217559c3a371eafd4d070614d",
"reference": "28217b1d722ad2b217559c3a371eafd4d070614d",
"shasum": ""
},
"require": {
@@ -5481,9 +5481,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/1.5.9"
"source": "https://github.com/appwrite/sdk-generator/tree/1.8.10"
},
"time": "2025-11-25T05:22:25+00:00"
"time": "2026-01-09T11:40:35+00:00"
},
{
"name": "doctrine/annotations",
@@ -5564,30 +5564,29 @@
},
{
"name": "doctrine/instantiator",
"version": "2.0.0",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0"
"reference": "23da848e1a2308728fe5fdddabf4be17ff9720c7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0",
"reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/23da848e1a2308728fe5fdddabf4be17ff9720c7",
"reference": "23da848e1a2308728fe5fdddabf4be17ff9720c7",
"shasum": ""
},
"require": {
"php": "^8.1"
"php": "^8.4"
},
"require-dev": {
"doctrine/coding-standard": "^11",
"doctrine/coding-standard": "^14",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^1.2",
"phpstan/phpstan": "^1.9.4",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.5.27",
"vimeo/psalm": "^5.4"
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10.5.58"
},
"type": "library",
"autoload": {
@@ -5614,7 +5613,7 @@
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/2.0.0"
"source": "https://github.com/doctrine/instantiator/tree/2.1.0"
},
"funding": [
{
@@ -5630,7 +5629,7 @@
"type": "tidelift"
}
],
"time": "2022-12-30T00:23:10+00:00"
"time": "2026-01-05T06:47:08+00:00"
},
{
"name": "doctrine/lexer",
@@ -5711,16 +5710,16 @@
},
{
"name": "laravel/pint",
"version": "v1.26.0",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f"
"reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/69dcca060ecb15e4b564af63d1f642c81a241d6f",
"reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f",
"url": "https://api.github.com/repos/laravel/pint/zipball/c67b4195b75491e4dfc6b00b1c78b68d86f54c90",
"reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90",
"shasum": ""
},
"require": {
@@ -5731,9 +5730,9 @@
"php": "^8.2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.90.0",
"illuminate/view": "^12.40.1",
"larastan/larastan": "^3.8.0",
"friendsofphp/php-cs-fixer": "^3.92.4",
"illuminate/view": "^12.44.0",
"larastan/larastan": "^3.8.1",
"laravel-zero/framework": "^12.0.4",
"mockery/mockery": "^1.6.12",
"nunomaduro/termwind": "^2.3.3",
@@ -5774,7 +5773,7 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2025-11-25T21:15:52+00:00"
"time": "2026-01-05T16:49:17+00:00"
},
{
"name": "matthiasmullie/minify",
@@ -7931,16 +7930,16 @@
},
{
"name": "symfony/console",
"version": "v8.0.1",
"version": "v8.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "fcb73f69d655b48fcb894a262f074218df08bd58"
"reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/fcb73f69d655b48fcb894a262f074218df08bd58",
"reference": "fcb73f69d655b48fcb894a262f074218df08bd58",
"url": "https://api.github.com/repos/symfony/console/zipball/6145b304a5c1ea0bdbd0b04d297a5864f9a7d587",
"reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587",
"shasum": ""
},
"require": {
@@ -7997,7 +7996,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v8.0.1"
"source": "https://github.com/symfony/console/tree/v8.0.3"
},
"funding": [
{
@@ -8017,7 +8016,7 @@
"type": "tidelift"
}
],
"time": "2025-12-05T15:25:33+00:00"
"time": "2025-12-23T14:52:06+00:00"
},
{
"name": "symfony/filesystem",
@@ -8091,16 +8090,16 @@
},
{
"name": "symfony/finder",
"version": "v8.0.0",
"version": "v8.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291"
"reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/7598dd5770580fa3517ec83e8da0c9b9e01f4291",
"reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291",
"url": "https://api.github.com/repos/symfony/finder/zipball/dd3a2953570a283a2ba4e17063bb98c734cf5b12",
"reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12",
"shasum": ""
},
"require": {
@@ -8135,7 +8134,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v8.0.0"
"source": "https://github.com/symfony/finder/tree/v8.0.3"
},
"funding": [
{
@@ -8155,7 +8154,7 @@
"type": "tidelift"
}
],
"time": "2025-11-05T14:36:47+00:00"
"time": "2025-12-23T14:52:06+00:00"
},
{
"name": "symfony/options-resolver",
@@ -8560,16 +8559,16 @@
},
{
"name": "symfony/process",
"version": "v8.0.0",
"version": "v8.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149"
"reference": "0cbbd88ec836f8757641c651bb995335846abb78"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/a0a750500c4ce900d69ba4e9faf16f82c10ee149",
"reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149",
"url": "https://api.github.com/repos/symfony/process/zipball/0cbbd88ec836f8757641c651bb995335846abb78",
"reference": "0cbbd88ec836f8757641c651bb995335846abb78",
"shasum": ""
},
"require": {
@@ -8601,7 +8600,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v8.0.0"
"source": "https://github.com/symfony/process/tree/v8.0.3"
},
"funding": [
{
@@ -8621,7 +8620,7 @@
"type": "tidelift"
}
],
"time": "2025-10-16T16:25:44+00:00"
"time": "2025-12-19T10:01:18+00:00"
},
{
"name": "symfony/string",
@@ -8941,9 +8940,25 @@
"time": "2024-03-07T20:33:40+00:00"
}
],
"aliases": [],
"aliases": [
{
"package": "utopia-php/database",
"version": "dev-joins8",
"alias": "4.3.0",
"alias_normalized": "4.3.0.0"
},
{
"package": "utopia-php/migration",
"version": "dev-joins",
"alias": "1.3.5",
"alias_normalized": "1.3.5.0"
}
],
"minimum-stability": "stable",
"stability-flags": {},
"stability-flags": {
"utopia-php/database": 20,
"utopia-php/migration": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@@ -8967,5 +8982,5 @@
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.9.0"
"plugin-api-version": "2.6.0"
}
+1 -1
View File
@@ -152,7 +152,7 @@ As the name implies, `param()` is used to define a request parameter.
```php
App::get('/v1/account/logs')
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
```
### 6. inject
+1 -1
View File
@@ -6,7 +6,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
stopOnFailure="true"
>
<extensions>
<extension class="Appwrite\Tests\TestHook" />
+3 -4
View File
@@ -175,7 +175,8 @@ class Action extends UtopiaAction
$queries = $request->getParam('queries', []);
$queries = Query::parseQueries($queries);
$selectQueries = Query::groupByType($queries)['selections'] ?? [];
$selectQueries = Query::getSelectQueries($queries);
// No select queries means no filtering out
if (empty($selectQueries)) {
@@ -184,9 +185,7 @@ class Action extends UtopiaAction
$attributes = [];
foreach ($selectQueries as $query) {
foreach ($query->getValues() as $attribute) {
$attributes[] = $attribute;
}
$attributes[] = $query->getAttribute();
}
$responseModel = $response->getModel($model);
@@ -443,12 +443,20 @@ class Create extends Action
}
try {
$dbForProject->withPreserveDates(
fn () => $dbForProject->createDocuments(
$results = [];
$dbForProject->withPreserveDates(function () use (&$results, $dbForProject, $database, $collection, $documents) {
$dbForProject->createDocuments(
'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(),
$documents,
)
);
onNext: function ($doc) use (&$results) {
$results[] = $doc;
}
);
});
$documents = $results;
} catch (DuplicateException) {
throw new Exception($this->getDuplicateException(), params: [$documentId]);
} catch (NotFoundException) {
@@ -10,6 +10,7 @@ use Appwrite\SDK\ContentType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Response as UtopiaResponse;
use MaxMind\Db\Reader;
use Utopia\Audit\Audit;
@@ -18,9 +19,6 @@ use Utopia\Database\Document;
use Utopia\Database\Exception\Query as QueryException;
use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale;
use Utopia\Swoole\Response as SwooleResponse;
@@ -67,7 +65,7 @@ class XList extends Action
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('response')
->inject('dbForProject')
->inject('locale')
@@ -9,6 +9,7 @@ use Appwrite\SDK\ContentType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Response as UtopiaResponse;
use DeviceDetector\DeviceDetector as Detector;
use MaxMind\Db\Reader;
@@ -18,9 +19,6 @@ use Utopia\Database\Document;
use Utopia\Database\Exception\Query as QueryException;
use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale;
use Utopia\Swoole\Response as SwooleResponse;
@@ -66,7 +64,7 @@ class XList extends Action
))
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('response')
->inject('dbForProject')
->inject('locale')
@@ -8,6 +8,7 @@ use Appwrite\SDK\ContentType;
use Appwrite\SDK\Deprecated;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Response as UtopiaResponse;
use DeviceDetector\DeviceDetector as Detector;
use MaxMind\Db\Reader;
@@ -17,9 +18,6 @@ use Utopia\Database\Document;
use Utopia\Database\Exception\Query as QueryException;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Query;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale;
use Utopia\Platform\Action;
@@ -62,7 +60,7 @@ class XList extends Action
),
])
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('response')
->inject('dbForProject')
->inject('locale')
@@ -7,6 +7,7 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Appwrite\Utopia\Response as UtopiaResponse;
use DeviceDetector\DeviceDetector as Detector;
use MaxMind\Db\Reader;
@@ -16,9 +17,6 @@ use Utopia\Database\Document;
use Utopia\Database\Exception\Query as QueryException;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Query;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\UID;
use Utopia\Locale\Locale;
use Utopia\Platform\Action;
@@ -57,7 +55,7 @@ class XList extends Action
),
])
->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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('response')
->inject('dbForProject')
->inject('locale')
@@ -7,9 +7,8 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Utopia\Database\Query;
use Utopia\Database\Validator\UID;
use Utopia\Swoole\Response as SwooleResponse;
@@ -45,7 +44,7 @@ class XList extends CollectionLogXList
))
->param('databaseId', '', new UID(), 'Database ID.')
->param('tableId', '', new UID(), 'Table 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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('response')
->inject('dbForProject')
->inject('locale')
@@ -7,9 +7,8 @@ use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Appwrite\Utopia\Database\Validator\Queries\Types;
use Utopia\Database\Query;
use Utopia\Database\Validator\UID;
use Utopia\Swoole\Response as SwooleResponse;
@@ -46,7 +45,7 @@ class XList extends DocumentLogXList
->param('databaseId', '', new UID(), 'Database ID.')
->param('tableId', '', new UID(), 'Table ID.')
->param('rowId', '', new UID(), 'Row 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/queries). Only supported methods are limit and offset', true)
->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true)
->inject('response')
->inject('dbForProject')
->inject('locale')
+88 -33
View File
@@ -330,7 +330,10 @@ class Deletes extends Action
$queries[] = Query::equal('resourceType', [$resourceType]);
}
$queries[] = Query::select($this->selects);
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
$queries[] = Query::orderAsc();
$this->deleteByGroup(
@@ -367,12 +370,16 @@ class Deletes extends Action
);
$queries = [
Query::select([...$this->selects, 'accessedAt']),
Query::select('accessedAt'),
Query::lessThan('accessedAt', $datetime),
Query::orderDesc('accessedAt'),
Query::orderDesc(),
];
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
$this->deleteByGroup(
'cache',
$queries,
@@ -403,27 +410,37 @@ class Deletes extends Action
$selects = [...$this->selects, 'time'];
// Delete Usage stats from projectDB
$this->deleteByGroup('stats', [
Query::select($selects),
$queries = [
Query::equal('period', ['1h']),
Query::lessThan('time', $hourlyUsageRetentionDatetime),
Query::orderDesc('time'),
Query::orderDesc(),
], $dbForProject);
];
foreach ($selects as $select) {
$queries[] = Query::select($select);
}
// Delete Usage stats from projectDB
$this->deleteByGroup('stats', $queries, $dbForProject);
if ($project->getId() !== 'console') {
/** @var Database $dbForLogs */
$dbForLogs = call_user_func($getLogsDB, $project);
// Delete Usage stats from logsDB
$this->deleteByGroup('stats', [
Query::select($selects),
$queries = [
Query::equal('period', ['1h']),
Query::lessThan('time', $hourlyUsageRetentionDatetime),
Query::orderDesc('time'),
Query::orderDesc(),
], $dbForLogs);
];
foreach ($selects as $select) {
$queries[] = Query::select($select);
}
// Delete Usage stats from logsDB
$this->deleteByGroup('stats', $queries, $dbForLogs);
}
}
@@ -689,13 +706,19 @@ class Deletes extends Action
{
$dbForProject = $getProjectDB($project);
// Delete Executions
$this->deleteByGroup('executions', [
Query::select([...$this->selects, '$createdAt']),
$queries = [
Query::select('$createdAt'),
Query::lessThan('$createdAt', $datetime),
Query::orderDesc('$createdAt'),
Query::orderDesc(),
], $dbForProject);
];
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
// Delete Executions
$this->deleteByGroup('executions', $queries, $dbForProject);
}
/**
@@ -710,13 +733,19 @@ class Deletes extends Action
$duration = $project->getAttribute('auths', [])['duration'] ?? TOKEN_EXPIRATION_LOGIN_LONG;
$expired = DateTime::addSeconds(new \DateTime(), -1 * $duration);
// Delete Sessions
$this->deleteByGroup('sessions', [
Query::select([...$this->selects, '$createdAt']),
$queries = [
Query::select('$createdAt'),
Query::lessThan('$createdAt', $expired),
Query::orderDesc('$createdAt'),
Query::orderDesc(),
], $dbForProject);
];
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
// Delete Sessions
$this->deleteByGroup('sessions', $queries, $dbForProject);
}
/**
@@ -738,14 +767,22 @@ class Deletes extends Action
Console::info("Deleting CSV export files older than " . $oneWeekAgo);
$this->deleteByGroup('bucket_' . $bucket->getSequence(), [
Query::select([...$this->selects, '$createdAt', 'name', 'path']),
$queries = [
Query::select('$createdAt'),
Query::select('name'),
Query::select('path'),
Query::equal('bucketId', ['default']),
Query::createdBefore($oneWeekAgo),
Query::endsWith('name', '.csv'),
Query::orderDesc('$createdAt'),
Query::orderDesc(),
], $dbForPlatform, function (Document $file) use ($deviceForFiles) {
];
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
$this->deleteByGroup('bucket_' . $bucket->getSequence(), $queries, $dbForPlatform, function (Document $file) use ($deviceForFiles) {
$path = $file->getAttribute('path');
if ($deviceForFiles->exists($path)) {
$deviceForFiles->delete($path);
@@ -782,13 +819,19 @@ class Deletes extends Action
$projectId = $project->getId();
$dbForProject = $getProjectDB($project);
$queries = [
Query::select('time'),
Query::lessThan('time', $auditRetention),
Query::orderDesc('time'),
Query::orderAsc(),
];
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
try {
$this->deleteByGroup(Audit::COLLECTION, [
Query::select([...$this->selects, 'time']),
Query::lessThan('time', $auditRetention),
Query::orderDesc('time'),
Query::orderAsc(),
], $dbForProject);
$this->deleteByGroup(Audit::COLLECTION, $queries, $dbForProject);
} catch (DatabaseException $e) {
Console::error('Failed to delete audit logs for project ' . $projectId . ': ' . $e->getMessage());
}
@@ -853,12 +896,18 @@ class Deletes extends Action
* Delete Logs
*/
Console::info("Deleting logs for site " . $siteId);
$this->deleteByGroup('executions', [
Query::select($this->selects),
$queries = [
Query::equal('resourceInternalId', [$siteInternalId]),
Query::equal('resourceType', ['sites']),
Query::orderAsc()
], $dbForProject);
];
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
$this->deleteByGroup('executions', $queries, $dbForProject);
/**
* Delete VCS Repositories and VCS Comments
@@ -939,12 +988,18 @@ class Deletes extends Action
* Delete Executions
*/
Console::info("Deleting executions for function " . $functionId);
$this->deleteByGroup('executions', [
Query::select($this->selects),
$queries = [
Query::equal('resourceInternalId', [$functionInternalId]),
Query::equal('resourceType', ['functions']),
Query::orderAsc()
], $dbForProject);
];
foreach ($this->selects as $select) {
$queries[] = Query::select($select);
}
$this->deleteByGroup('executions', $queries, $dbForProject);
/**
* Delete VCS Repositories and VCS Comments
@@ -5,16 +5,58 @@ namespace Appwrite\Utopia\Database\Validator\Queries;
use Utopia\Config\Config;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Validator\Queries;
use Utopia\Database\Validator\Query\Cursor;
use Utopia\Database\Validator\Query\Filter;
use Utopia\Database\Validator\Query\Limit;
use Utopia\Database\Validator\Query\Offset;
use Utopia\Database\Validator\Query\Order;
use Utopia\Database\Validator\Query\Select;
use Utopia\Database\Query;
use Utopia\Database\QueryContext;
class Base extends Queries
class Base extends Types
{
protected Document $collection;
protected array $types = [
Query::TYPE_LIMIT,
Query::TYPE_OFFSET,
Query::TYPE_CURSOR_AFTER,
Query::TYPE_CURSOR_BEFORE,
Query::TYPE_ORDER_ASC,
Query::TYPE_ORDER_DESC,
Query::TYPE_ORDER_RANDOM,
Query::TYPE_EQUAL,
Query::TYPE_NOT_EQUAL,
Query::TYPE_LESSER,
Query::TYPE_LESSER_EQUAL,
Query::TYPE_GREATER,
Query::TYPE_GREATER_EQUAL,
Query::TYPE_SEARCH,
Query::TYPE_NOT_SEARCH,
Query::TYPE_IS_NULL,
Query::TYPE_IS_NOT_NULL,
Query::TYPE_BETWEEN,
Query::TYPE_NOT_BETWEEN,
Query::TYPE_STARTS_WITH,
Query::TYPE_NOT_STARTS_WITH,
Query::TYPE_ENDS_WITH,
Query::TYPE_NOT_ENDS_WITH,
Query::TYPE_CONTAINS,
Query::TYPE_NOT_CONTAINS,
Query::TYPE_AND,
Query::TYPE_OR,
Query::TYPE_CROSSES,
Query::TYPE_NOT_CROSSES,
Query::TYPE_DISTANCE_EQUAL,
Query::TYPE_DISTANCE_NOT_EQUAL,
Query::TYPE_DISTANCE_GREATER_THAN,
Query::TYPE_DISTANCE_LESS_THAN,
Query::TYPE_INTERSECTS,
Query::TYPE_NOT_INTERSECTS,
Query::TYPE_OVERLAPS,
Query::TYPE_NOT_OVERLAPS,
Query::TYPE_TOUCHES,
Query::TYPE_NOT_TOUCHES,
Query::TYPE_VECTOR_DOT,
Query::TYPE_VECTOR_COSINE,
Query::TYPE_VECTOR_EUCLIDEAN
];
/**
* Expression constructor
*
@@ -36,27 +78,18 @@ class Base extends Queries
$collection = $collections[$collection];
$allowedAttributesLookup = [];
foreach ($allowedAttributes as $attribute) {
$allowedAttributesLookup[$attribute] = true;
}
$this->collection = new Document([
'$id' => $collection['$id'],
]);
$allAttributes = [];
$attributes = [];
foreach ($collection['attributes'] as $attribute) {
$key = $attribute['$id'];
$attributeDocument = new Document([
'key' => $key,
$attr = new Document([
'key' => $attribute['$id'],
'type' => $attribute['type'],
'array' => $attribute['array'],
]);
$allAttributes[] = $attributeDocument;
if (isset($allowedAttributesLookup[$key])) {
$attributes[] = $attributeDocument;
}
$this->collection->setAttribute('attributes', $attr, Document::SET_TYPE_APPEND);
}
$internalAttributes = [
@@ -83,23 +116,18 @@ class Base extends Queries
];
foreach ($internalAttributes as $attribute) {
$attributes[] = $attribute;
$allAttributes[] = $attribute;
$this->collection->setAttribute('attributes', $attribute, Document::SET_TYPE_APPEND);
$allowedAttributes[] = $attribute['key'];
}
$validators = [
new Limit(),
new Offset(),
new Cursor(),
new Filter($attributes, APP_DATABASE_QUERY_MAX_VALUES),
new Order($attributes),
];
if ($this->isSelectQueryAllowed()) {
$validators[] = new Select($allAttributes);
$this->types[] = Query::TYPE_SELECT;
}
parent::__construct($validators);
$context = new QueryContext();
$context->add($this->collection);
parent::__construct($this->types, $context, $allowedAttributes);
}
public function isSelectQueryAllowed(): bool
@@ -0,0 +1,131 @@
<?php
namespace Appwrite\Utopia\Database\Validator\Queries;
use Utopia\Database\Database;
use Utopia\Database\Query;
use Utopia\Database\QueryContext;
use Utopia\Database\Validator\Queries\V2 as DocumentsValidator;
use Utopia\Validator;
class Types extends Validator
{
protected string $message = 'Invalid queries';
/**
* @var array<string>
*/
protected array $types;
protected ?QueryContext $context = null;
/**
* @var array<string>
*/
protected array $allowedAttributes;
/**
* @param array $types
* @param QueryContext|null $context
* @param array<string> $allowedAttributes
*/
public function __construct(array $types = [], ?QueryContext $context = null, array $allowedAttributes = [])
{
$this->types = $types;
if (is_null($context)) {
$context = new QueryContext();
}
$this->context = $context;
$this->allowedAttributes = $allowedAttributes;
}
/**
* Get Description.
*
* Returns validator description
*
* @return string
*/
public function getDescription(): string
{
return $this->message;
}
/**
* @param array<Query|string> $value
* @return bool
*/
public function isValid($value): bool
{
try {
if (!is_array($value)) {
throw new \Exception('Queries must be an array');
}
foreach ($value as $query) {
if (!$query instanceof Query) {
$query = Query::parse($query);
}
if ($query->isNested()) {
if (!$this->isValid($query->getValues())) {
throw new \Exception('Invalid queries');
}
}
if (!in_array($query->getMethod(), $this->types)) {
throw new \Exception("Query method {$query->getMethod()} not allowed");
}
if (
$query->getMethod() !== Query::TYPE_SELECT &&
!empty($query->getAttribute()) &&
!in_array($query->getAttribute(), $this->allowedAttributes)
) {
throw new \Exception("Invalid query: Attribute not found in schema: {$query->getAttribute()}");
}
}
$validator = new DocumentsValidator(
$this->context,
Database::VAR_INTEGER
);
if (!$validator->isValid($value)) {
throw new \Exception($validator->getDescription());
}
} catch (\Throwable $e) {
$this->message = $e->getMessage();
return false;
}
return true;
}
/**
* Is array
*
* Function will return true if object is array.
*
* @return bool
*/
public function isArray(): bool
{
return true;
}
/**
* Get Type
*
* Returns validator type.
*
* @return string
*/
public function getType(): string
{
return self::TYPE_OBJECT;
}
}
+54 -11
View File
@@ -67,8 +67,19 @@ class V17 extends Filter
$parsed = [];
foreach ($content['queries'] as $query) {
try {
$query = $this->parseQuery($query);
$parsed[] = \json_encode(\array_filter($query->toArray()));
/** @var Query|Query[] $queries */
$queries = $this->parseQuery($query);
/**
* select query will return as an array of select queries
*/
if ($queries instanceof Query) {
$queries = [$queries];
}
foreach ($queries as $q) {
$parsed[] = json_encode(array_filter($q->toArray()));
}
} catch (\Throwable $th) {
throw new Exception(Exception::GENERAL_QUERY_INVALID, $th->getMessage());
}
@@ -80,7 +91,13 @@ class V17 extends Filter
}
// 1.4 query parser
public function parseQuery(string $filter): Query
/**
* @param string $filter
* @return Query|array
* @throws \Utopia\Database\Exception\Query
*/
public function parseQuery(string $filter): Query|array
{
// Init empty vars we fill later
$method = '';
@@ -242,29 +259,55 @@ class V17 extends Filter
case Query::TYPE_ENDS_WITH:
$attribute = $parsedParams[0] ?? '';
if (count($parsedParams) < 2) {
return new Query($method, $attribute);
return Query::parseQuery([
'method' => $method,
'attribute' => $attribute,
]);
}
return new Query($method, $attribute, \is_array($parsedParams[1]) ? $parsedParams[1] : [$parsedParams[1]]);
return Query::parseQuery([
'method' => $method,
'attribute' => $attribute,
'values' => \is_array($parsedParams[1]) ? $parsedParams[1] : [$parsedParams[1]],
]);
case Query::TYPE_BETWEEN:
return new Query($method, $parsedParams[0], [$parsedParams[1], $parsedParams[2]]);
return Query::between($parsedParams[0], $parsedParams[1], $parsedParams[2]);
case Query::TYPE_SELECT:
return new Query($method, values: $parsedParams[0]);
$selects = [];
foreach ($parsedParams[0] as $attribute) {
$selects[] = Query::select($attribute);
}
return $selects;
case Query::TYPE_ORDER_ASC:
case Query::TYPE_ORDER_DESC:
return new Query($method, $parsedParams[0] ?? '');
return Query::parseQuery([
'method' => $method,
'attribute' => $parsedParams[0] ?? '',
]);
case Query::TYPE_LIMIT:
case Query::TYPE_OFFSET:
case Query::TYPE_CURSOR_AFTER:
case Query::TYPE_CURSOR_BEFORE:
if (count($parsedParams) > 0) {
return new Query($method, values: [$parsedParams[0]]);
return Query::parseQuery([
'method' => $method,
'values' => [$parsedParams[0]],
]);
}
return new Query($method);
return Query::parseQuery([
'method' => $method,
]);
default:
return new Query($method);
return Query::parseQuery([
'method' => $method,
]);
}
}
+6 -3
View File
@@ -58,7 +58,8 @@ class V20 extends Filter
throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage());
}
$selections = Query::groupByType($parsed)['selections'] ?? [];
//$selections = Query::groupByType($parsed)['selections'] ?? [];
$selections = Query::getSelectQueries($parsed);
// Check if we need to add wildcard + relationships
// This happens when:
@@ -67,7 +68,7 @@ class V20 extends Filter
$needsRelationships = empty($selections);
if (!$needsRelationships) {
foreach ($selections as $select) {
if (\in_array('*', $select->getValues(), true)) {
if ($select->getAttribute() === '*') {
$needsRelationships = true;
break;
}
@@ -88,7 +89,9 @@ class V20 extends Filter
);
// Add wildcard + relationship(s) selects
$parsed[] = Query::select($selects);
foreach ($selects as $select) {
$parsed[] = Query::select($select);
}
}
$resolvedQueries = [];
@@ -400,7 +400,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => [Query::select(['key'])->toString()],
'queries' => [Query::select('key')->toString()],
]);
$this->assertEquals(Exception::GENERAL_ARGUMENT_INVALID, $response['body']['type']);
$this->assertEquals(400, $response['headers']['status-code']);
@@ -1565,7 +1565,7 @@ trait DatabasesBase
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => [
Query::select(['key'])->toString(),
Query::select('key')->toString(),
],
]);
$this->assertEquals(Exception::GENERAL_ARGUMENT_INVALID, $response['body']['type']);
@@ -1608,6 +1608,7 @@ trait DatabasesBase
'title' => 'Spider-Man: Far From Home',
'releaseYear' => 2019,
'birthDay' => null,
'duration' => null,
'actors' => [
'Tom Holland',
'Zendaya Maree Stoermer',
@@ -1666,6 +1667,7 @@ trait DatabasesBase
$this->assertEquals($databaseId, $document1['body']['$databaseId']);
$this->assertEquals($document1['body']['title'], 'Captain America');
$this->assertEquals($document1['body']['releaseYear'], 1944);
$this->assertArrayNotHasKey('duration', $document1['body']);
$this->assertIsArray($document1['body']['$permissions']);
$this->assertCount(3, $document1['body']['$permissions']);
$this->assertCount(2, $document1['body']['actors']);
@@ -1965,7 +1967,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
Query::equal('library', ['library1'])->toString(),
],
]);
@@ -2003,7 +2006,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
Query::equal('library', ['library1'])->toString(),
],
]);
@@ -2041,7 +2045,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString()
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
],
]);
$this->assertEquals(2, $documents['body']['total']);
@@ -2200,7 +2205,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString()
Query::select('$permissions')->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
],
]);
$this->assertGreaterThanOrEqual(1, $documents['body']['total']);
@@ -2411,7 +2418,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['title', 'releaseYear', '$id'])->toString(),
Query::select('title')->toString(),
Query::select('releaseYear')->toString(),
Query::select('$id')->toString(),
],
]);
@@ -5111,7 +5120,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
Query::equal('library', ['library1'])->toString(),
],
]);
@@ -5125,7 +5135,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['library.*'])->toString(),
Query::select('library.*')->toString(),
Query::equal('library.libraryName', ['Library 1'])->toString(),
],
]);
@@ -5283,7 +5293,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'libraries.*'])->toString()
Query::select('*')->toString(),
Query::select('libraries.*')->toString()
]
]);
@@ -5297,7 +5308,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['person_one_to_many.$id'])->toString()
Query::select('person_one_to_many.$id')->toString()
]
]);
@@ -5451,7 +5462,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'artist.name', 'artist.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('artist.name')->toString(),
Query::select('artist.$permissions')->toString()
]
]);
@@ -5467,7 +5480,10 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'albums.$id', 'albums.name', 'albums.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('albums.$id')->toString(),
Query::select('albums.name')->toString(),
Query::select('albums.$permissions')->toString()
]
]);
@@ -5612,7 +5628,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'players.name', 'players.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('players.name')->toString(),
Query::select('players.$permissions')->toString()
]
]);
@@ -5630,7 +5648,10 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'sports.$id', 'sports.name', 'sports.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('sports.$id')->toString(),
Query::select('sports.name')->toString(),
Query::select('sports.$permissions')->toString()
]
]);
@@ -5660,7 +5681,8 @@ trait DatabasesBase
], $this->getHeaders()), [
'queries' => [
Query::isNotNull('$id')->toString(),
Query::select(['*', 'libraries.*'])->toString(),
Query::select('*')->toString(),
Query::select('libraries.*')->toString(),
Query::startsWith('fullName', 'Stevie')->toString(),
Query::endsWith('fullName', 'Wonder')->toString(),
Query::between('$createdAt', '1975-12-06', '2050-12-01')->toString(),
@@ -5680,7 +5702,7 @@ trait DatabasesBase
'queries' => [
Query::isNotNull('$id')->toString(),
Query::isNull('fullName')->toString(),
Query::select(['fullName'])->toString(),
Query::select('fullName')->toString(),
],
]);
@@ -5703,7 +5725,7 @@ trait DatabasesBase
], $this->getHeaders()), [
'queries' => [
Query::equal('fullName', ['Stevie Wonder'])->toString(),
Query::select(['fullName'])->toString(),
Query::select('fullName')->toString(),
],
]);
@@ -5717,7 +5739,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['libraries.*', '$id'])->toString(),
Query::select('libraries.*')->toString(),
Query::select('$id')->toString(),
],
]);
$document = $response['body']['documents'][0];
@@ -5731,7 +5754,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', '$id'])->toString(),
Query::select('fullName')->toString(),
Query::select('$id')->toString(),
],
]);
@@ -5861,7 +5885,8 @@ trait DatabasesBase
], $this->getHeaders()),
[
'queries' => [
Query::select(['first_name', 'last_name'])->toString(),
Query::select('first_name')->toString(),
Query::select('last_name')->toString(),
Query::or([
Query::equal('first_name', ['Donald']),
Query::equal('last_name', ['Bush'])
@@ -7342,7 +7367,10 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [Query::select(['name', 'pointAttr'])->toString()]
'queries' => [
Query::select('name')->toString(),
Query::select('pointAttr')->toString()
]
]);
$this->assertEquals(200, $response['headers']['status-code']);
@@ -7397,7 +7425,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['name', 'pointAttr'])->toString(),
Query::select('name')->toString(),
Query::select('pointAttr')->toString(),
Query::orderAsc('name')->toString(),
Query::limit(1)->toString()
]
@@ -7546,7 +7575,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['name', 'location.coordinates'])->toString()
Query::select('name')->toString(),
Query::select('location.coordinates')->toString()
]
]);
$this->assertEquals(200, $fetched['headers']['status-code']);
@@ -7680,7 +7710,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['point', 'person.$id'])->toString()
Query::select('point')->toString(),
Query::select('person.$id')->toString()
]
]);
$this->assertEquals(200, $visitDoc['headers']['status-code']);
@@ -7805,7 +7836,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['stores.$id'])->toString()
Query::select('stores.$id')->toString()
]
]);
$this->assertEquals(200, $city['headers']['status-code']);
@@ -7930,7 +7961,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['drivers.$id'])->toString()
Query::select('drivers.$id')->toString()
]
]);
$this->assertEquals(200, $zone['headers']['status-code']);
@@ -3830,7 +3830,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -3944,7 +3944,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -4058,7 +4058,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -4073,7 +4073,8 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['*', 'level1.*'])->toString()
Query::select('*')->toString(),
Query::select('level1.*')->toString()
]
]);
@@ -4176,7 +4177,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -4191,7 +4192,8 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['*', 'level1.*'])->toString()
Query::select('*')->toString(),
Query::select('level1.*')->toString()
]
]);
@@ -400,7 +400,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => [Query::select(['key'])->toString()],
'queries' => [Query::select('key')->toString()],
]);
$this->assertEquals(Exception::GENERAL_ARGUMENT_INVALID, $response['body']['type']);
$this->assertEquals(400, $response['headers']['status-code']);
@@ -1523,7 +1523,7 @@ trait DatabasesBase
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => [
Query::select(['key'])->toString(),
Query::select('key')->toString(),
],
]);
$this->assertEquals(Exception::GENERAL_ARGUMENT_INVALID, $response['body']['type']);
@@ -1566,6 +1566,7 @@ trait DatabasesBase
'title' => 'Spider-Man: Far From Home',
'releaseYear' => 2019,
'birthDay' => null,
'duration' => null,
'actors' => [
'Tom Holland',
'Zendaya Maree Stoermer',
@@ -1940,7 +1941,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
Query::equal('library', ['library1'])->toString(),
],
]);
@@ -1978,7 +1980,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
Query::equal('library', ['library1'])->toString(),
],
]);
@@ -2016,7 +2019,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString()
Query::select('fullName')->toString(),
Query::select('library.*')->toString()
],
]);
@@ -2176,7 +2180,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString()
Query::select('$permissions')->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString()
],
]);
$this->assertGreaterThanOrEqual(1, $rows['body']['total']);
@@ -2339,7 +2345,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['title', 'releaseYear', '$id'])->toString(),
Query::select('title')->toString(),
Query::select('releaseYear')->toString(),
Query::select('$id')->toString(),
],
]);
@@ -5027,7 +5035,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', 'library.*'])->toString(),
Query::select('fullName')->toString(),
Query::select('library.*')->toString(),
Query::equal('library', ['library1'])->toString(),
],
]);
@@ -5041,7 +5050,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['library.*'])->toString(),
Query::select('library.*')->toString(),
Query::equal('library.libraryName', ['Library 1'])->toString(),
],
]);
@@ -5199,7 +5208,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'libraries.*'])->toString()
Query::select('*')->toString(),
Query::select('libraries.*')->toString()
]
]);
@@ -5213,7 +5223,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['person_one_to_many.$id'])->toString()
Query::select('person_one_to_many.$id')->toString()
]
]);
@@ -5367,7 +5377,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'artist.name', 'artist.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('artist.name')->toString(),
Query::select('artist.$permissions')->toString()
]
]);
@@ -5383,7 +5395,10 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'albums.$id', 'albums.name', 'albums.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('albums.$id')->toString(),
Query::select('albums.name')->toString(),
Query::select('albums.$permissions')->toString()
]
]);
@@ -5528,7 +5543,9 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'players.name', 'players.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('players.name')->toString(),
Query::select('players.$permissions')->toString()
]
]);
@@ -5546,7 +5563,10 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['*', 'sports.$id', 'sports.name', 'sports.$permissions'])->toString()
Query::select('*')->toString(),
Query::select('sports.$id')->toString(),
Query::select('sports.name')->toString(),
Query::select('sports.$permissions')->toString()
]
]);
@@ -5576,7 +5596,8 @@ trait DatabasesBase
], $this->getHeaders()), [
'queries' => [
Query::isNotNull('$id')->toString(),
Query::select(['*', 'libraries.*'])->toString(),
Query::select('*')->toString(),
Query::select('libraries.*')->toString(),
Query::startsWith('fullName', 'Stevie')->toString(),
Query::endsWith('fullName', 'Wonder')->toString(),
Query::between('$createdAt', '1975-12-06', '2050-12-01')->toString(),
@@ -5596,7 +5617,7 @@ trait DatabasesBase
'queries' => [
Query::isNotNull('$id')->toString(),
Query::isNull('fullName')->toString(),
Query::select(['fullName'])->toString(),
Query::select('fullName')->toString(),
],
]);
@@ -5619,7 +5640,7 @@ trait DatabasesBase
], $this->getHeaders()), [
'queries' => [
Query::equal('fullName', ['Stevie Wonder'])->toString(),
Query::select(['fullName'])->toString(),
Query::select('fullName')->toString(),
],
]);
@@ -5633,7 +5654,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['libraries.*', '$id'])->toString(),
Query::select('libraries.*')->toString(),
Query::select('$id')->toString(),
],
]);
$row = $response['body']['rows'][0];
@@ -5647,7 +5669,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['fullName', '$id'])->toString(),
Query::select('fullName')->toString(),
Query::select('$id')->toString(),
],
]);
@@ -5777,7 +5800,8 @@ trait DatabasesBase
], $this->getHeaders()),
[
'queries' => [
Query::select(['first_name', 'last_name'])->toString(),
Query::select('first_name')->toString(),
Query::select('last_name')->toString(),
Query::or([
Query::equal('first_name', ['Donald']),
Query::equal('last_name', ['Bush'])
@@ -5914,7 +5938,8 @@ trait DatabasesBase
], $this->getHeaders()),
[
'queries' => [
Query::select(['title', 'genre'])->toString(),
Query::select('title')->toString(),
Query::select('genre')->toString(),
Query::notContains('title', ['Spider'])->toString(),
Query::limit(999)->toString(),
Query::offset(0)->toString()
@@ -8791,7 +8816,10 @@ trait DatabasesBase
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [Query::select(['name', 'pointAttr'])->toString()]
'queries' => [
Query::select('name')->toString(),
Query::select('pointAttr')->toString(),
]
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertCount(3, $response['body']['rows']);
@@ -8841,7 +8869,8 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['name', 'pointAttr'])->toString(),
Query::select('name')->toString(),
Query::select('pointAttr')->toString(),
Query::orderAsc('name')->toString(),
Query::limit(1)->toString()
]
@@ -3759,7 +3759,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -3873,7 +3873,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -3987,7 +3987,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -4002,7 +4002,8 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['*', 'level1.*'])->toString()
Query::select('*')->toString(),
Query::select('level1.*')->toString()
]
]);
@@ -4105,7 +4106,7 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['new_level_2.*'])->toString()
Query::select('new_level_2.*')->toString()
]
]);
@@ -4120,7 +4121,8 @@ class DatabasesCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'queries' => [
Query::select(['*', 'level1.*'])->toString()
Query::select('*')->toString(),
Query::select('level1.*')->toString()
]
]);
@@ -873,7 +873,7 @@ class FunctionsCustomServerTest extends Scope
$deployments = $this->listDeployments($functionId, [
'queries' => [
Query::select(['status'])->toString(),
Query::select('status')->toString(),
],
]);
@@ -886,7 +886,7 @@ class FunctionsCustomServerTest extends Scope
// Extra select query check, for attribute not allowed by filter queries
$deployments = $this->listDeployments($functionId, [
'queries' => [
Query::select(['buildLogs'])->toString(),
Query::select('buildLogs')->toString(),
],
]);
$this->assertEquals($deployments['headers']['status-code'], 200);
@@ -1058,7 +1058,7 @@ class SitesCustomServerTest extends Scope
$deployments = $this->listDeployments($siteId, [
'queries' => [
Query::select(['status'])->toString(),
Query::select('status')->toString(),
],
]);
@@ -1071,7 +1071,7 @@ class SitesCustomServerTest extends Scope
// Extra select query check, for attribute not allowed by filter queries
$deployments = $this->listDeployments($siteId, [
'queries' => [
Query::select(['buildLogs'])->toString(),
Query::select('buildLogs')->toString(),
],
]);
$this->assertEquals($deployments['headers']['status-code'], 200);
+1 -1
View File
@@ -453,7 +453,7 @@ trait UsersBase
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [
Query::select(['name'])->toString()
Query::select('name')->toString()
]
]);
$this->assertEquals($response['headers']['status-code'], 400);