Merge branch '1.7.x' of github.com:appwrite/appwrite into chore-fix-tasks

This commit is contained in:
Christy Jacob 2025-06-25 21:33:30 +04:00
commit 5173e03636
100 changed files with 210 additions and 124 deletions

View file

@ -65,7 +65,7 @@ jobs:
sudo apt update
sudo apt install oha
- name: Benchmark PR
run: 'oha -z 180s http://localhost/v1/health/version --output-format json > benchmark.json'
run: 'oha -z 180s http://localhost/v1/health/version --output_format json > benchmark.json'
- name: Cleaning
run: docker compose down -v
- name: Installing latest version
@ -78,7 +78,7 @@ jobs:
docker compose up -d
sleep 10
- name: Benchmark Latest
run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json
run: oha -z 180s http://localhost/v1/health/version --output_format json > benchmark-latest.json
- name: Prepare comment
run: |
echo '## :sparkles: Benchmark results' > benchmark.txt

View file

@ -56,7 +56,7 @@ Config::setParam('domainVerification', false);
Config::setParam('cookieDomain', 'localhost');
Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE);
function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey)
function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey)
{
$host = $request->getHostname() ?? '';
if (!empty($previewHostname)) {
@ -118,6 +118,11 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw
$project->setAttribute('accessedAt', DateTime::now());
Authorization::skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $project));
}
/**
* Set projectId to update the Error hook logger, since x-appwrite-project is not available when executing custom domain function
*/
$log->addTag('projectId', $project->getId());
}
if (array_key_exists('proxy', $project->getAttribute('services', []))) {
@ -787,6 +792,7 @@ App::init()
->inject('swooleRequest')
->inject('request')
->inject('response')
->inject('log')
->inject('console')
->inject('project')
->inject('dbForPlatform')
@ -804,7 +810,7 @@ App::init()
->inject('previewHostname')
->inject('devKey')
->inject('apiKey')
->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Document $console, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, array $clients, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Certificate $queueForCertificates, Func $queueForFunctions, Executor $executor, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey) {
->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $console, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, array $clients, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Certificate $queueForCertificates, Func $queueForFunctions, Executor $executor, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey) {
/*
* Appwrite Router
*/
@ -812,7 +818,7 @@ App::init()
$mainDomain = System::getEnv('_APP_DOMAIN', '');
// Only run Router when external domain
if ($host !== $mainDomain || !empty($previewHostname)) {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
$utopia->getRoute()?->label('router', true);
}
}
@ -1094,7 +1100,7 @@ App::options()
$mainDomain = System::getEnv('_APP_DOMAIN', '');
// Only run Router when external domain
if ($host !== $mainDomain || !empty($previewHostname)) {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
$utopia->getRoute()?->label('router', true);
}
}
@ -1267,7 +1273,12 @@ App::error()
$log->addTag('url', $request->getURI());
$log->addTag('verboseType', get_class($error));
$log->addTag('code', $error->getCode());
$log->addTag('projectId', $project->getId());
$tags = $log->getTags();
if (!isset($tags['projectId'])) {
$log->addTag('projectId', $project->getId());
}
$log->addTag('hostname', $request->getHostname());
$log->addTag('locale', (string)$request->getParam('locale', $request->getHeader('x-appwrite-locale', '')));
@ -1403,7 +1414,7 @@ App::get('/robots.txt')
$template = new View(__DIR__ . '/../views/general/robots.phtml');
$response->text($template->render(false));
} else {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
$utopia->getRoute()?->label('router', true);
}
}
@ -1435,7 +1446,7 @@ App::get('/humans.txt')
$template = new View(__DIR__ . '/../views/general/humans.phtml');
$response->text($template->render(false));
} else {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) {
$utopia->getRoute()?->label('router', true);
}
}

12
composer.lock generated
View file

