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')
->inject('response')
->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);
@ -2532,7 +2532,7 @@ App::patch('/v1/projects/:projectId/auth/session-invalidation')
}
$auths = $project->getAttribute('auths', []);
$auths['invalidateSessions'] = $invalidateSessions;
$auths['invalidateSessions'] = $enabled;
$dbForPlatform->updateDocument('projects', $project->getId(), $project
->setAttribute('auths', $auths));

View file

@ -52,7 +52,7 @@
"utopia-php/cache": "0.13.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.71.*",
"utopia-php/database": "0.72.*",
"utopia-php/detector": "0.1.*",
"utopia-php/domains": "0.8.*",
"utopia-php/dsn": "0.2.1",
@ -62,7 +62,7 @@
"utopia-php/locale": "0.4.*",
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.18.*",
"utopia-php/migration": "0.12.*",
"utopia-php/migration": "0.13.*",
"utopia-php/orchestration": "0.9.*",
"utopia-php/platform": "0.7.*",
"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",
"This file is @generated automatically"
],
"content-hash": "25ac1acb960988af5c10239c3bde258b",
"content-hash": "040a8234ecf1038a7e6dc16aa2dda084",
"packages": [
{
"name": "adhocore/jwt",
@ -3493,16 +3493,16 @@
},
{
"name": "utopia-php/database",
"version": "0.71.10",
"version": "0.72.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "83278d663f9c63c25a11d9e71c7922da7ec48636"
"reference": "ad7613ac19bb799fc911cf82636a09345b2573fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/83278d663f9c63c25a11d9e71c7922da7ec48636",
"reference": "83278d663f9c63c25a11d9e71c7922da7ec48636",
"url": "https://api.github.com/repos/utopia-php/database/zipball/ad7613ac19bb799fc911cf82636a09345b2573fe",
"reference": "ad7613ac19bb799fc911cf82636a09345b2573fe",
"shasum": ""
},
"require": {
@ -3543,9 +3543,9 @@
],
"support": {
"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",
@ -3942,16 +3942,16 @@
},
{
"name": "utopia-php/messaging",
"version": "0.18.1",
"version": "0.18.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/messaging.git",
"reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f"
"reference": "0d364edacf4d4867964c7e17f653031dd39394bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/messaging/zipball/5d1245207a61d7ca065daddad7ac5f1d5640152f",
"reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f",
"url": "https://api.github.com/repos/utopia-php/messaging/zipball/0d364edacf4d4867964c7e17f653031dd39394bf",
"reference": "0d364edacf4d4867964c7e17f653031dd39394bf",
"shasum": ""
},
"require": {
@ -3987,22 +3987,22 @@
],
"support": {
"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",
"version": "0.12.0",
"version": "0.13.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "973a4daa283f711a104e9bb7cf5a79dec2988df0"
"reference": "b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/973a4daa283f711a104e9bb7cf5a79dec2988df0",
"reference": "973a4daa283f711a104e9bb7cf5a79dec2988df0",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc",
"reference": "b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc",
"shasum": ""
},
"require": {
@ -4043,9 +4043,9 @@
],
"support": {
"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",

View file

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

View file

@ -1344,7 +1344,8 @@ trait DatabasesBase
'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([
'content-type' => 'application/json',
@ -1357,9 +1358,8 @@ trait DatabasesBase
'orders' => ['DESC', 'DESC'],
]);
$this->assertEquals(202, $twoLevelsArray['headers']['status-code']);
$this->assertEquals('DESC', $twoLevelsArray['body']['orders'][0]);
$this->assertEquals(null, $twoLevelsArray['body']['orders'][1]); // Overwrite by API (array)
// Indexes on array attributes are disabled due to MySQL bug
$this->assertEquals(400, $twoLevelsArray['headers']['status-code']);
$unknown = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json',
@ -1385,7 +1385,7 @@ trait DatabasesBase
'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']);
$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
]);
// 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']);
/**
@ -1413,7 +1413,7 @@ trait DatabasesBase
]), []);
$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($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']);
$this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']);

View file

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