Compare commits

...
36 changed files with 337 additions and 174 deletions
+4 -2
View File
@@ -1,6 +1,8 @@
<?php
use Appwrite\Auth\Auth;
use Appwrite\Functions\Status;
use Appwrite\Messaging\Status as MessagingStatus;
use Utopia\Config\Config;
use Utopia\Database\Database;
use Utopia\Database\Helpers\ID;
@@ -1821,7 +1823,7 @@ $commonCollections = [
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => true,
'default' => 'processing',
'default' => MessagingStatus::SENDING,
'array' => false,
'filters' => [],
],
@@ -3618,7 +3620,7 @@ $projectCollections = array_merge([
'size' => 256,
'signed' => true,
'required' => true,
'default' => 'processing',
'default' => Status::BUILDING,
'array' => false,
'filters' => [],
],
+15 -14
View File
@@ -1,6 +1,7 @@
<?php
use Appwrite\Auth\Auth;
use Appwrite\Database\Status;
use Appwrite\Detector\Detector;
use Appwrite\Event\Database as EventDatabase;
use Appwrite\Event\Delete;
@@ -131,7 +132,7 @@ function createAttribute(string $databaseId, string $collectionId, Document $att
'collectionInternalId' => $collection->getInternalId(),
'collectionId' => $collectionId,
'type' => $type,
'status' => 'processing', // processing, available, failed, deleting, stuck
'status' => Status::CREATING,
'size' => $size,
'required' => $required,
'signed' => $signed,
@@ -173,7 +174,7 @@ function createAttribute(string $databaseId, string $collectionId, Document $att
'collectionInternalId' => $relatedCollection->getInternalId(),
'collectionId' => $relatedCollection->getId(),
'type' => $type,
'status' => 'processing', // processing, available, failed, deleting, stuck
'status' => Status::CREATING,
'size' => $size,
'required' => $required,
'signed' => $signed,
@@ -254,7 +255,7 @@ function updateAttribute(
throw new Exception(Exception::ATTRIBUTE_NOT_FOUND);
}
if ($attribute->getAttribute('status') !== 'available') {
if ($attribute->getAttribute('status') !== Status::AVAILABLE) {
throw new Exception(Exception::ATTRIBUTE_NOT_AVAILABLE);
}
@@ -2306,8 +2307,8 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/attributes/:key
}
// Only update status if removing available attribute
if ($attribute->getAttribute('status') === 'available') {
$attribute = $dbForProject->updateDocument('attributes', $attribute->getId(), $attribute->setAttribute('status', 'deleting'));
if ($attribute->getAttribute('status') === Status::AVAILABLE) {
$attribute = $dbForProject->updateDocument('attributes', $attribute->getId(), $attribute->setAttribute('status', Status::DELETING));
}
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collectionId);
@@ -2328,8 +2329,8 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/attributes/:key
throw new Exception(Exception::ATTRIBUTE_NOT_FOUND);
}
if ($relatedAttribute->getAttribute('status') === 'available') {
$dbForProject->updateDocument('attributes', $relatedAttribute->getId(), $relatedAttribute->setAttribute('status', 'deleting'));
if ($relatedAttribute->getAttribute('status') === Status::AVAILABLE) {
$dbForProject->updateDocument('attributes', $relatedAttribute->getId(), $relatedAttribute->setAttribute('status', Status::DELETING));
}
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $options['relatedCollection']);
@@ -2430,7 +2431,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes')
$oldAttributes[] = [
'key' => '$id',
'type' => Database::VAR_STRING,
'status' => 'available',
'status' => Status::AVAILABLE,
'required' => true,
'array' => false,
'default' => null,
@@ -2440,7 +2441,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes')
$oldAttributes[] = [
'key' => '$createdAt',
'type' => Database::VAR_DATETIME,
'status' => 'available',
'status' => Status::AVAILABLE,
'signed' => false,
'required' => false,
'array' => false,
@@ -2451,7 +2452,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes')
$oldAttributes[] = [
'key' => '$updatedAt',
'type' => Database::VAR_DATETIME,
'status' => 'available',
'status' => Status::AVAILABLE,
'signed' => false,
'required' => false,
'array' => false,
@@ -2480,7 +2481,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes')
}
// ensure attribute is available
if ($attributeStatus !== 'available') {
if ($attributeStatus !== Status::AVAILABLE) {
throw new Exception(Exception::ATTRIBUTE_NOT_AVAILABLE, 'Attribute not available: ' . $oldAttributes[$attributeIndex]['key']);
}
@@ -2499,7 +2500,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes')
$index = new Document([
'$id' => ID::custom($db->getInternalId() . '_' . $collection->getInternalId() . '_' . $key),
'key' => $key,
'status' => 'processing', // processing, available, failed, deleting, stuck
'status' => Status::CREATING,
'databaseInternalId' => $db->getInternalId(),
'databaseId' => $databaseId,
'collectionInternalId' => $collection->getInternalId(),
@@ -2694,8 +2695,8 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/indexes/:key')
}
// Only update status if removing available index
if ($index->getAttribute('status') === 'available') {
$index = $dbForProject->updateDocument('indexes', $index->getId(), $index->setAttribute('status', 'deleting'));
if ($index->getAttribute('status') === Status::AVAILABLE) {
$index = $dbForProject->updateDocument('indexes', $index->getId(), $index->setAttribute('status', Status::DELETING));
}
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collectionId);
+12 -11
View File
@@ -10,6 +10,7 @@ use Appwrite\Event\Usage;
use Appwrite\Event\Validator\FunctionEvent;
use Appwrite\Extend\Exception;
use Appwrite\Extend\Exception as AppwriteException;
use Appwrite\Functions\Status;
use Appwrite\Messaging\Adapter\Realtime;
use Appwrite\Platform\Tasks\ScheduleExecutions;
use Appwrite\Task\Validator\Cron;
@@ -965,7 +966,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId')
throw new Exception(Exception::BUILD_NOT_FOUND);
}
if ($build->getAttribute('status') !== 'ready') {
if ($build->getAttribute('status') !== Status::READY) {
throw new Exception(Exception::BUILD_NOT_READY);
}
@@ -1319,7 +1320,7 @@ App::get('/v1/functions/:functionId/deployments')
foreach ($results as $result) {
$build = $dbForProject->getDocument('builds', $result->getAttribute('buildId', ''));
$result->setAttribute('status', $build->getAttribute('status', 'processing'));
$result->setAttribute('status', $build->getAttribute('status', Status::BUILDING));
$result->setAttribute('buildLogs', $build->getAttribute('logs', ''));
$result->setAttribute('buildTime', $build->getAttribute('duration', 0));
$result->setAttribute('size', $result->getAttribute('size', 0) + $build->getAttribute('size', 0));
@@ -1365,7 +1366,7 @@ App::get('/v1/functions/:functionId/deployments/:deploymentId')
}
$build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId', ''));
$deployment->setAttribute('status', $build->getAttribute('status', 'waiting'));
$deployment->setAttribute('status', $build->getAttribute('status', Status::QUEUED));
$deployment->setAttribute('buildLogs', $build->getAttribute('logs', ''));
$deployment->setAttribute('buildTime', $build->getAttribute('duration', 0));
$deployment->setAttribute('size', $deployment->getAttribute('size', 0) + $build->getAttribute('size', 0));
@@ -1550,7 +1551,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId/build')
$deployment->setAttribute('buildInternalId', $build->getInternalId());
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
} else {
if (\in_array($build->getAttribute('status'), ['ready', 'failed'])) {
if (\in_array($build->getAttribute('status'), [Status::READY, Status::FAILED])) {
throw new Exception(Exception::BUILD_ALREADY_COMPLETED);
}
@@ -1643,7 +1644,7 @@ App::post('/v1/functions/:functionId/executions')
throw new Exception(Exception::BUILD_NOT_FOUND);
}
if ($build->getAttribute('status') !== 'ready') {
if ($build->getAttribute('status') !== Status::READY) {
throw new Exception(Exception::BUILD_NOT_READY);
}
@@ -1712,10 +1713,10 @@ App::post('/v1/functions/:functionId/executions')
$executionId = ID::unique();
$status = $async ? 'waiting' : 'processing';
$status = $async ? Status::QUEUED : Status::BUILDING;
if(!is_null($scheduledAt)) {
$status = 'scheduled';
$status = Status::SCHEDULED;
}
$execution = new Document([
@@ -1867,7 +1868,7 @@ App::post('/v1/functions/:functionId/executions')
}
/** Update execution status */
$status = $executionResponse['statusCode'] >= 400 ? 'failed' : 'completed';
$status = $executionResponse['statusCode'] >= 400 ? Status::FAILED : Status::SUCCESSFUL;
$execution->setAttribute('status', $status);
$execution->setAttribute('responseStatusCode', $executionResponse['statusCode']);
$execution->setAttribute('responseHeaders', $headersFiltered);
@@ -1879,7 +1880,7 @@ App::post('/v1/functions/:functionId/executions')
$execution
->setAttribute('duration', $durationEnd - $durationStart)
->setAttribute('status', 'failed')
->setAttribute('status', Status::FAILED)
->setAttribute('responseStatusCode', 500)
->setAttribute('errors', $th->getMessage() . '\nError Code: ' . $th->getCode());
Console::error($th->getMessage());
@@ -2084,7 +2085,7 @@ App::delete('/v1/functions/:functionId/executions/:executionId')
}
$status = $execution->getAttribute('status');
if (!in_array($status, ['completed', 'failed', 'scheduled'])) {
if (!in_array($status, [Status::SUCCESSFUL, Status::FAILED, Status::SCHEDULED])) {
throw new Exception(Exception::EXECUTION_IN_PROGRESS);
}
@@ -2092,7 +2093,7 @@ App::delete('/v1/functions/:functionId/executions/:executionId')
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove execution from DB');
}
if ($status === 'scheduled') {
if ($status === Status::SCHEDULED) {
$schedule = $dbForConsole->findOne('schedules', [
Query::equal('resourceId', [$execution->getId()]),
Query::equal('resourceType', [ScheduleExecutions::getSupportedResource()]),
+19 -19
View File
@@ -2610,7 +2610,7 @@ App::post('/v1/messaging/messages/email')
$status = MessageStatus::DRAFT;
} else {
$status = \is_null($scheduledAt)
? MessageStatus::PROCESSING
? MessageStatus::SENDING
: MessageStatus::SCHEDULED;
}
@@ -2684,7 +2684,7 @@ App::post('/v1/messaging/messages/email')
]));
switch ($status) {
case MessageStatus::PROCESSING:
case MessageStatus::SENDING:
$queueForMessaging
->setType(MESSAGE_SEND_TYPE_EXTERNAL)
->setMessageId($message->getId());
@@ -2757,7 +2757,7 @@ App::post('/v1/messaging/messages/sms')
$status = MessageStatus::DRAFT;
} else {
$status = \is_null($scheduledAt)
? MessageStatus::PROCESSING
? MessageStatus::SENDING
: MessageStatus::SCHEDULED;
}
@@ -2800,7 +2800,7 @@ App::post('/v1/messaging/messages/sms')
]));
switch ($status) {
case MessageStatus::PROCESSING:
case MessageStatus::SENDING:
$queueForMessaging
->setType(MESSAGE_SEND_TYPE_EXTERNAL)
->setMessageId($message->getId());
@@ -2882,7 +2882,7 @@ App::post('/v1/messaging/messages/push')
$status = MessageStatus::DRAFT;
} else {
$status = \is_null($scheduledAt)
? MessageStatus::PROCESSING
? MessageStatus::SENDING
: MessageStatus::SCHEDULED;
}
@@ -2976,7 +2976,7 @@ App::post('/v1/messaging/messages/push')
]));
switch ($status) {
case MessageStatus::PROCESSING:
case MessageStatus::SENDING:
$queueForMessaging
->setType(MESSAGE_SEND_TYPE_EXTERNAL)
->setMessageId($message->getId());
@@ -3286,7 +3286,7 @@ App::patch('/v1/messaging/messages/email/:messageId')
$status = MessageStatus::DRAFT;
} else {
$status = \is_null($scheduledAt)
? MessageStatus::PROCESSING
? MessageStatus::SENDING
: MessageStatus::SCHEDULED;
}
} else {
@@ -3305,9 +3305,9 @@ App::patch('/v1/messaging/messages/email/:messageId')
$currentScheduledAt = $message->getAttribute('scheduledAt');
switch ($message->getAttribute('status')) {
case MessageStatus::PROCESSING:
case MessageStatus::SENDING:
throw new Exception(Exception::MESSAGE_ALREADY_PROCESSING);
case MessageStatus::SENT:
case MessageStatus::DELIVERED:
throw new Exception(Exception::MESSAGE_ALREADY_SENT);
case MessageStatus::FAILED:
throw new Exception(Exception::MESSAGE_ALREADY_FAILED);
@@ -3429,7 +3429,7 @@ App::patch('/v1/messaging/messages/email/:messageId')
$message = $dbForProject->updateDocument('messages', $message->getId(), $message);
if ($status === MessageStatus::PROCESSING) {
if ($status === MessageStatus::SENDING) {
$queueForMessaging
->setType(MESSAGE_SEND_TYPE_EXTERNAL)
->setMessageId($message->getId());
@@ -3481,7 +3481,7 @@ App::patch('/v1/messaging/messages/sms/:messageId')
$status = MessageStatus::DRAFT;
} else {
$status = \is_null($scheduledAt)
? MessageStatus::PROCESSING
? MessageStatus::SENDING
: MessageStatus::SCHEDULED;
}
} else {
@@ -3500,9 +3500,9 @@ App::patch('/v1/messaging/messages/sms/:messageId')
$currentScheduledAt = $message->getAttribute('scheduledAt');
switch ($message->getAttribute('status')) {
case MessageStatus::PROCESSING:
case MessageStatus::SENDING:
throw new Exception(Exception::MESSAGE_ALREADY_PROCESSING);
case MessageStatus::SENT:
case MessageStatus::DELIVERED:
throw new Exception(Exception::MESSAGE_ALREADY_SENT);
case MessageStatus::FAILED:
throw new Exception(Exception::MESSAGE_ALREADY_FAILED);
@@ -3584,7 +3584,7 @@ App::patch('/v1/messaging/messages/sms/:messageId')
$message = $dbForProject->updateDocument('messages', $message->getId(), $message);
if ($status === MessageStatus::PROCESSING) {
if ($status === MessageStatus::SENDING) {
$queueForMessaging
->setType(MESSAGE_SEND_TYPE_EXTERNAL)
->setMessageId($message->getId());
@@ -3645,7 +3645,7 @@ App::patch('/v1/messaging/messages/push/:messageId')
$status = MessageStatus::DRAFT;
} else {
$status = \is_null($scheduledAt)
? MessageStatus::PROCESSING
? MessageStatus::SENDING
: MessageStatus::SCHEDULED;
}
} else {
@@ -3664,9 +3664,9 @@ App::patch('/v1/messaging/messages/push/:messageId')
$currentScheduledAt = $message->getAttribute('scheduledAt');
switch ($message->getAttribute('status')) {
case MessageStatus::PROCESSING:
case MessageStatus::SENDING:
throw new Exception(Exception::MESSAGE_ALREADY_PROCESSING);
case MessageStatus::SENT:
case MessageStatus::DELIVERED:
throw new Exception(Exception::MESSAGE_ALREADY_SENT);
case MessageStatus::FAILED:
throw new Exception(Exception::MESSAGE_ALREADY_FAILED);
@@ -3822,7 +3822,7 @@ App::patch('/v1/messaging/messages/push/:messageId')
$message = $dbForProject->updateDocument('messages', $message->getId(), $message);
if ($status === MessageStatus::PROCESSING) {
if ($status === MessageStatus::SENDING) {
$queueForMessaging
->setType(MESSAGE_SEND_TYPE_EXTERNAL)
->setMessageId($message->getId());
@@ -3862,7 +3862,7 @@ App::delete('/v1/messaging/messages/:messageId')
}
switch ($message->getAttribute('status')) {
case MessageStatus::PROCESSING:
case MessageStatus::SENDING:
throw new Exception(Exception::MESSAGE_ALREADY_SCHEDULED);
case MessageStatus::SCHEDULED:
$scheduleId = $message->getAttribute('scheduleId');
+2 -1
View File
@@ -4,6 +4,7 @@ use Appwrite\Auth\OAuth2\Github as OAuth2Github;
use Appwrite\Event\Build;
use Appwrite\Event\Delete;
use Appwrite\Extend\Exception;
use Appwrite\Functions\Status;
use Appwrite\Utopia\Database\Validator\Queries\Installations;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
@@ -94,7 +95,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
}
}
$commentStatus = $isAuthorized ? 'waiting' : 'failed';
$commentStatus = $isAuthorized ? Status::QUEUED : Status::FAILED;
$authorizeUrl = $request->getProtocol() . '://' . $request->getHostname() . "/git/authorize-contributor?projectId={$projectId}&installationId={$installationId}&repositoryId={$repositoryId}&providerPullRequestId={$providerPullRequestId}";
+5 -4
View File
@@ -8,6 +8,7 @@ use Appwrite\Event\Certificate;
use Appwrite\Event\Event;
use Appwrite\Event\Usage;
use Appwrite\Extend\Exception as AppwriteException;
use Appwrite\Functions\Status;
use Appwrite\Network\Validator\Origin;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Request\Filters\V16 as RequestV16;
@@ -156,7 +157,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
throw new AppwriteException(AppwriteException::BUILD_NOT_FOUND);
}
if ($build->getAttribute('status') !== 'ready') {
if ($build->getAttribute('status') !== Status::READY) {
throw new AppwriteException(AppwriteException::BUILD_NOT_READY);
}
@@ -212,7 +213,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
'deploymentInternalId' => $deployment->getInternalId(),
'deploymentId' => $deployment->getId(),
'trigger' => 'http', // http / schedule / event
'status' => 'processing', // waiting / processing / completed / failed
'status' => Status::EXECUTING,
'responseStatusCode' => 0,
'responseHeaders' => [],
'requestPath' => $path,
@@ -302,7 +303,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
}
/** Update execution status */
$status = $executionResponse['statusCode'] >= 400 ? 'failed' : 'completed';
$status = $executionResponse['statusCode'] >= 400 ? Status::FAILED : Status::SUCCESSFUL;
$execution->setAttribute('status', $status);
$execution->setAttribute('responseStatusCode', $executionResponse['statusCode']);
$execution->setAttribute('responseHeaders', $headersFiltered);
@@ -315,7 +316,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
$execution
->setAttribute('duration', $durationEnd - $durationStart)
->setAttribute('status', 'failed')
->setAttribute('status', Status::FAILED)
->setAttribute('responseStatusCode', 500)
->setAttribute('errors', $th->getMessage() . '\nError Code: ' . $th->getCode());
Console::error($th->getMessage());
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Appwrite\Database;
class Status
{
public const QUEUED = 'queued';
public const FAILED = 'failed';
public const AVAILABLE = 'available';
public const DELETING = 'deleting';
public const CREATING = 'creating';
public static function getV18status(string $status): string
{
return match ($status) {
self::CREATING => 'processing',
default => $status
};
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Appwrite\Functions;
class Status
{
public const QUEUED = 'queued';
public const CANCELLED = 'cancelled';
public const FAILED = 'failed';
// For builds only
public const READY = 'ready';
public const BUILDING = 'building';
// For executions only
public const EXECUTING = 'executing';
public const SCHEDULED = 'scheduled';
public const SUCCESSFUL = 'successful';
public static function getV18status(string $status): string
{
return match ($status) {
self::QUEUED => 'waiting',
self::EXECUTING => 'processing',
self::SUCCESSFUL => 'completed',
default => $status
};
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
namespace Appwrite\GraphQL;
use Appwrite\Database\Status;
use Appwrite\GraphQL\Types\Mapper;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
@@ -157,7 +158,7 @@ class Schema
while (!empty($attrs = $attributes($limit, $offset))) {
foreach ($attrs as $attr) {
if ($attr['status'] !== 'available') {
if ($attr['status'] !== Status::AVAILABLE) {
continue;
}
$databaseId = $attr['databaseId'];
+11 -2
View File
@@ -15,13 +15,22 @@ class Status
/**
* Picked up by the worker and starting to send
*/
public const PROCESSING = 'processing';
public const SENDING = 'sending';
/**
* Sent without errors
*/
public const SENT = 'sent';
public const DELIVERED = 'delivered';
/**
* Sent with some errors
*/
public const FAILED = 'failed';
public static function getV18status(string $status): string
{
return match ($status) {
self::DELIVERED => 'sent',
self::SENDING => 'processing',
default => $status
};
}
}
+38
View File
@@ -2,6 +2,9 @@
namespace Appwrite\Migration\Version;
use Appwrite\Database\Status as DatabaseStatus;
use Appwrite\Functions\Status as FunctionStatus;
use Appwrite\Messaging\Status as MessagingStatus;
use Appwrite\Migration\Migration;
use Exception;
use Throwable;
@@ -173,6 +176,41 @@ class V21 extends Migration
// Add size attribute
$document->setAttribute('size', 's-1vcpu-512m');
break;
case 'executions':
$status = $document->getAttribute('status');
$status = match ($status) {
'waiting' => FunctionStatus::QUEUED,
'processing' => FunctionStatus::EXECUTING,
'completed' => FunctionStatus::SUCCESSFUL,
default => $status
};
$document->setAttribute('status', $status);
break;
case 'messages':
$status = $document->getAttribute('status');
$status = match ($status) {
'sent' => MessagingStatus::DELIVERED,
'processing' => MessagingStatus::SENDING,
default => $status
};
$document->setAttribute('status', $status);
break;
case 'attributes':
$status = $document->getAttribute('status');
$status = match ($status) {
'processing' => DatabaseStatus::CREATING,
'stuck' => DatabaseStatus::FAILED,
default => $status
};
$document->setAttribute('status', $status);
break;
}
return $document;
+17 -16
View File
@@ -5,6 +5,7 @@ namespace Appwrite\Platform\Workers;
use Appwrite\Event\Event;
use Appwrite\Event\Func;
use Appwrite\Event\Usage;
use Appwrite\Functions\Status;
use Appwrite\Messaging\Adapter\Realtime;
use Appwrite\Utopia\Response\Model\Deployment;
use Appwrite\Vcs\Comment;
@@ -167,7 +168,7 @@ class Builds extends Action
'startTime' => $startTime,
'deploymentInternalId' => $deployment->getInternalId(),
'deploymentId' => $deployment->getId(),
'status' => 'processing',
'status' => Status::BUILDING,
'path' => '',
'runtime' => $function->getAttribute('runtime'),
'source' => $deployment->getAttribute('path', ''),
@@ -334,15 +335,15 @@ class Builds extends Action
$build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('source', $source));
$this->runGitAction('processing', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
$this->runGitAction(Status::BUILDING, $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
}
/** Request the executor to build the code... */
$build->setAttribute('status', 'building');
$build->setAttribute('status', Status::BUILDING);
$build = $dbForProject->updateDocument('builds', $buildId, $build);
if ($isVcsEnabled) {
$this->runGitAction('building', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
$this->runGitAction(Status::BUILDING, $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
}
/** Trigger Webhook */
@@ -496,13 +497,13 @@ class Builds extends Action
$build->setAttribute('startTime', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime']))));
$build->setAttribute('endTime', $endTime);
$build->setAttribute('duration', \intval(\ceil($durationEnd - $durationStart)));
$build->setAttribute('status', 'ready');
$build->setAttribute('status', Status::READY);
$build->setAttribute('path', $response['path']);
$build->setAttribute('size', $response['size']);
$build->setAttribute('logs', $response['output']);
if ($isVcsEnabled) {
$this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
$this->runGitAction(Status::READY, $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
}
Console::success("Build id: $buildId created");
@@ -539,11 +540,11 @@ class Builds extends Action
$durationEnd = \microtime(true);
$build->setAttribute('endTime', $endTime);
$build->setAttribute('duration', \intval(\ceil($durationEnd - $durationStart)));
$build->setAttribute('status', 'failed');
$build->setAttribute('status', Status::FAILED);
$build->setAttribute('logs', $th->getMessage() . "\n" . $th->getFile() . ':' . $th->getLine() . "\n" . $th->getTraceAsString());
if ($isVcsEnabled) {
$this->runGitAction('failed', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
$this->runGitAction(Status::FAILED, $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole);
}
} finally {
$build = $dbForProject->updateDocument('builds', $buildId, $build);
@@ -566,13 +567,13 @@ class Builds extends Action
);
/** Trigger usage queue */
if ($build->getAttribute('status') === 'ready') {
if ($build->getAttribute('status') === Status::READY) {
$queueForUsage
->addMetric(METRIC_BUILDS_SUCCESS, 1) // per project
->addMetric(METRIC_BUILDS_COMPUTE_SUCCESS, (int)$build->getAttribute('duration', 0) * 1000)
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_SUCCESS), 1) // per function
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE_SUCCESS), (int)$build->getAttribute('duration', 0) * 1000);
} elseif ($build->getAttribute('status') === 'failed') {
} elseif ($build->getAttribute('status') === Status::FAILED) {
$queueForUsage
->addMetric(METRIC_BUILDS_FAILED, 1) // per project
->addMetric(METRIC_BUILDS_COMPUTE_FAILED, (int)$build->getAttribute('duration', 0) * 1000)
@@ -621,16 +622,16 @@ class Builds extends Action
if (!empty($providerCommitHash)) {
$message = match ($status) {
'ready' => 'Build succeeded.',
'failed' => 'Build failed.',
'processing' => 'Building...',
Status::READY => 'Build ready.',
Status::FAILED => 'Build failed.',
Status::BUILDING => 'Building...',
default => $status
};
$state = match ($status) {
'ready' => 'success',
'failed' => 'failure',
'processing' => 'pending',
Status::READY => 'success.',
Status::FAILED => 'failure.',
Status::BUILDING => 'pending',
default => $status
};
+13 -12
View File
@@ -2,6 +2,7 @@
namespace Appwrite\Platform\Workers;
use Appwrite\Database\Status;
use Appwrite\Event\Event;
use Appwrite\Messaging\Adapter\Realtime;
use Exception;
@@ -160,7 +161,7 @@ class Databases extends Action
if ($options['twoWay']) {
$relatedAttribute = $dbForProject->getDocument('attributes', $database->getInternalId() . '_' . $relatedCollection->getInternalId() . '_' . $options['twoWayKey']);
$dbForProject->updateDocument('attributes', $relatedAttribute->getId(), $relatedAttribute->setAttribute('status', 'available'));
$dbForProject->updateDocument('attributes', $relatedAttribute->getId(), $relatedAttribute->setAttribute('status', Status::AVAILABLE));
}
break;
default:
@@ -169,7 +170,7 @@ class Databases extends Action
}
}
$dbForProject->updateDocument('attributes', $attribute->getId(), $attribute->setAttribute('status', 'available'));
$dbForProject->updateDocument('attributes', $attribute->getId(), $attribute->setAttribute('status', Status::AVAILABLE));
} catch (\Throwable $e) {
// TODO: Send non DatabaseExceptions to Sentry
Console::error($e->getMessage());
@@ -184,14 +185,14 @@ class Databases extends Action
$dbForProject->updateDocument(
'attributes',
$attribute->getId(),
$attribute->setAttribute('status', 'failed')
$attribute->setAttribute('status', Status::FAILED)
);
if (isset($relatedAttribute)) {
$dbForProject->updateDocument(
'attributes',
$relatedAttribute->getId(),
$relatedAttribute->setAttribute('status', 'failed')
$relatedAttribute->setAttribute('status', Status::FAILED)
);
}
} finally {
@@ -249,7 +250,7 @@ class Databases extends Action
// - stuck: attribute was available but cannot be removed
try {
if ($status !== 'failed') {
if ($status !== Status::FAILED) {
if ($type === Database::VAR_RELATIONSHIP) {
if ($options['twoWay']) {
$relatedCollection = $dbForProject->getDocument('database_' . $database->getInternalId(), $options['relatedCollection']);
@@ -260,7 +261,7 @@ class Databases extends Action
}
if (!$dbForProject->deleteRelationship('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $key)) {
$dbForProject->updateDocument('attributes', $relatedAttribute->getId(), $relatedAttribute->setAttribute('status', 'stuck'));
$dbForProject->updateDocument('attributes', $relatedAttribute->getId(), $relatedAttribute->setAttribute('status', Status::FAILED));
throw new DatabaseException('Failed to delete Relationship');
}
} elseif (!$dbForProject->deleteAttribute('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $key)) {
@@ -286,13 +287,13 @@ class Databases extends Action
$dbForProject->updateDocument(
'attributes',
$attribute->getId(),
$attribute->setAttribute('status', 'stuck')
$attribute->setAttribute('status', Status::FAILED)
);
if (!$relatedAttribute->isEmpty()) {
$dbForProject->updateDocument(
'attributes',
$relatedAttribute->getId(),
$relatedAttribute->setAttribute('status', 'stuck')
$relatedAttribute->setAttribute('status', Status::FAILED)
);
}
} finally {
@@ -400,7 +401,7 @@ class Databases extends Action
if (!$dbForProject->createIndex('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $key, $type, $attributes, $lengths, $orders)) {
throw new DatabaseException('Failed to create Index');
}
$dbForProject->updateDocument('indexes', $index->getId(), $index->setAttribute('status', 'available'));
$dbForProject->updateDocument('indexes', $index->getId(), $index->setAttribute('status', Status::AVAILABLE));
} catch (\Throwable $e) {
// TODO: Send non DatabaseExceptions to Sentry
Console::error($e->getMessage());
@@ -411,7 +412,7 @@ class Databases extends Action
$dbForProject->updateDocument(
'indexes',
$index->getId(),
$index->setAttribute('status', 'failed')
$index->setAttribute('status', Status::FAILED)
);
} finally {
$this->trigger($database, $collection, $index, $project, $projectId, $events);
@@ -454,7 +455,7 @@ class Databases extends Action
$project = $dbForConsole->getDocument('projects', $projectId);
try {
if ($status !== 'failed' && !$dbForProject->deleteIndex('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $key)) {
if ($status !== Status::FAILED && !$dbForProject->deleteIndex('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $key)) {
throw new DatabaseException('Failed to delete index');
}
$dbForProject->deleteDocument('indexes', $index->getId());
@@ -469,7 +470,7 @@ class Databases extends Action
$dbForProject->updateDocument(
'indexes',
$index->getId(),
$index->setAttribute('status', 'stuck')
$index->setAttribute('status', Status::FAILED)
);
} finally {
$this->trigger($database, $collection, $index, $project, $projectId, $events);
+8 -7
View File
@@ -6,6 +6,7 @@ use Ahc\Jwt\JWT;
use Appwrite\Event\Event;
use Appwrite\Event\Func;
use Appwrite\Event\Usage;
use Appwrite\Functions\Status;
use Appwrite\Messaging\Adapter\Realtime;
use Appwrite\Utopia\Response\Model\Execution;
use Exception;
@@ -248,7 +249,7 @@ class Functions extends Action
'deploymentInternalId' => '',
'deploymentId' => '',
'trigger' => $trigger,
'status' => 'failed',
'status' => Status::FAILED,
'responseStatusCode' => 0,
'responseHeaders' => [],
'requestPath' => $path,
@@ -345,7 +346,7 @@ class Functions extends Action
return;
}
if ($build->getAttribute('status') !== 'ready') {
if ($build->getAttribute('status') !== Status::READY) {
$errorMessage = 'The execution could not be completed because the build is not ready. Please wait for the build to complete and try again.';
$this->fail($errorMessage, $dbForProject, $function, $trigger, $path, $method, $user, $jwt, $event);
return;
@@ -396,7 +397,7 @@ class Functions extends Action
'deploymentInternalId' => $deployment->getInternalId(),
'deploymentId' => $deployment->getId(),
'trigger' => $trigger,
'status' => 'processing',
'status' => Status::EXECUTING,
'responseStatusCode' => 0,
'responseHeaders' => [],
'requestPath' => $path,
@@ -417,8 +418,8 @@ class Functions extends Action
}
}
if ($execution->getAttribute('status') !== 'processing') {
$execution->setAttribute('status', 'processing');
if ($execution->getAttribute('status') !== Status::EXECUTING) {
$execution->setAttribute('status', Status::EXECUTING);
$execution = $dbForProject->updateDocument('executions', $executionId, $execution);
}
@@ -494,7 +495,7 @@ class Functions extends Action
logging: $function->getAttribute('logging', true),
);
$status = $executionResponse['statusCode'] >= 400 ? 'failed' : 'completed';
$status = $executionResponse['statusCode'] >= 400 ? Status::FAILED : Status::SUCCESSFUL;
$headersFiltered = [];
foreach ($executionResponse['headers'] as $key => $value) {
@@ -515,7 +516,7 @@ class Functions extends Action
$durationEnd = \microtime(true);
$execution
->setAttribute('duration', $durationEnd - $durationStart)
->setAttribute('status', 'failed')
->setAttribute('status', Status::FAILED)
->setAttribute('responseStatusCode', 500)
->setAttribute('errors', $th->getMessage() . '\nError Code: ' . $th->getCode());
+1 -1
View File
@@ -315,7 +315,7 @@ class Messaging extends Action
if (\count($message->getAttribute('deliveryErrors')) > 0) {
$message->setAttribute('status', MessageStatus::FAILED);
} else {
$message->setAttribute('status', MessageStatus::SENT);
$message->setAttribute('status', MessageStatus::DELIVERED);
}
$message->removeAttribute('to');
+40 -1
View File
@@ -2,6 +2,9 @@
namespace Appwrite\Utopia\Response\Filters;
use Appwrite\Database\Status as DatabaseStatus;
use Appwrite\Functions\Status as FunctionStatus;
use Appwrite\Messaging\Status as MessagingStatus;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Filter;
@@ -12,18 +15,40 @@ class V18 extends Filter
{
$parsedResponse = $content;
$parsedResponse = match($model) {
$parsedResponse = match ($model) {
Response::MODEL_FUNCTION => $this->parseFunction($content),
Response::MODEL_EXECUTION => $this->parseExecution($content),
Response::MODEL_BUILD => $this->parseBuild($content),
Response::MODEL_PROJECT => $this->parseProject($content),
Response::MODEL_MESSAGE => $this->parseMessage($content),
Response::MODEL_INDEX,
Response::MODEL_ATTRIBUTE,
Response::MODEL_ATTRIBUTE_IP,
Response::MODEL_ATTRIBUTE_URL,
Response::MODEL_ATTRIBUTE_ENUM,
Response::MODEL_ATTRIBUTE_EMAIL,
Response::MODEL_ATTRIBUTE_FLOAT,
Response::MODEL_ATTRIBUTE_INTEGER,
Response::MODEL_ATTRIBUTE_BOOLEAN,
Response::MODEL_ATTRIBUTE_DATETIME,
Response::MODEL_ATTRIBUTE_RELATIONSHIP, => $this->parseAttribute($content),
default => $parsedResponse,
};
return $parsedResponse;
}
protected function parseBuild(array $content)
{
$content['status'] = FunctionStatus::getV18status($content['status']);
return $content;
}
protected function parseExecution(array $content)
{
$content['status'] = FunctionStatus::getV18status($content['status']);
unset($content['scheduledAt']);
return $content;
}
@@ -40,4 +65,18 @@ class V18 extends Filter
unset($content['authSessionAlerts']);
return $content;
}
protected function parseMessage(array $content)
{
$content['status'] = MessagingStatus::getV18status($content['status']);
return $content;
}
private function parseAttribute(array $content)
{
$content['status'] = DatabaseStatus::getV18status($content['status']);
return $content;
}
}
@@ -2,6 +2,7 @@
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Database\Status;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
@@ -24,9 +25,9 @@ class Attribute extends Model
])
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`',
'description' => 'Attribute status. Possible values: `'.Status::QUEUED.'`,`'.Status::CREATING.'`,`'.Status::DELETING.'`,`'.Status::AVAILABLE.'`, , or `'.Status::FAILED.'`',
'default' => '',
'example' => 'available',
'example' => Status::AVAILABLE,
])
->addRule('error', [
'type' => self::TYPE_STRING,
+4 -6
View File
@@ -2,6 +2,8 @@
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Functions\Status as FunctionsStatus;
use Appwrite\Messaging\Status;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
@@ -22,16 +24,12 @@ class Build extends Model
'default' => '',
'example' => '5e5ea5c16897e',
])
// Build Status
// Failed - The deployment build has failed. More details can usually be found in buildStderr
// Ready - The deployment build was successful and the deployment is ready to be deployed
// Processing - The deployment is currently waiting to have a build triggered
// Building - The deployment is currently being built
/** Build Status check \Appwrite\Functions\Status */
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'The build status. There are a few different types and each one means something different. \nFailed - The deployment build has failed. More details can usually be found in buildStderr\nReady - The deployment build was successful and the deployment is ready to be deployed\nProcessing - The deployment is currently waiting to have a build triggered\nBuilding - The deployment is currently being built',
'default' => '',
'example' => 'ready',
'example' => FunctionsStatus::READY,
])
->addRule('stdout', [
'type' => self::TYPE_STRING,
@@ -2,6 +2,7 @@
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Functions\Status;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
@@ -72,9 +73,9 @@ class Deployment extends Model
])
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'The deployment status. Possible values are "processing", "building", "waiting", "ready", and "failed".',
'description' => 'The deployment status. Possible values are "' . Status::QUEUED . '","' . Status::BUILDING . '","' . Status::READY . '","' . Status::FAILED . '", and "' . Status::CANCELLED . '".',
'default' => '',
'example' => 'ready',
'example' => Status::READY,
])
->addRule('buildLogs', [
'type' => self::TYPE_STRING,
@@ -2,6 +2,7 @@
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Functions\Status;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
use Utopia\Database\DateTime;
@@ -51,9 +52,9 @@ class Execution extends Model
])
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.',
'description' => 'The status of the function execution. Possible values can be: `'.Status::QUEUED.'`,`'.Status::EXECUTING.'`,`'.Status::SUCCESSFUL.'`,`'.Status::CANCELLED.'`, or `'.Status::FAILED.'`.',
'default' => '',
'example' => 'processing',
'example' => Status::EXECUTING,
])
->addRule('requestMethod', [
'type' => self::TYPE_STRING,
+2 -1
View File
@@ -2,6 +2,7 @@
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Database\Status;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
@@ -24,7 +25,7 @@ class Index extends Model
])
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`',
'description' => 'Index status. Possible values: `'.Status::QUEUED.'`,`'.Status::CREATING.'`,`'.Status::DELETING.'`,`'.Status::AVAILABLE.'`, , or `'.Status::FAILED.'`',
'default' => '',
'example' => 'available',
])
@@ -2,6 +2,7 @@
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Messaging\Status;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
use Utopia\Database\DateTime;
@@ -96,8 +97,8 @@ class Message extends Model
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'Status of delivery.',
'default' => 'draft',
'example' => 'Message status can be one of the following: draft, processing, scheduled, sent, or failed.',
'default' => Status::DRAFT,
'example' => 'Message status can be one of the following: ' . Status::DRAFT . ',' . Status::SCHEDULED . ',' . Status::SENDING . ',' . Status::DELIVERED . ' or '.Status::FAILED.'.',
]);
}
+8 -8
View File
@@ -2,6 +2,7 @@
namespace Appwrite\Vcs;
use Appwrite\Functions\Status;
use Utopia\Database\Document;
use Utopia\System\System;
@@ -76,9 +77,9 @@ class Comment
$hostname = System::getEnv('_APP_DOMAIN');
foreach ($project['functions'] as $functionId => $function) {
if ($function['status'] === 'waiting' || $function['status'] === 'processing' || $function['status'] === 'building') {
if ($function['status'] == Status::QUEUED || $function['status'] === Status::BUILDING) {
$text .= "**Your function deployment is in progress. Please check back in a few minutes for the updated status.**\n\n";
} elseif ($function['status'] === 'ready') {
} elseif ($function['status'] === Status::READY) {
$text .= "**Your function has been successfully deployed.**\n\n";
} else {
$text .= "**Your function deployment has failed. Please check the logs for more details and retry.**\n\n";
@@ -89,7 +90,7 @@ class Comment
$text .= "| :- | :- | :- | :- |\n";
$generateImage = function (string $status) use ($protocol, $hostname) {
$extention = $status === 'building' ? 'gif' : 'png';
$extention = $status === Status::BUILDING ? 'gif' : 'png';
$imagesUrl = $protocol . '://' . $hostname . '/images/vcs/';
$imageUrl = '<picture><source media="(prefers-color-scheme: dark)" srcset="' . $imagesUrl . 'status-' . $status . '-dark.' . $extention . '"><img alt="' . $status . '" height="25" align="center" src="' . $imagesUrl . 'status-' . $status . '-light.' . $extention . '"></picture>';
@@ -97,11 +98,10 @@ class Comment
};
$status = match ($function['status']) {
'waiting' => $generateImage('waiting') . ' Waiting to build',
'processing' => $generateImage('processing') . ' Processing',
'building' => $generateImage('building') . ' Building',
'ready' => $generateImage('ready') . ' Ready',
'failed' => $generateImage('failed') . ' Failed',
Status::QUEUED => $generateImage(Status::QUEUED) . ' Queued',
Status::BUILDING => $generateImage(Status::BUILDING) . ' Building',
Status::READY => $generateImage(Status::READY) . ' Ready',
Status::FAILED => $generateImage(Status::FAILED) . ' Failed',
};
if ($function['action']['type'] === 'logs') {
+7 -6
View File
@@ -2,6 +2,7 @@
namespace Tests\E2E\General;
use Appwrite\Functions\Status;
use Appwrite\Tests\Retry;
use CURLFile;
use DateTime;
@@ -686,9 +687,9 @@ class UsageTest extends Scope
$executionTime += (int) ($response['body']['duration'] * 1000);
if ($response['body']['status'] == 'failed') {
if ($response['body']['status'] == Status::FAILED) {
$failures += 1;
} elseif ($response['body']['status'] == 'completed') {
} elseif ($response['body']['status'] == Status::SUCCESSFUL) {
$executions += 1;
}
@@ -708,9 +709,9 @@ class UsageTest extends Scope
$this->assertNotEmpty($response['body']['$id']);
$this->assertEquals($functionId, $response['body']['functionId']);
if ($response['body']['status'] == 'failed') {
if ($response['body']['status'] == Status::FAILED) {
$failures += 1;
} elseif ($response['body']['status'] == 'completed') {
} elseif ($response['body']['status'] == Status::SUCCESSFUL) {
$executions += 1;
}
$executionTime += (int) ($response['body']['duration'] * 1000);
@@ -741,9 +742,9 @@ class UsageTest extends Scope
], $this->getHeaders()),
);
if ($response['body']['status'] == 'failed') {
if ($response['body']['status'] == Status::FAILED) {
$failures += 1;
} elseif ($response['body']['status'] == 'completed') {
} elseif ($response['body']['status'] == Status::SUCCESSFUL) {
$executions += 1;
}
+16 -15
View File
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Databases;
use Appwrite\Database\Status;
use Appwrite\Extend\Exception;
use Tests\E2E\Client;
use Utopia\Database\Database;
@@ -789,7 +790,7 @@ trait DatabasesBase
$this->assertEquals(200, $stringResponse['headers']['status-code']);
$this->assertEquals($string['body']['key'], $stringResponse['body']['key']);
$this->assertEquals($string['body']['type'], $stringResponse['body']['type']);
$this->assertEquals('available', $stringResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $stringResponse['body']['status']);
$this->assertEquals($string['body']['required'], $stringResponse['body']['required']);
$this->assertEquals($string['body']['array'], $stringResponse['body']['array']);
$this->assertEquals(16, $stringResponse['body']['size']);
@@ -798,7 +799,7 @@ trait DatabasesBase
$this->assertEquals(200, $emailResponse['headers']['status-code']);
$this->assertEquals($email['body']['key'], $emailResponse['body']['key']);
$this->assertEquals($email['body']['type'], $emailResponse['body']['type']);
$this->assertEquals('available', $emailResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $emailResponse['body']['status']);
$this->assertEquals($email['body']['required'], $emailResponse['body']['required']);
$this->assertEquals($email['body']['array'], $emailResponse['body']['array']);
$this->assertEquals($email['body']['format'], $emailResponse['body']['format']);
@@ -807,7 +808,7 @@ trait DatabasesBase
$this->assertEquals(200, $enumResponse['headers']['status-code']);
$this->assertEquals($enum['body']['key'], $enumResponse['body']['key']);
$this->assertEquals($enum['body']['type'], $enumResponse['body']['type']);
$this->assertEquals('available', $enumResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $enumResponse['body']['status']);
$this->assertEquals($enum['body']['required'], $enumResponse['body']['required']);
$this->assertEquals($enum['body']['array'], $enumResponse['body']['array']);
$this->assertEquals($enum['body']['format'], $enumResponse['body']['format']);
@@ -817,7 +818,7 @@ trait DatabasesBase
$this->assertEquals(200, $ipResponse['headers']['status-code']);
$this->assertEquals($ip['body']['key'], $ipResponse['body']['key']);
$this->assertEquals($ip['body']['type'], $ipResponse['body']['type']);
$this->assertEquals('available', $ipResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $ipResponse['body']['status']);
$this->assertEquals($ip['body']['required'], $ipResponse['body']['required']);
$this->assertEquals($ip['body']['array'], $ipResponse['body']['array']);
$this->assertEquals($ip['body']['format'], $ipResponse['body']['format']);
@@ -826,7 +827,7 @@ trait DatabasesBase
$this->assertEquals(200, $urlResponse['headers']['status-code']);
$this->assertEquals($url['body']['key'], $urlResponse['body']['key']);
$this->assertEquals($url['body']['type'], $urlResponse['body']['type']);
$this->assertEquals('available', $urlResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $urlResponse['body']['status']);
$this->assertEquals($url['body']['required'], $urlResponse['body']['required']);
$this->assertEquals($url['body']['array'], $urlResponse['body']['array']);
$this->assertEquals($url['body']['format'], $urlResponse['body']['format']);
@@ -835,7 +836,7 @@ trait DatabasesBase
$this->assertEquals(200, $integerResponse['headers']['status-code']);
$this->assertEquals($integer['body']['key'], $integerResponse['body']['key']);
$this->assertEquals($integer['body']['type'], $integerResponse['body']['type']);
$this->assertEquals('available', $integerResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $integerResponse['body']['status']);
$this->assertEquals($integer['body']['required'], $integerResponse['body']['required']);
$this->assertEquals($integer['body']['array'], $integerResponse['body']['array']);
$this->assertEquals($integer['body']['min'], $integerResponse['body']['min']);
@@ -845,7 +846,7 @@ trait DatabasesBase
$this->assertEquals(200, $floatResponse['headers']['status-code']);
$this->assertEquals($float['body']['key'], $floatResponse['body']['key']);
$this->assertEquals($float['body']['type'], $floatResponse['body']['type']);
$this->assertEquals('available', $floatResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $floatResponse['body']['status']);
$this->assertEquals($float['body']['required'], $floatResponse['body']['required']);
$this->assertEquals($float['body']['array'], $floatResponse['body']['array']);
$this->assertEquals($float['body']['min'], $floatResponse['body']['min']);
@@ -855,7 +856,7 @@ trait DatabasesBase
$this->assertEquals(200, $booleanResponse['headers']['status-code']);
$this->assertEquals($boolean['body']['key'], $booleanResponse['body']['key']);
$this->assertEquals($boolean['body']['type'], $booleanResponse['body']['type']);
$this->assertEquals('available', $booleanResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $booleanResponse['body']['status']);
$this->assertEquals($boolean['body']['required'], $booleanResponse['body']['required']);
$this->assertEquals($boolean['body']['array'], $booleanResponse['body']['array']);
$this->assertEquals($boolean['body']['default'], $booleanResponse['body']['default']);
@@ -863,7 +864,7 @@ trait DatabasesBase
$this->assertEquals(200, $datetimeResponse['headers']['status-code']);
$this->assertEquals($datetime['body']['key'], $datetimeResponse['body']['key']);
$this->assertEquals($datetime['body']['type'], $datetimeResponse['body']['type']);
$this->assertEquals('available', $datetimeResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $datetimeResponse['body']['status']);
$this->assertEquals($datetime['body']['required'], $datetimeResponse['body']['required']);
$this->assertEquals($datetime['body']['array'], $datetimeResponse['body']['array']);
$this->assertEquals($datetime['body']['default'], $datetimeResponse['body']['default']);
@@ -871,7 +872,7 @@ trait DatabasesBase
$this->assertEquals(200, $relationshipResponse['headers']['status-code']);
$this->assertEquals($relationship['body']['key'], $relationshipResponse['body']['key']);
$this->assertEquals($relationship['body']['type'], $relationshipResponse['body']['type']);
$this->assertEquals('available', $relationshipResponse['body']['status']);
$this->assertEquals(Status::AVAILABLE, $relationshipResponse['body']['status']);
$this->assertEquals($relationship['body']['required'], $relationshipResponse['body']['required']);
$this->assertEquals($relationship['body']['array'], $relationshipResponse['body']['array']);
$this->assertEquals($relationship['body']['relatedCollection'], $relationshipResponse['body']['relatedCollection']);
@@ -1343,7 +1344,7 @@ trait DatabasesBase
$this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']);
$this->assertEquals($releaseWithDate2['body']['key'], $movies['body']['indexes'][3]['key']);
foreach ($movies['body']['indexes'] as $index) {
$this->assertEquals('available', $index['status']);
$this->assertEquals(Status::AVAILABLE, $index['status']);
}
return $data;
@@ -3785,7 +3786,7 @@ trait DatabasesBase
$this->assertEquals(202, $relation['headers']['status-code']);
$this->assertEquals('library', $relation['body']['key']);
$this->assertEquals('relationship', $relation['body']['type']);
$this->assertEquals('processing', $relation['body']['status']);
$this->assertEquals(Status::CREATING, $relation['body']['status']);
$attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $person['body']['$id'] . '/attributes', array_merge([
'content-type' => 'application/json',
@@ -3809,7 +3810,7 @@ trait DatabasesBase
]));
$this->assertEquals(200, $attribute['headers']['status-code']);
$this->assertEquals('available', $attribute['body']['status']);
$this->assertEquals(Status::AVAILABLE, $attribute['body']['status']);
$this->assertEquals('library', $attribute['body']['key']);
$this->assertEquals('relationship', $attribute['body']['type']);
$this->assertEquals(false, $attribute['body']['required']);
@@ -3993,7 +3994,7 @@ trait DatabasesBase
]));
$this->assertEquals(200, $attribute['headers']['status-code']);
$this->assertEquals('available', $attribute['body']['status']);
$this->assertEquals(Status::AVAILABLE, $attribute['body']['status']);
$this->assertEquals('libraries', $attribute['body']['key']);
$this->assertEquals('relationship', $attribute['body']['type']);
$this->assertEquals(false, $attribute['body']['required']);
@@ -4078,7 +4079,7 @@ trait DatabasesBase
]));
$this->assertEquals(200, $attribute['headers']['status-code']);
$this->assertEquals('available', $attribute['body']['status']);
$this->assertEquals(Status::AVAILABLE, $attribute['body']['status']);
$this->assertEquals('libraries', $attribute['body']['key']);
$this->assertEquals('relationship', $attribute['body']['type']);
$this->assertEquals(false, $attribute['body']['required']);
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Databases;
use Appwrite\Database\Status;
use Appwrite\Extend\Exception as AppwriteException;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
@@ -1432,7 +1433,7 @@ class DatabasesCustomServerTest extends Scope
$this->assertCount(0, $collection['body']['indexes']);
foreach ($collection['body']['attributes'] as $attribute) {
$this->assertEquals('available', $attribute['status'], 'attribute: ' . $attribute['key']);
$this->assertEquals(Status::AVAILABLE, $attribute['status'], 'attribute: ' . $attribute['key']);
}
// Test indexLimit = 64
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Functions;
use Appwrite\Functions\Status;
use Tests\E2E\Client;
use Utopia\CLI\Console;
@@ -26,7 +27,7 @@ trait FunctionsBase
if (
$deployment['headers']['status-code'] >= 400
|| \in_array($deployment['body']['status'], ['ready', 'failed'])
|| \in_array($deployment['body']['status'], [Status::READY, Status::FAILED])
) {
break;
}
@@ -36,7 +37,7 @@ trait FunctionsBase
if($checkForSuccess) {
$this->assertEquals(200, $deployment['headers']['status-code']);
$this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body']));
$this->assertEquals(Status::READY, $deployment['body']['status'], \json_encode($deployment['body']));
}
}
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Functions;
use Appwrite\Functions\Status;
use Appwrite\Tests\Retry;
use CURLFile;
use Tests\E2E\Client;
@@ -162,7 +163,7 @@ class FunctionsCustomClientTest extends Scope
$this->assertCount(2, $executions['body']['executions']);
$this->assertIsArray($executions['body']['executions']);
$this->assertEquals($executions['body']['executions'][1]['trigger'], 'schedule');
$this->assertEquals($executions['body']['executions'][1]['status'], 'completed');
$this->assertEquals($executions['body']['executions'][1]['status'], Status::SUCCESSFUL);
$this->assertEquals($executions['body']['executions'][1]['responseStatusCode'], 200);
$this->assertEquals($executions['body']['executions'][1]['responseBody'], '');
$this->assertEquals($executions['body']['executions'][1]['logs'], '');
@@ -252,7 +253,7 @@ class FunctionsCustomClientTest extends Scope
]);
$this->assertEquals(202, $execution['headers']['status-code']);
$this->assertEquals('scheduled', $execution['body']['status']);
$this->assertEquals(Status::SCHEDULED, $execution['body']['status']);
$this->assertEquals($futureTimeIso, $execution['body']['scheduledAt']);
$executionId = $execution['body']['$id'];
@@ -280,7 +281,7 @@ class FunctionsCustomClientTest extends Scope
$this->assertEquals(200, $execution['headers']['status-code']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals('/custom', $execution['body']['requestPath']);
$this->assertEquals('GET', $execution['body']['requestMethod']);
$this->assertGreaterThan(0, $execution['body']['duration']);
@@ -405,7 +406,7 @@ class FunctionsCustomClientTest extends Scope
$this->assertEquals(201, $execution['headers']['status-code']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertGreaterThan(0, $execution['body']['duration']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals($functionId, $output['APPWRITE_FUNCTION_ID']);
$this->assertEquals('Test', $output['APPWRITE_FUNCTION_NAME']);
$this->assertEquals($deploymentId, $output['APPWRITE_FUNCTION_DEPLOYMENT']);
@@ -570,8 +571,8 @@ class FunctionsCustomClientTest extends Scope
$this->assertEquals(200, $base['headers']['status-code']);
$this->assertCount(3, $base['body']['executions']);
$this->assertEquals('completed', $base['body']['executions'][0]['status']);
$this->assertEquals('completed', $base['body']['executions'][1]['status']);
$this->assertEquals(Status::SUCCESSFUL, $base['body']['executions'][0]['status']);
$this->assertEquals(Status::SUCCESSFUL, $base['body']['executions'][1]['status']);
$executions = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions', [
'content-type' => 'application/json',
@@ -605,7 +606,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-key' => $apikey,
], [
'queries' => [
Query::equal('status', ['completed'])->toString(),
Query::equal('status', [Status::SUCCESSFUL])->toString(),
],
]);
@@ -618,7 +619,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-key' => $apikey,
], [
'queries' => [
Query::equal('status', ['failed'])->toString(),
Query::equal('status', [Status::FAILED])->toString(),
],
]);
@@ -754,7 +755,7 @@ class FunctionsCustomClientTest extends Scope
$output = json_decode($execution['body']['responseBody'], true);
$this->assertEquals(201, $execution['headers']['status-code']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertEquals($functionId, $output['APPWRITE_FUNCTION_ID']);
$this->assertEquals('Test', $output['APPWRITE_FUNCTION_NAME']);
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Functions;
use Appwrite\Functions\Status;
use Appwrite\Tests\Retry;
use CURLFile;
use Tests\E2E\Client;
@@ -505,7 +506,7 @@ class FunctionsCustomServerTest extends Scope
if (
$deployment['headers']['status-code'] >= 400
|| $deployment['body']['status'] === 'building'
|| $deployment['body']['status'] === Status::BUILDING
) {
break;
}
@@ -788,7 +789,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertNotEmpty($execution['body']['functionId']);
$this->assertEquals(true, (new DatetimeValidator())->isValid($execution['body']['$createdAt']));
$this->assertEquals($data['functionId'], $execution['body']['functionId']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertStringContainsString($execution['body']['functionId'], $execution['body']['responseBody']);
$this->assertStringContainsString($data['deploymentId'], $execution['body']['responseBody']);
@@ -910,7 +911,7 @@ class FunctionsCustomServerTest extends Scope
]);
$this->assertEquals(201, $execution['headers']['status-code']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertStringContainsString('Test1', $execution['body']['responseBody']);
$this->assertStringContainsString('http', $execution['body']['responseBody']);
@@ -1156,7 +1157,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertCount(1, $executions['body']['executions']);
$this->assertEquals($executions['body']['executions'][0]['$id'], $executionId);
$this->assertEquals($executions['body']['executions'][0]['trigger'], 'http');
$this->assertEquals($executions['body']['executions'][0]['status'], 'failed');
$this->assertEquals($executions['body']['executions'][0]['status'], Status::FAILED);
$this->assertEquals($executions['body']['executions'][0]['responseStatusCode'], 500);
$this->assertGreaterThan(2, $executions['body']['executions'][0]['duration']);
$this->assertLessThan(20, $executions['body']['executions'][0]['duration']);
@@ -1276,7 +1277,7 @@ class FunctionsCustomServerTest extends Scope
$output = json_decode($execution['body']['responseBody'], true);
$this->assertEquals(201, $execution['headers']['status-code']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertEquals($functionId, $output['APPWRITE_FUNCTION_ID']);
$this->assertEquals('Test ' . $name, $output['APPWRITE_FUNCTION_NAME']);
@@ -1384,7 +1385,7 @@ class FunctionsCustomServerTest extends Scope
$output = json_decode($execution['body']['responseBody'], true);
$this->assertEquals(201, $execution['headers']['status-code']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertEquals(true, $output['v2Woks']);
@@ -1492,7 +1493,7 @@ class FunctionsCustomServerTest extends Scope
$execution = $executions['body']['executions'][0];
$this->assertEquals(200, $executions['headers']['status-code']);
$this->assertEquals('completed', $execution['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['status']);
$this->assertEquals(204, $execution['responseStatusCode']);
$this->assertStringContainsString($userId, $execution['logs']);
$this->assertStringContainsString('Event User', $execution['logs']);
@@ -1571,7 +1572,7 @@ class FunctionsCustomServerTest extends Scope
]);
$this->assertEquals(201, $execution['headers']['status-code']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertNotEmpty($execution['body']['responseBody']);
$this->assertGreaterThan(0, $execution['body']['duration']);
@@ -1644,7 +1645,7 @@ class FunctionsCustomServerTest extends Scope
]);
$this->assertEquals(201, $execution['headers']['status-code']);
$this->assertEquals('completed', $execution['body']['status']);
$this->assertEquals(Status::SUCCESSFUL, $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertEquals($cookie, $execution['body']['responseBody']);
$this->assertGreaterThan(0, $execution['body']['duration']);
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\GraphQL;
use Appwrite\Functions\Status;
use CURLFile;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
@@ -137,8 +138,8 @@ class FunctionsClientTest extends Scope
$deployment = $deployment['body']['data']['functionsGetDeployment'];
if (
$deployment['status'] === 'ready'
|| $deployment['status'] === 'failed'
$deployment['status'] === Status::READY
|| $deployment['status'] === Status::FAILED
) {
break;
}
@@ -146,7 +147,7 @@ class FunctionsClientTest extends Scope
\sleep(1);
}
$this->assertEquals('ready', $deployment['status']);
$this->assertEquals(Status::READY, $deployment['status']);
return $deployment;
}
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\GraphQL;
use Appwrite\Functions\Status;
use CURLFile;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
@@ -134,8 +135,8 @@ class FunctionsServerTest extends Scope
$deployment = $deployment['body']['data']['functionsGetDeployment'];
if (
$deployment['status'] === 'ready'
|| $deployment['status'] === 'failed'
$deployment['status'] === Status::READY
|| $deployment['status'] === Status::FAILED
) {
break;
}
@@ -143,7 +144,7 @@ class FunctionsServerTest extends Scope
\sleep(1);
}
$this->assertEquals('ready', $deployment['status']);
$this->assertEquals(Status::READY, $deployment['status']);
return $deployment;
}
+7 -6
View File
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\GraphQL;
use Appwrite\Messaging\Status;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
@@ -706,7 +707,7 @@ class MessagingTest extends Scope
'query' => $query,
'variables' => [
'messageId' => ID::unique(),
'status' => 'draft',
'status' => Status::DRAFT,
'topics' => [$email['topics'][0]],
'subject' => 'Khali beats Undertaker',
'content' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
@@ -725,7 +726,7 @@ class MessagingTest extends Scope
'query' => $query,
'variables' => [
'messageId' => $email['body']['data']['messagingCreateEmail']['_id'],
'status' => 'processing',
'status' => Status::SENDING,
],
];
$email = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
@@ -910,7 +911,7 @@ class MessagingTest extends Scope
'query' => $query,
'variables' => [
'messageId' => ID::unique(),
'status' => 'draft',
'status' => Status::DRAFT,
'topics' => [$sms['topics'][0]],
'content' => '345463',
],
@@ -928,7 +929,7 @@ class MessagingTest extends Scope
'query' => $query,
'variables' => [
'messageId' => $sms['body']['data']['messagingCreateSMS']['_id'],
'status' => 'processing',
'status' => Status::SENDING,
],
];
$sms = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
@@ -1116,7 +1117,7 @@ class MessagingTest extends Scope
'query' => $query,
'variables' => [
'messageId' => ID::unique(),
'status' => 'draft',
'status' => Status::DRAFT,
'topics' => [$push['topics'][0]],
'title' => 'Push Notification Title',
'body' => 'Push Notifiaction Body',
@@ -1135,7 +1136,7 @@ class MessagingTest extends Scope
'query' => $query,
'variables' => [
'messageId' => $push['body']['data']['messagingCreatePushNotification']['_id'],
'status' => 'processing',
'status' => Status::SENDING,
],
];
$push = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Messaging;
use Appwrite\Messaging\Status;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
@@ -334,7 +335,7 @@ class MessagingConsoleClientTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'messageId' => ID::unique(),
'status' => 'draft',
'status' => Status::DRAFT,
'topics' => [ID::unique()],
'subject' => 'Khali beats Undertaker',
'content' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Realtime;
use Appwrite\Database\Status;
use CURLFile;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
@@ -209,7 +210,7 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("databases.{$databaseId}", $response['data']['events']);
$this->assertContains("databases.*", $response['data']['events']);
$this->assertNotEmpty($response['data']['payload']);
$this->assertEquals('processing', $response['data']['payload']['status']);
$this->assertEquals(Status::CREATING, $response['data']['payload']['status']);
$response = json_decode($client->receive(), true);
@@ -229,7 +230,7 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("databases.{$databaseId}", $response['data']['events']);
$this->assertContains("databases.*", $response['data']['events']);
$this->assertNotEmpty($response['data']['payload']);
$this->assertEquals('available', $response['data']['payload']['status']);
$this->assertEquals(Status::AVAILABLE, $response['data']['payload']['status']);
$client->close();
@@ -294,7 +295,7 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("databases.{$databaseId}.collections.*.indexes.*", $response['data']['events']);
$this->assertContains("databases.{$databaseId}.collections.*", $response['data']['events']);
$this->assertNotEmpty($response['data']['payload']);
$this->assertEquals('processing', $response['data']['payload']['status']);
$this->assertEquals(Status::CREATING, $response['data']['payload']['status']);
$response = json_decode($client->receive(), true);
@@ -312,7 +313,7 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("databases.{$databaseId}.collections.*.indexes.*", $response['data']['events']);
$this->assertContains("databases.{$databaseId}.collections.*", $response['data']['events']);
$this->assertNotEmpty($response['data']['payload']);
$this->assertEquals('available', $response['data']['payload']['status']);
$this->assertEquals(Status::AVAILABLE, $response['data']['payload']['status']);
$client->close();
@@ -2,6 +2,7 @@
namespace Tests\E2E\Services\Realtime;
use Appwrite\Functions\Status;
use CURLFile;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
@@ -1303,7 +1304,7 @@ class RealtimeCustomClientTest extends Scope
if (
$deployment['headers']['status-code'] >= 400
|| \in_array($deployment['body']['status'], ['ready', 'failed'])
|| \in_array($deployment['body']['status'], [Status::READY, Status::FAILED])
) {
break;
}
@@ -57,8 +57,10 @@ class V18Test extends TestCase
'remove scheduledAt' => [
[
'scheduledAt' => '2024-07-13T09:00:00.000Z',
'status' => 'queued'
],
[
'status' => 'waiting'
]
]
];