@ -4807,16 +4807,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.41.8",
"version": "0.41.6",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "93ffb24b25b376ca4423e3a5caf6f916673af4b2"
"reference": "bfcebb968c527e17fdf18d40b8986c83d9c18c93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/93ffb24b25b376ca4423e3a5caf6f916673af4b2",
"reference": "93ffb24b25b376ca4423e3a5caf6f916673af4b2",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/bfcebb968c527e17fdf18d40b8986c83d9c18c93",
"reference": "bfcebb968c527e17fdf18d40b8986c83d9c18c93",
"shasum": ""
},
"require": {
@ -4852,9 +4852,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.41.8"
"source": "https://github.com/appwrite/sdk-generator/tree/0.41.6"
},
"time": "2025-06-18T13:20:45+00:00"
"time": "2025-06-12T03:27:26+00:00"
},
{
"name": "doctrine/annotations",

View file

@ -6,6 +6,7 @@ use Appwrite\Event\Build;
use Appwrite\Extend\Exception;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Exception\Duplicate;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
@ -226,6 +227,73 @@ class Base extends Action
]))
);
if (!empty($commitDetails['commitHash'])) {
$domain = "commit-" . substr($commitDetails['commitHash'], 0, 16) . ".{$sitesDomain}";
$ruleId = md5($domain);
try {
Authorization::skip(
fn () => $dbForPlatform->createDocument('rules', new Document([
'$id' => $ruleId,
'projectId' => $project->getId(),
'projectInternalId' => $project->getInternalId(),
'domain' => $domain,
'type' => 'deployment',
'trigger' => 'deployment',
'deploymentId' => $deployment->getId(),
'deploymentInternalId' => $deployment->getInternalId(),
'deploymentResourceType' => 'site',
'deploymentResourceId' => $site->getId(),
'deploymentResourceInternalId' => $site->getInternalId(),
'deploymentVcsProviderBranch' => $providerBranch,
'status' => 'verified',
'certificateId' => '',
'search' => implode(' ', [$ruleId, $domain]),
'owner' => 'Appwrite',
'region' => $project->getAttribute('region')
]))
);
} catch (Duplicate $err) {
// Ignore, rule already exists; will be updated by builds worker
}
}
// VCS branch preview
if (!empty($providerBranch)) {
$branchPrefix = substr($providerBranch, 0, 16);
if (strlen($providerBranch) > 16) {
$remainingChars = substr($providerBranch, 16);
$branchPrefix .= '-' . substr(hash('sha256', $remainingChars), 0, 7);
}
$resourceProjectHash = substr(hash('sha256', $site->getId() . $project->getId()), 0, 7);
$domain = "branch-{$branchPrefix}-{$resourceProjectHash}.{$sitesDomain}";
$ruleId = md5($domain);
try {
Authorization::skip(
fn () => $dbForPlatform->createDocument('rules', new Document([
'$id' => $ruleId,
'projectId' => $project->getId(),
'projectInternalId' => $project->getInternalId(),
'domain' => $domain,
'type' => 'deployment',
'trigger' => 'deployment',
'deploymentId' => $deployment->getId(),
'deploymentInternalId' => $deployment->getInternalId(),
'deploymentResourceType' => 'site',
'deploymentResourceId' => $site->getId(),
'deploymentResourceInternalId' => $site->getInternalId(),
'deploymentVcsProviderBranch' => $providerBranch,
'status' => 'verified',
'certificateId' => '',
'search' => implode(' ', [$ruleId, $domain]),
'owner' => 'Appwrite',
'region' => $project->getAttribute('region')
]))
);
} catch (Duplicate $err) {
// Ignore, rule already exists; will be updated by builds worker
}
}
$queueForBuilds
->setType(BUILD_TYPE_DEPLOYMENT)
->setResource($site)

View file

