mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
chore: sync 1.6.x
This commit is contained in:
@@ -320,15 +320,12 @@ These are the current metrics we collect usage stats for:
|
||||
| executions | Total number of executions per project |
|
||||
| databases | Total number of databases per project |
|
||||
| databases.storage | Total amount of storage used by all databases per project (in bytes) |
|
||||
| databases.storage_disk | Total amount of storage used by all database per project on disk (in bytes) |
|
||||
| collections | Total number of collections per project |
|
||||
| {databaseInternalId}.collections | Total number of collections per database|
|
||||
| {databaseInternalId}.storage | Sum of database storage (in bytes) |
|
||||
| {databaseInternalId}.storage_disk | Sum of database storage on disk (in bytes) |
|
||||
| documents | Total number of documents per project |
|
||||
| {databaseInternalId}.{collectionInternalId}.documents | Total number of documents per collection |
|
||||
| {databaseInternalId}.{collectionInternalId}.storage | Sum of database storage used by the collection (in bytes) |
|
||||
| {databsaeInternalId}.{collectionInternalId}.storage_disk | Sum of database storage used by the collection on disk (in bytes) |
|
||||
| buckets | Total number of buckets per project |
|
||||
| files | Total number of files per project |
|
||||
| {bucketInternalId}.files.storage | Sum of files.storage per bucket (in bytes) |
|
||||
|
||||
@@ -9405,7 +9405,7 @@
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -35589,7 +35589,7 @@
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -25966,7 +25966,7 @@
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -9405,7 +9405,7 @@
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -35589,7 +35589,7 @@
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -25966,7 +25966,7 @@
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -9589,9 +9589,9 @@
|
||||
"format": "int32"
|
||||
},
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"type": "payload",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -36104,9 +36104,9 @@
|
||||
"format": "int32"
|
||||
},
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"type": "payload",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -26458,9 +26458,9 @@
|
||||
"format": "int32"
|
||||
},
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"type": "payload",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -9589,9 +9589,9 @@
|
||||
"format": "int32"
|
||||
},
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"type": "payload",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -36104,9 +36104,9 @@
|
||||
"format": "int32"
|
||||
},
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"type": "payload",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -26458,9 +26458,9 @@
|
||||
"format": "int32"
|
||||
},
|
||||
"responseBody": {
|
||||
"type": "string",
|
||||
"type": "payload",
|
||||
"description": "HTTP response body. This will return empty unless execution is created as synchronous.",
|
||||
"x-example": "Developers are awesome."
|
||||
"x-example": ""
|
||||
},
|
||||
"responseHeaders": {
|
||||
"type": "array",
|
||||
|
||||
@@ -240,15 +240,12 @@ const METRIC_SESSIONS = 'sessions';
|
||||
const METRIC_DATABASES = 'databases';
|
||||
const METRIC_COLLECTIONS = 'collections';
|
||||
const METRIC_DATABASES_STORAGE = 'databases.storage';
|
||||
const METRIC_DATABASES_STORAGE_DISK = 'databases.storage_disk';
|
||||
const METRIC_DATABASE_ID_COLLECTIONS = '{databaseInternalId}.collections';
|
||||
const METRIC_DATABASE_ID_STORAGE = '{databaseInternalId}.databases.storage';
|
||||
const METRIC_DATABASE_ID_STORAGE_DISK = '{databaseInternalId}.databases.storage_disk';
|
||||
const METRIC_DOCUMENTS = 'documents';
|
||||
const METRIC_DATABASE_ID_DOCUMENTS = '{databaseInternalId}.documents';
|
||||
const METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS = '{databaseInternalId}.{collectionInternalId}.documents';
|
||||
const METRIC_DATABASE_ID_COLLECTION_ID_STORAGE = '{databaseInternalId}.{collectionInternalId}.databases.storage';
|
||||
const METRIC_DATABASE_ID_COLLECTION_ID_STORAGE_DISK = '{databaseInternalId}.{collectionInternalId}.databases.storage_disk';
|
||||
const METRIC_BUCKETS = 'buckets';
|
||||
const METRIC_FILES = 'files';
|
||||
const METRIC_FILES_STORAGE = 'files.storage';
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@
|
||||
"utopia-php/cache": "0.10.*",
|
||||
"utopia-php/cli": "0.15.*",
|
||||
"utopia-php/config": "0.2.*",
|
||||
"utopia-php/database": "0.53.5-rc1",
|
||||
"utopia-php/database": "0.53.5",
|
||||
"utopia-php/domains": "0.5.*",
|
||||
"utopia-php/dsn": "0.2.1",
|
||||
"utopia-php/framework": "0.33.*",
|
||||
|
||||
Generated
+4
-6
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "aeb95e5148f792325e4a96dd246118d2",
|
||||
"content-hash": "1981099f3c47f5536298222ba9b0b994",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
@@ -1723,7 +1723,7 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "0.53.5-rc1",
|
||||
"version": "0.53.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
@@ -1773,7 +1773,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/0.53.5-rc1"
|
||||
"source": "https://github.com/utopia-php/database/tree/0.53.5"
|
||||
},
|
||||
"time": "2024-09-24T08:43:10+00:00"
|
||||
},
|
||||
@@ -6995,9 +6995,7 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"utopia-php/database": 5
|
||||
},
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
||||
@@ -50,6 +50,7 @@ class Mapper
|
||||
$defaults = [
|
||||
'boolean' => Type::boolean(),
|
||||
'string' => Type::string(),
|
||||
'payload' => Type::string(),
|
||||
'integer' => Type::int(),
|
||||
'double' => Type::float(),
|
||||
'datetime' => Type::string(),
|
||||
|
||||
@@ -489,11 +489,29 @@ class Messaging extends Action
|
||||
|
||||
return match ($provider->getAttribute('provider')) {
|
||||
'mock' => new Mock('username', 'password'),
|
||||
'twilio' => new Twilio($credentials['accountSid'], $credentials['authToken'], null, isset($credentials['messagingServiceSid']) ? $credentials['messagingServiceSid'] : null),
|
||||
'textmagic' => new TextMagic($credentials['username'], $credentials['apiKey']),
|
||||
'telesign' => new Telesign($credentials['customerId'], $credentials['apiKey']),
|
||||
'msg91' => new Msg91($credentials['senderId'], $credentials['authKey'], $credentials['templateId']),
|
||||
'vonage' => new Vonage($credentials['apiKey'], $credentials['apiSecret']),
|
||||
'twilio' => new Twilio(
|
||||
$credentials['accountSid'] ?? '',
|
||||
$credentials['authToken'] ?? '',
|
||||
null,
|
||||
$credentials['messagingServiceSid'] ?? null
|
||||
),
|
||||
'textmagic' => new TextMagic(
|
||||
$credentials['username'] ?? '',
|
||||
$credentials['apiKey'] ?? ''
|
||||
),
|
||||
'telesign' => new Telesign(
|
||||
$credentials['customerId'] ?? '',
|
||||
$credentials['apiKey'] ?? ''
|
||||
),
|
||||
'msg91' => new Msg91(
|
||||
$credentials['senderId'] ?? '',
|
||||
$credentials['authKey'] ?? '',
|
||||
$credentials['templateId'] ?? ''
|
||||
),
|
||||
'vonage' => new Vonage(
|
||||
$credentials['apiKey'] ?? '',
|
||||
$credentials['apiSecret'] ?? ''
|
||||
),
|
||||
default => null
|
||||
};
|
||||
}
|
||||
@@ -506,11 +524,11 @@ class Messaging extends Action
|
||||
return match ($provider->getAttribute('provider')) {
|
||||
'mock' => new Mock('username', 'password'),
|
||||
'apns' => new APNS(
|
||||
$credentials['authKey'],
|
||||
$credentials['authKeyId'],
|
||||
$credentials['teamId'],
|
||||
$credentials['bundleId'],
|
||||
$options['sandbox']
|
||||
$credentials['authKey'] ?? '',
|
||||
$credentials['authKeyId'] ?? '',
|
||||
$credentials['teamId'] ?? '',
|
||||
$credentials['bundleId'] ?? '',
|
||||
$options['sandbox'] ?? false
|
||||
),
|
||||
'fcm' => new FCM(\json_encode($credentials['serviceAccountJSON'])),
|
||||
default => null
|
||||
@@ -521,24 +539,25 @@ class Messaging extends Action
|
||||
{
|
||||
$credentials = $provider->getAttribute('credentials', []);
|
||||
$options = $provider->getAttribute('options', []);
|
||||
$apiKey = $credentials['apiKey'] ?? '';
|
||||
|
||||
return match ($provider->getAttribute('provider')) {
|
||||
'mock' => new Mock('username', 'password'),
|
||||
'smtp' => new SMTP(
|
||||
$credentials['host'],
|
||||
$credentials['port'],
|
||||
$credentials['username'],
|
||||
$credentials['password'],
|
||||
$options['encryption'],
|
||||
$options['autoTLS'],
|
||||
$options['mailer'],
|
||||
$credentials['host'] ?? '',
|
||||
$credentials['port'] ?? 25,
|
||||
$credentials['username'] ?? '',
|
||||
$credentials['password'] ?? '',
|
||||
$options['encryption'] ?? '',
|
||||
$options['autoTLS'] ?? false,
|
||||
$options['mailer'] ?? '',
|
||||
),
|
||||
'mailgun' => new Mailgun(
|
||||
$credentials['apiKey'],
|
||||
$credentials['domain'],
|
||||
$credentials['isEuRegion']
|
||||
$apiKey,
|
||||
$credentials['domain'] ?? '',
|
||||
$credentials['isEuRegion'] ?? false
|
||||
),
|
||||
'sendgrid' => new Sendgrid($credentials['apiKey']),
|
||||
'sendgrid' => new Sendgrid($apiKey),
|
||||
default => null
|
||||
};
|
||||
}
|
||||
|
||||
@@ -163,7 +163,6 @@ class UsageDump extends Action
|
||||
$id = \md5("{$time}_{$period}_{$key}");
|
||||
|
||||
$value = 0;
|
||||
$diskValue = 0;
|
||||
$previousValue = 0;
|
||||
try {
|
||||
$previousValue = ($dbForProject->getDocument('stats', $id))->getAttribute('value', 0);
|
||||
@@ -179,8 +178,7 @@ class UsageDump extends Action
|
||||
$collectionInternalId = $data[1];
|
||||
|
||||
try {
|
||||
$value = $dbForProject->getSizeOfCollection('database_'.$databaseInternalId.'_collection_'.$collectionInternalId);
|
||||
$diskValue = $dbForProject->getSizeOfCollectionOnDisk('database_'.$databaseInternalId.'_collection_'.$collectionInternalId);
|
||||
$value = $dbForProject->getSizeOfCollection('database_' . $databaseInternalId . '_collection_' . $collectionInternalId);
|
||||
} catch (\Exception $e) {
|
||||
// Collection not found
|
||||
if ($e->getMessage() !== 'Collection not found') {
|
||||
@@ -190,25 +188,21 @@ class UsageDump extends Action
|
||||
|
||||
// Compare with previous value
|
||||
$diff = $value - $previousValue;
|
||||
$diskDiff = $diskValue - $previousValue;
|
||||
|
||||
if ($diff === 0 && $diskDiff === 0) {
|
||||
if ($diff === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Update Collection
|
||||
$updateMetric($dbForProject, $diff, $key, $period, $time);
|
||||
$updateMetric($dbForProject, $diskDiff, $key . '_disk', $period, $time);
|
||||
|
||||
// Update Database
|
||||
$databaseKey = str_replace(['{databaseInternalId}'], [$data[0]], METRIC_DATABASE_ID_STORAGE);
|
||||
$updateMetric($dbForProject, $diff, $databaseKey, $period, $time);
|
||||
$updateMetric($dbForProject, $diskDiff, $databaseKey . '_disk', $period, $time);
|
||||
|
||||
// Update Project
|
||||
$projectKey = METRIC_DATABASES_STORAGE;
|
||||
$updateMetric($dbForProject, $diff, $projectKey, $period, $time);
|
||||
$updateMetric($dbForProject, $diskDiff, $projectKey . '_disk', $period, $time);
|
||||
break;
|
||||
// Database Level
|
||||
case METRIC_DATABASE_LEVEL_STORAGE:
|
||||
@@ -227,8 +221,7 @@ class UsageDump extends Action
|
||||
|
||||
foreach ($collections as $collection) {
|
||||
try {
|
||||
$value += $dbForProject->getSizeOfCollection('database_'.$databaseInternalId.'_collection_'.$collection->getInternalId());
|
||||
$diskValue += $dbForProject->getSizeOfCollectionOnDisk('database_'.$databaseInternalId.'_collection_'.$collection->getInternalId());
|
||||
$value += $dbForProject->getSizeOfCollection('database_' . $databaseInternalId . '_collection_' . $collection->getInternalId());
|
||||
} catch (\Exception $e) {
|
||||
// Collection not found
|
||||
if ($e->getMessage() !== 'Collection not found') {
|
||||
@@ -238,21 +231,18 @@ class UsageDump extends Action
|
||||
}
|
||||
|
||||
$diff = $value - $previousValue;
|
||||
$diskDiff = $diskValue - $previousValue;
|
||||
|
||||
if ($diff === 0 && $diskDiff === 0) {
|
||||
if ($diff === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Update Database
|
||||
$databaseKey = str_replace(['{databaseInternalId}'], [$data[0]], METRIC_DATABASE_ID_STORAGE);
|
||||
$updateMetric($dbForProject, $diff, $databaseKey, $period, $time);
|
||||
$updateMetric($dbForProject, $diskDiff, $databaseKey . '_disk', $period, $time);
|
||||
|
||||
// Update Project
|
||||
$projectKey = METRIC_DATABASES_STORAGE;
|
||||
$updateMetric($dbForProject, $diff, $projectKey, $period, $time);
|
||||
$updateMetric($dbForProject, $diskDiff, $projectKey . '_disk', $period, $time);
|
||||
break;
|
||||
// Project Level
|
||||
case METRIC_PROJECT_LEVEL_STORAGE:
|
||||
@@ -266,8 +256,7 @@ class UsageDump extends Action
|
||||
|
||||
foreach ($collections as $collection) {
|
||||
try {
|
||||
$value += $dbForProject->getSizeOfCollection('database_'.$database->getInternalId().'_collection_'.$collection->getInternalId());
|
||||
$diskValue += $dbForProject->getSizeOfCollectionOnDisk('database_'.$database->getInternalId().'_collection_'.$collection->getInternalId());
|
||||
$value += $dbForProject->getSizeOfCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
} catch (\Exception $e) {
|
||||
// Collection not found
|
||||
if ($e->getMessage() !== 'Collection not found') {
|
||||
@@ -278,12 +267,10 @@ class UsageDump extends Action
|
||||
}
|
||||
|
||||
$diff = $value - $previousValue;
|
||||
$diskDiff = $diskValue - $previousValue;
|
||||
|
||||
// Update Project
|
||||
$projectKey = METRIC_DATABASES_STORAGE;
|
||||
$updateMetric($dbForProject, $diff, $projectKey, $period, $time);
|
||||
$updateMetric($dbForProject, $diskDiff, $projectKey . '_disk', $period, $time);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,6 +549,7 @@ class OpenAPI3 extends Format
|
||||
switch ($rule['type']) {
|
||||
case 'string':
|
||||
case 'datetime':
|
||||
case 'payload':
|
||||
$type = 'string';
|
||||
break;
|
||||
|
||||
|
||||
@@ -585,6 +585,10 @@ class Swagger2 extends Format
|
||||
$type = 'boolean';
|
||||
break;
|
||||
|
||||
case 'payload':
|
||||
$type = 'payload';
|
||||
break;
|
||||
|
||||
default:
|
||||
$type = 'object';
|
||||
$rule['type'] = ($rule['type']) ?: 'none';
|
||||
|
||||
@@ -14,6 +14,7 @@ abstract class Model
|
||||
public const TYPE_DATETIME = 'datetime';
|
||||
public const TYPE_DATETIME_EXAMPLE = '2020-10-15T06:38:00.000+00:00';
|
||||
public const TYPE_RELATIONSHIP = 'relationship';
|
||||
public const TYPE_PAYLOAD = 'payload';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
||||
@@ -81,10 +81,9 @@ class Execution extends Model
|
||||
'example' => 200,
|
||||
])
|
||||
->addRule('responseBody', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'type' => self::TYPE_PAYLOAD,
|
||||
'description' => 'HTTP response body. This will return empty unless execution is created as synchronous.',
|
||||
'default' => '',
|
||||
'example' => 'Developers are awesome.',
|
||||
])
|
||||
->addRule('responseHeaders', [
|
||||
'type' => Response::MODEL_HEADERS,
|
||||
|
||||
@@ -133,7 +133,7 @@ class HTTPTest extends Scope
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
// looks like recent change in the validator
|
||||
$this->assertTrue(empty($response['body']['schemaValidationMessages']));
|
||||
$this->assertEmpty($response['body']['schemaValidationMessages'], 'Schema validation failed for ' . $file . ': ' . json_encode($response['body']['schemaValidationMessages'], JSON_PRETTY_PRINT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user