Merge branch '1.8.x' into bump-response-format

This commit is contained in:
Darshan 2025-07-22 09:51:49 +05:30 committed by GitHub
commit 3c4bd67de6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 36 deletions

View file

@ -2523,7 +2523,7 @@ App::patch('/v1/projects/:projectId/auth/session-invalidation')
->param('enabled', false, new Boolean(), 'Update authentication session invalidation status. Use this endpoint to enable or disable session invalidation on password change') ->param('enabled', false, new Boolean(), 'Update authentication session invalidation status. Use this endpoint to enable or disable session invalidation on password change')
->inject('response') ->inject('response')
->inject('dbForPlatform') ->inject('dbForPlatform')
->action(function (string $projectId, bool $invalidateSessions, Response $response, Database $dbForPlatform) { ->action(function (string $projectId, bool $enabled, Response $response, Database $dbForPlatform) {
$project = $dbForPlatform->getDocument('projects', $projectId); $project = $dbForPlatform->getDocument('projects', $projectId);
@ -2532,7 +2532,7 @@ App::patch('/v1/projects/:projectId/auth/session-invalidation')
} }
$auths = $project->getAttribute('auths', []); $auths = $project->getAttribute('auths', []);
$auths['invalidateSessions'] = $invalidateSessions; $auths['invalidateSessions'] = $enabled;
$dbForPlatform->updateDocument('projects', $project->getId(), $project $dbForPlatform->updateDocument('projects', $project->getId(), $project
->setAttribute('auths', $auths)); ->setAttribute('auths', $auths));

View file

@ -52,7 +52,7 @@
"utopia-php/cache": "0.13.*", "utopia-php/cache": "0.13.*",
"utopia-php/cli": "0.15.*", "utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*", "utopia-php/config": "0.2.*",
"utopia-php/database": "0.71.*", "utopia-php/database": "0.72.*",
"utopia-php/detector": "0.1.*", "utopia-php/detector": "0.1.*",
"utopia-php/domains": "0.8.*", "utopia-php/domains": "0.8.*",
"utopia-php/dsn": "0.2.1", "utopia-php/dsn": "0.2.1",
@ -62,7 +62,7 @@
"utopia-php/locale": "0.4.*", "utopia-php/locale": "0.4.*",
"utopia-php/logger": "0.6.*", "utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.18.*", "utopia-php/messaging": "0.18.*",
"utopia-php/migration": "0.12.*", "utopia-php/migration": "0.13.*",
"utopia-php/orchestration": "0.9.*", "utopia-php/orchestration": "0.9.*",
"utopia-php/platform": "0.7.*", "utopia-php/platform": "0.7.*",
"utopia-php/pools": "0.8.*", "utopia-php/pools": "0.8.*",

38
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "25ac1acb960988af5c10239c3bde258b", "content-hash": "040a8234ecf1038a7e6dc16aa2dda084",
"packages": [ "packages": [
{ {
"name": "adhocore/jwt", "name": "adhocore/jwt",
@ -3493,16 +3493,16 @@
}, },
{ {
"name": "utopia-php/database", "name": "utopia-php/database",
"version": "0.71.10", "version": "0.72.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/database.git", "url": "https://github.com/utopia-php/database.git",
"reference": "83278d663f9c63c25a11d9e71c7922da7ec48636" "reference": "ad7613ac19bb799fc911cf82636a09345b2573fe"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/83278d663f9c63c25a11d9e71c7922da7ec48636", "url": "https://api.github.com/repos/utopia-php/database/zipball/ad7613ac19bb799fc911cf82636a09345b2573fe",
"reference": "83278d663f9c63c25a11d9e71c7922da7ec48636", "reference": "ad7613ac19bb799fc911cf82636a09345b2573fe",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3543,9 +3543,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/database/issues", "issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.71.10" "source": "https://github.com/utopia-php/database/tree/0.72.2"
}, },
"time": "2025-07-18T00:05:55+00:00" "time": "2025-07-22T03:13:31+00:00"
}, },
{ {
"name": "utopia-php/detector", "name": "utopia-php/detector",
@ -3942,16 +3942,16 @@
}, },
{ {
"name": "utopia-php/messaging", "name": "utopia-php/messaging",
"version": "0.18.1", "version": "0.18.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/messaging.git", "url": "https://github.com/utopia-php/messaging.git",
"reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f" "reference": "0d364edacf4d4867964c7e17f653031dd39394bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/messaging/zipball/5d1245207a61d7ca065daddad7ac5f1d5640152f", "url": "https://api.github.com/repos/utopia-php/messaging/zipball/0d364edacf4d4867964c7e17f653031dd39394bf",
"reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f", "reference": "0d364edacf4d4867964c7e17f653031dd39394bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3987,22 +3987,22 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/messaging/issues", "issues": "https://github.com/utopia-php/messaging/issues",
"source": "https://github.com/utopia-php/messaging/tree/0.18.1" "source": "https://github.com/utopia-php/messaging/tree/0.18.2"
}, },
"time": "2025-06-26T18:26:07+00:00" "time": "2025-07-21T18:27:03+00:00"
}, },
{ {
"name": "utopia-php/migration", "name": "utopia-php/migration",
"version": "0.12.0", "version": "0.13.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/migration.git", "url": "https://github.com/utopia-php/migration.git",
"reference": "973a4daa283f711a104e9bb7cf5a79dec2988df0" "reference": "b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/973a4daa283f711a104e9bb7cf5a79dec2988df0", "url": "https://api.github.com/repos/utopia-php/migration/zipball/b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc",
"reference": "973a4daa283f711a104e9bb7cf5a79dec2988df0", "reference": "b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4043,9 +4043,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/migration/issues", "issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/0.12.0" "source": "https://github.com/utopia-php/migration/tree/0.13.1"
}, },
"time": "2025-07-17T12:20:11+00:00" "time": "2025-07-21T23:22:05+00:00"
}, },
{ {
"name": "utopia-php/orchestration", "name": "utopia-php/orchestration",

View file

@ -161,7 +161,9 @@ class Create extends Action
throw new Exception($this->getParentNotAvailableException(), "$contextType not available: " . $oldAttributes[$attributeIndex]['key']); throw new Exception($this->getParentNotAvailableException(), "$contextType not available: " . $oldAttributes[$attributeIndex]['key']);
} }
$lengths[$i] ??= null; if (empty($lengths[$i])) {
$lengths[$i] = null;
}
if ($attributeArray === true) { if ($attributeArray === true) {
$lengths[$i] = Database::ARRAY_INDEX_LENGTH; $lengths[$i] = Database::ARRAY_INDEX_LENGTH;
@ -187,6 +189,7 @@ class Create extends Action
$collection->getAttribute('attributes'), $collection->getAttribute('attributes'),
$dbForProject->getAdapter()->getMaxIndexLength(), $dbForProject->getAdapter()->getMaxIndexLength(),
$dbForProject->getAdapter()->getInternalIndexesKeys(), $dbForProject->getAdapter()->getInternalIndexesKeys(),
$dbForProject->getAdapter()->getSupportForIndexArray()
); );
if (!$validator->isValid($index)) { if (!$validator->isValid($index)) {

View file

@ -1344,7 +1344,8 @@ trait DatabasesBase
'attributes' => ['actors'], 'attributes' => ['actors'],
]); ]);
$this->assertEquals(202, $actorsArray['headers']['status-code']); // Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals(400, $actorsArray['headers']['status-code']);
$twoLevelsArray = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ $twoLevelsArray = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
@ -1357,9 +1358,8 @@ trait DatabasesBase
'orders' => ['DESC', 'DESC'], 'orders' => ['DESC', 'DESC'],
]); ]);
$this->assertEquals(202, $twoLevelsArray['headers']['status-code']); // Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals('DESC', $twoLevelsArray['body']['orders'][0]); $this->assertEquals(400, $twoLevelsArray['headers']['status-code']);
$this->assertEquals(null, $twoLevelsArray['body']['orders'][1]); // Overwrite by API (array)
$unknown = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ $unknown = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
@ -1385,7 +1385,7 @@ trait DatabasesBase
'orders' => ['DESC'], // Check order is removed in API 'orders' => ['DESC'], // Check order is removed in API
]); ]);
// Array attributes can not be indexed due to MySQL bug // Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals(400, $index1['headers']['status-code']); $this->assertEquals(400, $index1['headers']['status-code']);
$index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ $index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
@ -1398,7 +1398,7 @@ trait DatabasesBase
'attributes' => ['integers'], // array attribute 'attributes' => ['integers'], // array attribute
]); ]);
// Array attributes can not be indexed due to MySQL bug // Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals(400, $index2['headers']['status-code']); $this->assertEquals(400, $index2['headers']['status-code']);
/** /**
@ -1413,7 +1413,7 @@ trait DatabasesBase
]), []); ]), []);
$this->assertIsArray($movies['body']['indexes']); $this->assertIsArray($movies['body']['indexes']);
$this->assertCount(8, $movies['body']['indexes']); $this->assertCount(4, $movies['body']['indexes']);
$this->assertEquals($titleIndex['body']['key'], $movies['body']['indexes'][0]['key']); $this->assertEquals($titleIndex['body']['key'], $movies['body']['indexes'][0]['key']);
$this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']); $this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']);
$this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']); $this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']);

View file

@ -1344,7 +1344,8 @@ trait DatabasesBase
'columns' => ['actors'], 'columns' => ['actors'],
]); ]);
$this->assertEquals(202, $actorsArray['headers']['status-code']); // Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals(400, $actorsArray['headers']['status-code']);
$twoLevelsArray = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([ $twoLevelsArray = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
@ -1357,9 +1358,8 @@ trait DatabasesBase
'orders' => ['DESC', 'DESC'], 'orders' => ['DESC', 'DESC'],
]); ]);
$this->assertEquals(202, $twoLevelsArray['headers']['status-code']); // Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals('DESC', $twoLevelsArray['body']['orders'][0]); $this->assertEquals(400, $twoLevelsArray['headers']['status-code']);
$this->assertEquals(null, $twoLevelsArray['body']['orders'][1]); // Overwrite by API (array)
$unknown = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([ $unknown = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
@ -1384,6 +1384,8 @@ trait DatabasesBase
'columns' => ['integers'], // array attribute 'columns' => ['integers'], // array attribute
'orders' => ['DESC'], // Check order is removed in API 'orders' => ['DESC'], // Check order is removed in API
]); ]);
// Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals(400, $index1['headers']['status-code']); $this->assertEquals(400, $index1['headers']['status-code']);
$index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([ $index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([
@ -1395,6 +1397,8 @@ trait DatabasesBase
'type' => 'key', 'type' => 'key',
'columns' => ['integers'], // array attribute 'columns' => ['integers'], // array attribute
]); ]);
// Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals(400, $index2['headers']['status-code']); $this->assertEquals(400, $index2['headers']['status-code']);
/** /**
@ -1409,7 +1413,7 @@ trait DatabasesBase
]), []); ]), []);
$this->assertIsArray($movies['body']['indexes']); $this->assertIsArray($movies['body']['indexes']);
$this->assertCount(8, $movies['body']['indexes']); $this->assertCount(4, $movies['body']['indexes']);
$this->assertEquals($titleIndex['body']['key'], $movies['body']['indexes'][0]['key']); $this->assertEquals($titleIndex['body']['key'], $movies['body']['indexes'][0]['key']);
$this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']); $this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']);
$this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']); $this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']);