@ -57,7 +57,7 @@ class Get extends Action
->param('type', '', new WhiteList(['rules']), 'Resource type.')
->inject('response')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -87,7 +87,7 @@ class Create extends Action
->inject('deviceForLocal')
->inject('queueForBuilds')
->inject('plan')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -62,7 +62,7 @@ class Delete extends Action
->inject('queueForDeletes')
->inject('queueForEvents')
->inject('deviceForFunctions')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -61,7 +61,7 @@ class Get extends Action
->inject('dbForProject')
->inject('deviceForFunctions')
->inject('deviceForBuilds')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -62,7 +62,7 @@ class Create extends Action
->inject('queueForEvents')
->inject('queueForBuilds')
->inject('deviceForFunctions')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -49,7 +49,7 @@ class Get extends Action
->param('deploymentId', '', new UID(), 'Deployment ID.')
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -59,7 +59,7 @@ class Update extends Action
->inject('project')
->inject('queueForEvents')
->inject('executor')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -75,7 +75,7 @@ class Create extends Base
->inject('project')
->inject('queueForBuilds')
->inject('gitHub')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -72,7 +72,7 @@ class Create extends Base
->inject('queueForEvents')
->inject('queueForBuilds')
->inject('gitHub')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -57,7 +57,7 @@ class XList extends Action
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -94,7 +94,7 @@ class Create extends Base
->inject('queueForFunctions')
->inject('geodb')
->inject('executor')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -62,7 +62,7 @@ class Delete extends Base
->inject('dbForProject')
->inject('dbForPlatform')
->inject('queueForEvents')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -52,7 +52,7 @@ class Get extends Base
->param('executionId', '', new UID(), 'Execution ID.')
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -58,7 +58,7 @@ class XList extends Base
->param('queries', [], new Executions(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Executions::ALLOWED_ATTRIBUTES), true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -114,7 +114,7 @@ class Create extends Base
->inject('dbForPlatform')
->inject('request')
->inject('gitHub')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -61,7 +61,7 @@ class Delete extends Base
->inject('queueForDeletes')
->inject('queueForEvents')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -62,7 +62,7 @@ class Update extends Base
->inject('dbForProject')
->inject('queueForEvents')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -49,7 +49,7 @@ class Get extends Base
->param('functionId', '', new UID(), 'Function ID.')
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -104,7 +104,7 @@ class Update extends Base
->inject('dbForPlatform')
->inject('gitHub')
->inject('executor')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -56,7 +56,7 @@ class XList extends Base
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -47,7 +47,7 @@ class XList extends Base
]
))
->inject('response')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(Response $response)

View file

@ -48,7 +48,7 @@ class XList extends Base
))
->inject('response')
->inject('plan')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(Response $response, array $plan)

View file

@ -49,7 +49,7 @@ class Get extends Base
))
->param('templateId', '', new Text(128), 'Template ID.')
->inject('response')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $templateId, Response $response)

View file

@ -53,7 +53,7 @@ class XList extends Base
->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true)
->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true)
->inject('response')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(array $runtimes, array $usecases, int $limit, int $offset, Response $response)

View file

@ -55,7 +55,7 @@ class Get extends Base
->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $functionId, string $range, Response $response, Database $dbForProject)

View file

@ -52,7 +52,7 @@ class XList extends Base
->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $range, Response $response, Database $dbForProject)

View file

@ -65,7 +65,7 @@ class Create extends Base
->inject('dbForProject')
->inject('dbForPlatform')
->inject('project')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -57,7 +57,7 @@ class Delete extends Base
->inject('response')
->inject('dbForProject')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -53,7 +53,7 @@ class Get extends Base
->param('variableId', '', new UID(), 'Variable unique ID.', false)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $functionId, string $variableId, Response $response, Database $dbForProject)

View file

@ -61,7 +61,7 @@ class Update extends Base
->inject('response')
->inject('dbForProject')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -53,7 +53,7 @@ class XList extends Base
->param('functionId', '', new UID(), 'Function unique ID.', false)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $functionId, Response $response, Database $dbForProject)

View file

@ -75,7 +75,7 @@ class Builds extends Action
->inject('log')
->inject('executor')
->inject('plan')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**
@ -209,6 +209,9 @@ class Builds extends Action
Executor $executor,
array $plan
): void {
$startTime = DateTime::now();
$durationStart = \microtime(true);
$resourceKey = match ($resource->getCollection()) {
'functions' => 'functionId',
'sites' => 'siteId',
@ -260,9 +263,6 @@ class Builds extends Action
->setParam($resourceKey, $resource->getId())
->setParam('deploymentId', $deployment->getId());
$startTime = DateTime::now();
$durationStart = \microtime(true);
if ($deployment->getAttribute('status') === 'canceled') {
Console::info('Build has been canceled');
return;
@ -810,9 +810,6 @@ class Builds extends Action
throw $err;
}
$endTime = DateTime::now();
$durationEnd = \microtime(true);
$buildSizeLimit = (int)System::getEnv('_APP_COMPUTE_BUILD_SIZE_LIMIT', '2000000000');
if (isset($plan['buildSize'])) {
$buildSizeLimit = $plan['buildSize'] * 1000 * 1000;
@ -821,10 +818,6 @@ class Builds extends Action
throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / (1000 * 1000), 2) . ' MBs.');
}
/** Update the build document */
$deployment->setAttribute('buildStartedAt', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime']))));
$deployment->setAttribute('buildEndedAt', $endTime);
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
$deployment->setAttribute('buildPath', $response['path']);
$deployment->setAttribute('buildSize', $response['size']);
$deployment->setAttribute('totalSize', $deployment->getAttribute('buildSize', 0) + $deployment->getAttribute('sourceSize', 0));
@ -1191,6 +1184,15 @@ class Builds extends Action
}
}
$endTime = DateTime::now();
$durationEnd = \microtime(true);
$deployment->setAttribute('buildEndedAt', $endTime);
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
$queueForRealtime
->setPayload($deployment->getArrayCopy())
->trigger();
if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') {
Console::info('Build has been canceled');
return;
@ -1234,7 +1236,7 @@ class Builds extends Action
// Combine with previous logs if deployment got past build process
$previousLogs = '';
if (!empty($deployment->getAttribute('buildEndedAt', ''))) {
if (!is_null($deployment->getAttribute('buildSize', null))) {
$previousLogs = $deployment->getAttribute('buildLogs', '');
if (!empty($previousLogs)) {
$message = $previousLogs . "\n" . $message;

View file

@ -57,7 +57,7 @@ class Create extends Action
->inject('user')
->inject('response')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $projectId, string $name, ?string $expire, Document $user, Response $response, Database $dbForPlatform)

View file

@ -49,7 +49,7 @@ class Delete extends Action
->param('keyId', '', new UID(), 'Key unique ID.')
->inject('response')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform)

View file

@ -49,7 +49,7 @@ class Get extends Action
->param('keyId', '', new UID(), 'Key unique ID.')
->inject('response')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform)

