Merge branches 'feat-database-indexing' and 'feat-database-indexing' of https://github.com/appwrite/appwrite into feat-database-indexing
This commit is contained in:
commit
8fba7a375e
|
@ -5,6 +5,14 @@
|
|||
- Grouped auth related attributes in project collection. Introduced new attribute `auths` and removed all attributes related to auth methods and `usersAuthLimit` as well, all these are grouped under `auths` attribute
|
||||
- Grouped oAuth related attributes in project collection. Introduced new attribute `providers` and removed all attributes related to OAuth2 providers. All OAuth2 attributes are grouped under `providers`
|
||||
- Project model changed, `userAuth<AuthMethod>` => `auth<AuthMethod>` example `userAuthEmailPassword` => `authEmailPassword`, also `userOauth2<Provider>...` => `provider<Provider>...` example `userOauth2GithubAppid` => `providerGithubAppid`
|
||||
|
||||
# Version 0.12.0
|
||||
|
||||
## Breaking Changes (Read before upgrading!)
|
||||
|
||||
- Multiple HealthAPI response models were changed to new (better) schema
|
||||
- Method `health.getAntiVirus()` has been renamed to `health.getAntivirus()`
|
||||
|
||||
# Version 0.11.0
|
||||
|
||||
## Features
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\App;
|
||||
use Utopia\Exception;
|
||||
use Utopia\Storage\Device\Local;
|
||||
use Utopia\Storage\Storage;
|
||||
use Appwrite\ClamAV\Network;
|
||||
use Appwrite\Event\Event;
|
||||
use Utopia\Database\Document;
|
||||
|
||||
App::get('/v1/health')
|
||||
->desc('Get HTTP')
|
||||
|
@ -15,22 +17,33 @@ App::get('/v1/health')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'get')
|
||||
->label('sdk.description', '/docs/references/health/get.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->json(['status' => 'OK']);
|
||||
$output = [
|
||||
'status' => 'pass',
|
||||
'ping' => 0
|
||||
];
|
||||
|
||||
$response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS);
|
||||
});
|
||||
|
||||
App::get('/v1/health/version')
|
||||
->desc('Get Version')
|
||||
->groups(['api', 'health'])
|
||||
->label('scope', 'public')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_VERSION)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->json(['version' => APP_VERSION_STABLE]);
|
||||
$response->dynamic(new Document([ 'version' => APP_VERSION_STABLE ]), Response::MODEL_HEALTH_VERSION);
|
||||
});
|
||||
|
||||
App::get('/v1/health/db')
|
||||
|
@ -41,11 +54,17 @@ App::get('/v1/health/db')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getDB')
|
||||
->label('sdk.description', '/docs/references/health/get-db.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
|
||||
->inject('response')
|
||||
->inject('utopia')
|
||||
->action(function ($response, $utopia) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\App $utopia */
|
||||
|
||||
$checkStart = \microtime(true);
|
||||
|
||||
try {
|
||||
$db = $utopia->getResource('db'); /* @var $db PDO */
|
||||
|
||||
|
@ -59,7 +78,12 @@ App::get('/v1/health/db')
|
|||
throw new Exception('Database is not available', 500);
|
||||
}
|
||||
|
||||
return $response->json(['status' => 'OK']);
|
||||
$output = [
|
||||
'status' => 'pass',
|
||||
'ping' => \round((\microtime(true) - $checkStart) / 1000)
|
||||
];
|
||||
|
||||
$response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS);
|
||||
});
|
||||
|
||||
App::get('/v1/health/cache')
|
||||
|
@ -70,19 +94,30 @@ App::get('/v1/health/cache')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getCache')
|
||||
->label('sdk.description', '/docs/references/health/get-cache.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
|
||||
->inject('response')
|
||||
->inject('utopia')
|
||||
->action(function ($response, $utopia) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\App $utopia */
|
||||
/** @var Redis */
|
||||
|
||||
$checkStart = \microtime(true);
|
||||
|
||||
$redis = $utopia->getResource('cache');
|
||||
|
||||
if ($redis->ping(true)) {
|
||||
return $response->json(['status' => 'OK']);
|
||||
} else {
|
||||
if (!$redis->ping(true)) {
|
||||
throw new Exception('Cache is not available', 500);
|
||||
}
|
||||
|
||||
$output = [
|
||||
'status' => 'pass',
|
||||
'ping' => \round((\microtime(true) - $checkStart) / 1000)
|
||||
];
|
||||
|
||||
$response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS);
|
||||
});
|
||||
|
||||
App::get('/v1/health/time')
|
||||
|
@ -93,6 +128,9 @@ App::get('/v1/health/time')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getTime')
|
||||
->label('sdk.description', '/docs/references/health/get-time.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_TIME)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
@ -131,7 +169,13 @@ App::get('/v1/health/time')
|
|||
throw new Exception('Server time gaps detected');
|
||||
}
|
||||
|
||||
$response->json(['remote' => $timestamp, 'local' => \time(), 'diff' => $diff]);
|
||||
$output = [
|
||||
'remoteTime' => $timestamp,
|
||||
'localTime' => \time(),
|
||||
'diff' => $diff
|
||||
];
|
||||
|
||||
$response->dynamic(new Document($output), Response::MODEL_HEALTH_TIME);
|
||||
});
|
||||
|
||||
App::get('/v1/health/queue/webhooks')
|
||||
|
@ -142,11 +186,14 @@ App::get('/v1/health/queue/webhooks')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getQueueWebhooks')
|
||||
->label('sdk.description', '/docs/references/health/get-queue-webhooks.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->json(['size' => Resque::size(Event::WEBHOOK_QUEUE_NAME)]);
|
||||
$response->dynamic(new Document([ 'size' => Resque::size(Event::WEBHOOK_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
|
||||
}, ['response']);
|
||||
|
||||
App::get('/v1/health/queue/logs')
|
||||
|
@ -157,11 +204,14 @@ App::get('/v1/health/queue/logs')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getQueueLogs')
|
||||
->label('sdk.description', '/docs/references/health/get-queue-logs.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->json(['size' => Resque::size(Event::AUDITS_QUEUE_NAME)]);
|
||||
$response->dynamic(new Document([ 'size' => Resque::size(Event::AUDITS_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
|
||||
}, ['response']);
|
||||
|
||||
App::get('/v1/health/queue/usage')
|
||||
|
@ -172,11 +222,14 @@ App::get('/v1/health/queue/usage')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getQueueUsage')
|
||||
->label('sdk.description', '/docs/references/health/get-queue-usage.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->json(['size' => Resque::size(Event::USAGE_QUEUE_NAME)]);
|
||||
$response->dynamic(new Document([ 'size' => Resque::size(Event::USAGE_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
|
||||
}, ['response']);
|
||||
|
||||
App::get('/v1/health/queue/certificates')
|
||||
|
@ -187,11 +240,14 @@ App::get('/v1/health/queue/certificates')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getQueueCertificates')
|
||||
->label('sdk.description', '/docs/references/health/get-queue-certificates.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->json(['size' => Resque::size(Event::CERTIFICATES_QUEUE_NAME)]);
|
||||
$response->dynamic(new Document([ 'size' => Resque::size(Event::CERTIFICATES_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
|
||||
}, ['response']);
|
||||
|
||||
App::get('/v1/health/queue/functions')
|
||||
|
@ -202,11 +258,14 @@ App::get('/v1/health/queue/functions')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getQueueFunctions')
|
||||
->label('sdk.description', '/docs/references/health/get-queue-functions.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_QUEUE)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$response->json(['size' => Resque::size(Event::FUNCTIONS_QUEUE_NAME)]);
|
||||
$response->dynamic(new Document([ 'size' => Resque::size(Event::FUNCTIONS_QUEUE_NAME) ]), Response::MODEL_HEALTH_QUEUE);
|
||||
}, ['response']);
|
||||
|
||||
App::get('/v1/health/storage/local')
|
||||
|
@ -217,10 +276,15 @@ App::get('/v1/health/storage/local')
|
|||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getStorageLocal')
|
||||
->label('sdk.description', '/docs/references/health/get-storage-local.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_STATUS)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$checkStart = \microtime(true);
|
||||
|
||||
foreach ([
|
||||
'Uploads' => APP_STORAGE_UPLOADS,
|
||||
'Cache' => APP_STORAGE_CACHE,
|
||||
|
@ -238,41 +302,51 @@ App::get('/v1/health/storage/local')
|
|||
}
|
||||
}
|
||||
|
||||
$response->json(['status' => 'OK']);
|
||||
$output = [
|
||||
'status' => 'pass',
|
||||
'ping' => \round((\microtime(true) - $checkStart) / 1000)
|
||||
];
|
||||
|
||||
$response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS);
|
||||
});
|
||||
|
||||
App::get('/v1/health/anti-virus')
|
||||
->desc('Get Anti virus')
|
||||
->desc('Get Antivirus')
|
||||
->groups(['api', 'health'])
|
||||
->label('scope', 'health.read')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
|
||||
->label('sdk.namespace', 'health')
|
||||
->label('sdk.method', 'getAntiVirus')
|
||||
->label('sdk.method', 'getAntivirus')
|
||||
->label('sdk.description', '/docs/references/health/get-storage-anti-virus.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_HEALTH_ANTIVIRUS)
|
||||
->inject('response')
|
||||
->action(function ($response) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
|
||||
$output = [
|
||||
'status' => '',
|
||||
'version' => ''
|
||||
];
|
||||
|
||||
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'disabled') { // Check if scans are enabled
|
||||
return $response->json([
|
||||
'status' => 'disabled',
|
||||
'version' => '',
|
||||
]);
|
||||
$output['status'] = 'disabled';
|
||||
$output['version'] = '';
|
||||
} else {
|
||||
$antivirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
||||
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
|
||||
|
||||
try {
|
||||
$output['version'] = @$antivirus->version();
|
||||
$output['status'] = (@$antivirus->ping()) ? 'pass' : 'fail';
|
||||
} catch( \Exception $e) {
|
||||
$output['status'] = 'offline';
|
||||
$output['version'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
||||
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
|
||||
try {
|
||||
$response->json([
|
||||
'status' => (@$antiVirus->ping()) ? 'online' : 'offline',
|
||||
'version' => @$antiVirus->version(),
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
$response->json([
|
||||
'status' => 'offline',
|
||||
'version' => '',
|
||||
]);
|
||||
}
|
||||
$response->dynamic(new Document($output), Response::MODEL_HEALTH_ANTIVIRUS);
|
||||
});
|
||||
|
||||
App::get('/v1/health/stats') // Currently only used internally
|
||||
|
|
|
@ -122,10 +122,10 @@ App::post('/v1/storage/files')
|
|||
$mimeType = $device->getFileMimeType($path); // Get mime-type before compression and encryption
|
||||
|
||||
if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled
|
||||
$antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
||||
$antivirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
||||
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
|
||||
|
||||
if (!$antiVirus->fileScan($path)) {
|
||||
if (!$antivirus->fileScan($path)) {
|
||||
$device->delete($path);
|
||||
throw new Exception('Invalid file', 403);
|
||||
}
|
||||
|
@ -882,4 +882,4 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
}
|
||||
|
||||
$response->dynamic($usage, Response::MODEL_USAGE_BUCKETS);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -113,17 +113,17 @@ $cli
|
|||
|
||||
if(App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled
|
||||
try {
|
||||
$antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
||||
$antivirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
|
||||
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
|
||||
|
||||
if((@$antiVirus->ping())) {
|
||||
Console::success('AntiVirus...........connected 👍');
|
||||
if((@$antivirus->ping())) {
|
||||
Console::success('Antivirus...........connected 👍');
|
||||
}
|
||||
else {
|
||||
Console::error('AntiVirus........disconnected 👎');
|
||||
Console::error('Antivirus........disconnected 👎');
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
Console::error('AntiVirus........disconnected 👎');
|
||||
Console::error('Antivirus........disconnected 👎');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Check the Appwrite Anti Virus server is up and connection is successful.
|
||||
Check the Appwrite Antivirus server is up and connection is successful.
|
|
@ -714,13 +714,13 @@
|
|||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 118px; height: 1px; padding-top: 520px; margin-left: 748px;">
|
||||
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
|
||||
AntiVirus (ClamAV)
|
||||
Antivirus (ClamAV)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="807" y="524" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
AntiVirus (ClamAV)
|
||||
Antivirus (ClamAV)
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
|
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
|
@ -52,6 +52,11 @@ use Appwrite\Utopia\Response\Model\Tag;
|
|||
use Appwrite\Utopia\Response\Model\Token;
|
||||
use Appwrite\Utopia\Response\Model\Webhook;
|
||||
use Appwrite\Utopia\Response\Model\Preferences;
|
||||
use Appwrite\Utopia\Response\Model\HealthAntivirus;
|
||||
use Appwrite\Utopia\Response\Model\HealthQueue;
|
||||
use Appwrite\Utopia\Response\Model\HealthStatus;
|
||||
use Appwrite\Utopia\Response\Model\HealthTime;
|
||||
use Appwrite\Utopia\Response\Model\HealthVersion;
|
||||
use Appwrite\Utopia\Response\Model\Mock; // Keep last
|
||||
use Appwrite\Utopia\Response\Model\Runtime;
|
||||
use Appwrite\Utopia\Response\Model\UsageBuckets;
|
||||
|
@ -160,6 +165,13 @@ class Response extends SwooleResponse
|
|||
const MODEL_PLATFORM_LIST = 'platformList';
|
||||
const MODEL_DOMAIN = 'domain';
|
||||
const MODEL_DOMAIN_LIST = 'domainList';
|
||||
|
||||
// Health
|
||||
const MODEL_HEALTH_STATUS = 'healthStatus';
|
||||
const MODEL_HEALTH_VERSION = 'healthVersion';
|
||||
const MODEL_HEALTH_QUEUE = 'healthQueue';
|
||||
const MODEL_HEALTH_TIME = 'healthTime';
|
||||
const MODEL_HEALTH_ANTIVIRUS = 'healthAntivirus';
|
||||
|
||||
// Deprecated
|
||||
const MODEL_PERMISSIONS = 'permissions';
|
||||
|
@ -255,6 +267,11 @@ class Response extends SwooleResponse
|
|||
->setModel(new Language())
|
||||
->setModel(new Currency())
|
||||
->setModel(new Phone())
|
||||
->setModel(new HealthAntivirus())
|
||||
->setModel(new HealthQueue())
|
||||
->setModel(new HealthStatus())
|
||||
->setModel(new HealthTime())
|
||||
->setModel(new HealthVersion())
|
||||
->setModel(new Metric())
|
||||
->setModel(new UsageDatabase())
|
||||
->setModel(new UsageCollection())
|
||||
|
|
|
@ -23,7 +23,7 @@ class Any extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -58,7 +58,7 @@ class BaseList extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -85,7 +85,7 @@ class Collection extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ class Continent extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ class Country extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -66,7 +66,7 @@ class Currency extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@ class Document extends Any
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -65,7 +65,7 @@ class Domain extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ class Error extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -39,7 +39,7 @@ class ErrorDev extends Error
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -85,7 +85,7 @@ class Execution extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -74,7 +74,7 @@ class File extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -110,7 +110,7 @@ class Func extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
47
src/Appwrite/Utopia/Response/Model/HealthAntivirus.php
Normal file
47
src/Appwrite/Utopia/Response/Model/HealthAntivirus.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class HealthAntivirus extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('version', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Antivirus version.',
|
||||
'default' => '',
|
||||
'example' => '1.0.0',
|
||||
])
|
||||
->addRule('status', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Antivirus status. Possible values can are: `disabled`, `offline`, `online`',
|
||||
'default' => '',
|
||||
'example' => 'online',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'Health Antivirus';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType():string
|
||||
{
|
||||
return Response::MODEL_HEALTH_ANTIVIRUS;
|
||||
}
|
||||
}
|
41
src/Appwrite/Utopia/Response/Model/HealthQueue.php
Normal file
41
src/Appwrite/Utopia/Response/Model/HealthQueue.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class HealthQueue extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('size', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Amount of actions in the queue.',
|
||||
'default' => 0,
|
||||
'example' => 8,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'Health Queue';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType():string
|
||||
{
|
||||
return Response::MODEL_HEALTH_QUEUE;
|
||||
}
|
||||
}
|
47
src/Appwrite/Utopia/Response/Model/HealthStatus.php
Normal file
47
src/Appwrite/Utopia/Response/Model/HealthStatus.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class HealthStatus extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('ping', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Duration in milliseconds how long the health check took.',
|
||||
'default' => 0,
|
||||
'example' => 128,
|
||||
])
|
||||
->addRule('status', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Service status. Possible values can are: `pass`, `fail`',
|
||||
'default' => '',
|
||||
'example' => 'pass',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'Health Status';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType():string
|
||||
{
|
||||
return Response::MODEL_HEALTH_STATUS;
|
||||
}
|
||||
}
|
53
src/Appwrite/Utopia/Response/Model/HealthTime.php
Normal file
53
src/Appwrite/Utopia/Response/Model/HealthTime.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class HealthTime extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('remoteTime', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Current unix timestamp on trustful remote server.',
|
||||
'default' => 0,
|
||||
'example' => 1639490751,
|
||||
])
|
||||
->addRule('localTime', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Current unix timestamp of local server where Appwrite runs.',
|
||||
'default' => 0,
|
||||
'example' => 1639490844,
|
||||
])
|
||||
->addRule('diff', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Difference of unix remote and local timestamps in milliseconds.',
|
||||
'default' => 0,
|
||||
'example' => 93,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'Health Time';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType():string
|
||||
{
|
||||
return Response::MODEL_HEALTH_TIME;
|
||||
}
|
||||
}
|
41
src/Appwrite/Utopia/Response/Model/HealthVersion.php
Normal file
41
src/Appwrite/Utopia/Response/Model/HealthVersion.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class HealthVersion extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('version', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Version of the Appwrite instance.',
|
||||
'default' => '',
|
||||
'example' => '0.11.0',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'Health Version';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType():string
|
||||
{
|
||||
return Response::MODEL_HEALTH_VERSION;
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ class JWT extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -54,7 +54,7 @@ class Key extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ class Language extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -66,7 +66,7 @@ class Locale extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -150,7 +150,7 @@ class Log extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -79,7 +79,7 @@ class Membership extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -30,7 +30,7 @@ class Mock extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@ class None extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ class Phone extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -76,7 +76,7 @@ class Platform extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ class Preferences extends Any
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -196,7 +196,7 @@ class Project extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -156,7 +156,7 @@ class Session extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -54,7 +54,7 @@ class Tag extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -48,7 +48,7 @@ class Team extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -48,7 +48,7 @@ class Token extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -72,7 +72,7 @@ class User extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -72,7 +72,7 @@ class Webhook extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Collection
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,9 @@ class HealthCustomServerTest extends Scope
|
|||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals('OK', $response['body']['status']);
|
||||
$this->assertEquals('pass', $response['body']['status']);
|
||||
$this->assertIsInt($response['body']['ping']);
|
||||
$this->assertLessThan(100, $response['body']['ping']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
@ -45,7 +47,9 @@ class HealthCustomServerTest extends Scope
|
|||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals('OK', $response['body']['status']);
|
||||
$this->assertEquals('pass', $response['body']['status']);
|
||||
$this->assertIsInt($response['body']['ping']);
|
||||
$this->assertLessThan(100, $response['body']['ping']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
@ -65,7 +69,9 @@ class HealthCustomServerTest extends Scope
|
|||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals('OK', $response['body']['status']);
|
||||
$this->assertEquals('pass', $response['body']['status']);
|
||||
$this->assertIsInt($response['body']['ping']);
|
||||
$this->assertLessThan(100, $response['body']['ping']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
@ -85,10 +91,10 @@ class HealthCustomServerTest extends Scope
|
|||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertIsInt($response['body']['remote']);
|
||||
$this->assertIsInt($response['body']['local']);
|
||||
$this->assertNotEmpty($response['body']['remote']);
|
||||
$this->assertNotEmpty($response['body']['local']);
|
||||
$this->assertIsInt($response['body']['remoteTime']);
|
||||
$this->assertIsInt($response['body']['localTime']);
|
||||
$this->assertNotEmpty($response['body']['remoteTime']);
|
||||
$this->assertNotEmpty($response['body']['localTime']);
|
||||
$this->assertLessThan(10, $response['body']['diff']);
|
||||
|
||||
/**
|
||||
|
@ -193,7 +199,9 @@ class HealthCustomServerTest extends Scope
|
|||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals('OK', $response['body']['status']);
|
||||
$this->assertEquals('pass', $response['body']['status']);
|
||||
$this->assertIsInt($response['body']['ping']);
|
||||
$this->assertLessThan(100, $response['body']['ping']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
|
Loading…
Reference in a new issue