View file

@ -52,7 +52,7 @@ class Update extends Action
->param('expire', null, new DatetimeValidator(), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.')
->inject('response')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $projectId, string $keyId, string $name, ?string $expire, Response $response, Database $dbForPlatform)
{

View file

@ -53,7 +53,7 @@ class XList extends Action
->param('queries', [], new DevKeys(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', DevKeys::ALLOWED_ATTRIBUTES), true)
->inject('response')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $projectId, ?array $queries, Response $response, Database $dbForPlatform)

View file

@ -66,7 +66,7 @@ class Create extends Action
->inject('queueForCertificates')
->inject('queueForEvents')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $domain, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform)

View file

@ -71,7 +71,7 @@ class Create extends Action
->inject('queueForEvents')
->inject('dbForPlatform')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $domain, string $functionId, string $branch, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject)

View file

@ -74,7 +74,7 @@ class Create extends Action
->inject('queueForEvents')
->inject('dbForPlatform')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $domain, string $url, int $statusCode, string $resourceId, string $resourceType, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject)

View file

@ -71,7 +71,7 @@ class Create extends Action
->inject('queueForEvents')
->inject('dbForPlatform')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $domain, string $siteId, string $branch, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject)

View file

@ -86,7 +86,7 @@ class Create extends Action
->inject('deviceForLocal')
->inject('queueForBuilds')
->inject('plan')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -62,7 +62,7 @@ class Delete extends Action
->inject('queueForDeletes')
->inject('queueForEvents')
->inject('deviceForSites')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -60,7 +60,7 @@ class Get extends Action
->inject('dbForProject')
->inject('deviceForSites')
->inject('deviceForBuilds')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -65,7 +65,7 @@ class Create extends Action
->inject('queueForEvents')
->inject('queueForBuilds')
->inject('deviceForSites')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -49,7 +49,7 @@ class Get extends Action
->param('deploymentId', '', new UID(), 'Deployment ID.')
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, string $deploymentId, Response $response, Database $dbForProject)

View file

@ -57,7 +57,7 @@ class Update extends Action
->inject('project')
->inject('queueForEvents')
->inject('executor')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -77,7 +77,7 @@ class Create extends Base
->inject('queueForEvents')
->inject('queueForBuilds')
->inject('gitHub')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -72,7 +72,7 @@ class Create extends Base
->inject('queueForEvents')
->inject('queueForBuilds')
->inject('gitHub')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -57,7 +57,7 @@ class XList extends Action
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, array $queries, string $search, Response $response, Database $dbForProject)

View file

@ -46,7 +46,7 @@ class XList extends Base
]
))
->inject('response')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(Response $response)

View file

@ -55,7 +55,7 @@ class Delete extends Base
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, string $logId, Response $response, Database $dbForProject, Event $queueForEvents)

View file

@ -50,7 +50,7 @@ class Get extends Base
->param('logId', '', new UID(), 'Log ID.')
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, string $logId, Response $response, Database $dbForProject)

View file

@ -57,7 +57,7 @@ class XList extends Base
->param('queries', [], new Logs(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Executions::ALLOWED_ATTRIBUTES), true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, array $queries, Response $response, Database $dbForProject)

View file

@ -89,7 +89,7 @@ class Create extends Base
->inject('project')
->inject('queueForEvents')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -58,7 +58,7 @@ class Delete extends Base
->inject('dbForProject')
->inject('queueForDeletes')
->inject('queueForEvents')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -60,7 +60,7 @@ class Update extends Base
->inject('dbForProject')
->inject('queueForEvents')
->inject('dbForPlatform')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -49,7 +49,7 @@ class Get extends Base
->param('siteId', '', new UID(), 'Site ID.')
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, Response $response, Database $dbForProject)

View file

@ -97,7 +97,7 @@ class Update extends Base
->inject('dbForPlatform')
->inject('gitHub')
->inject('executor')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -56,7 +56,7 @@ class XList extends Base
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(array $queries, string $search, Response $response, Database $dbForProject)

View file

@ -48,7 +48,7 @@ class XList extends Base
))
->inject('response')
->inject('plan')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(Response $response, array $plan)

View file

@ -49,7 +49,7 @@ class Get extends Base
))
->param('templateId', '', new Text(128), 'Template ID.')
->inject('response')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $templateId, Response $response)

View file

@ -53,7 +53,7 @@ class XList extends Base
->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true)
->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true)
->inject('response')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -55,7 +55,7 @@ class Get extends Base
->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -52,7 +52,7 @@ class XList extends Base
->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $range, Response $response, Database $dbForProject)

View file

@ -62,7 +62,7 @@ class Create extends Base
->inject('response')
->inject('dbForProject')
->inject('project')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, string $key, string $value, bool $secret, Response $response, Database $dbForProject, Document $project)

View file

@ -54,7 +54,7 @@ class Delete extends Base
->param('variableId', '', new UID(), 'Variable unique ID.', false)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, string $variableId, Response $response, Database $dbForProject)

View file

@ -53,7 +53,7 @@ class Get extends Base
->param('variableId', '', new UID(), 'Variable unique ID.', false)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $siteId, string $variableId, Response $response, Database $dbForProject)

View file

@ -58,7 +58,7 @@ class Update extends Base
->param('secret', null, new Boolean(), 'Secret variables can be updated or deleted, but only sites can read them during build and runtime.', true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -53,7 +53,7 @@ class XList extends Base
->param('siteId', '', new UID(), 'Site unique ID.', false)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -65,7 +65,7 @@ class Create extends Action
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $bucketId, string $fileId, ?string $expire, Response $response, Database $dbForProject, Event $queueForEvents): void

View file

@ -55,7 +55,7 @@ class XList extends Action
->param('queries', [], new FileTokens(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', FileTokens::ALLOWED_ATTRIBUTES), true)
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $bucketId, string $fileId, array $queries, Response $response, Database $dbForProject)

View file

@ -58,7 +58,7 @@ class Delete extends Action
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $tokenId, Response $response, Database $dbForProject, Event $queueForEvents)

View file

@ -50,7 +50,7 @@ class Get extends Action
->param('tokenId', '', new UID(), 'Token ID.')
->inject('response')
->inject('dbForProject')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $tokenId, Response $response, Database $dbForProject)

View file

@ -61,7 +61,7 @@ class Update extends Action
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $tokenId, ?string $expire, Response $response, Database $dbForProject, Event $queueForEvents)

View file

@ -34,7 +34,7 @@ class Doctor extends Action
$this
->desc('Validate server health')
->inject('register')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(Registry $register): void

View file

@ -31,7 +31,7 @@ class Install extends Action
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void

View file

@ -29,7 +29,7 @@ class Maintenance extends Action
->inject('console')
->inject('queueForCertificates')
->inject('queueForDeletes')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes): void

View file

@ -24,7 +24,7 @@ class QueueRetry extends Action
->param('name', '', new Text(100), 'Queue name')
->param('limit', 0, new Wildcard(), 'jobs limit', true)
->inject('publisher')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**

View file

@ -46,7 +46,7 @@ class SDKs extends Action
->param('git', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we use git push?', optional: true)
->param('production', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we push to production?', optional: true)
->param('message', null, new Nullable(new Text(256)), 'Commit Message', optional: true)
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(?string $selectedPlatform, ?string $selectedSDK, ?string $version, ?string $git, ?string $production, ?string $message): void

View file

@ -24,7 +24,7 @@ class SSL extends Action
->param('domain', System::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true)
->param('skip-check', true, new Boolean(true), 'If DNS and renew check should be skipped. Defaults to true, and when true, all jobs will result in certificate generation attempt.', true)
->inject('queueForCertificates')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $domain, bool|string $skipCheck, Certificate $queueForCertificates): void

View file

@ -21,7 +21,7 @@ class Screenshot extends Action
$this
->desc('Create Site template screenshot')
->param('templateId', '', new Text(128), 'Template ID.')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $templateId): void

View file

@ -46,7 +46,7 @@ class StatsResources extends Action
->inject('dbForPlatform')
->inject('logError')
->inject('queueForStatsResources')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(Database $dbForPlatform, callable $logError, EventStatsResources $queue): void

View file

@ -23,7 +23,7 @@ class Upgrade extends Install
->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true)
->param('interactive', 'Y', new Text(1), 'Run an interactive session', true)
->param('no-start', false, new Boolean(true), 'Run an interactive session', true)
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void

View file

@ -18,7 +18,7 @@ class Vars extends Action
{
$this
->desc('List all the server environment variables')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(): void

View file

@ -45,7 +45,7 @@ class Audits extends Action
->inject('message')
->inject('getProjectDB')
->inject('project')
->callback([$this, 'action']);
->callback($this->action(...));
$this->lastTriggeredTime = time();
}

View file

@ -38,7 +38,7 @@ class Databases extends Action
->inject('dbForProject')
->inject('queueForRealtime')
->inject('log')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**

View file

@ -53,7 +53,7 @@ class Functions extends Action
->inject('log')
->inject('executor')
->inject('isResourceBlocked')
->callback([$this, 'action']);
->callback($this->action(...));
}
public function action(

View file

@ -29,7 +29,7 @@ class Mails extends Action
->inject('message')
->inject('register')
->inject('log')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**

View file

@ -72,7 +72,7 @@ class Messaging extends Action
->inject('dbForProject')
->inject('deviceForFiles')
->inject('queueForStatsUsage')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**

View file

@ -69,7 +69,7 @@ class Migrations extends Action
->inject('logError')
->inject('queueForRealtime')
->inject('deviceForImports')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**

View file

@ -49,7 +49,7 @@ class StatsResources extends Action
->inject('getLogsDB')
->inject('dbForPlatform')
->inject('logError')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**

View file

@ -119,7 +119,7 @@ class StatsUsage extends Action
->inject('getProjectDB')
->inject('getLogsDB')
->inject('register')
->callback([$this, 'action']);
->callback($this->action(...));
$this->lastTriggeredTime = time();
}

View file

@ -38,7 +38,7 @@ class Webhooks extends Action
->inject('queueForStatsUsage')
->inject('log')
->inject('plan')
->callback([$this, 'action']);
->callback($this->action(...));
}
/**

View file

@ -2421,7 +2421,7 @@ class AccountCustomClientTest extends Scope
$smsRequest = $this->assertLastRequest(function ($request) {
$this->assertArrayHasKey('data', $request);
$this->assertArrayHasKey('message', $request['data']);
$this->assertArrayHasKey('message', $request['data'], "Last request missing message: " . \json_encode($request));
});
/**

View file

@ -607,10 +607,8 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
$this->assertArrayHasKey('buildLogs', $response['data']['payload']);
if (!empty($response['data']['payload']['buildEndedAt'])) {
$this->assertNotEmpty($response['data']['payload']['buildEndedAt']);
if (!empty($response['data']['payload']['buildSize'])) {
$this->assertNotEmpty($response['data']['payload']['buildStartedAt']);
$this->assertNotEmpty($response['data']['payload']['buildDuration']);
$this->assertNotEmpty($response['data']['payload']['buildPath']);
$this->assertNotEmpty($response['data']['payload']['buildSize']);
$this->assertNotEmpty($response['data']['payload']['totalSize']);
@ -634,6 +632,13 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
$this->assertEquals("ready", $response['data']['payload']['status']);
$response = json_decode($client->receive(), true);
$this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']);
$this->assertContains('console', $response['data']['channels']);
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
$this->assertNotEmpty($response['data']['payload']['buildDuration']);
$this->assertNotEmpty($response['data']['payload']['buildEndedAt']);
$client->close();
}
}