mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Merge branch '1.6.x' of github.com:appwrite/appwrite into updates-projects-regions
This commit is contained in:
commit
d6e53d8e2e
30 changed files with 898 additions and 693 deletions
|
|
@ -99,6 +99,10 @@ CLI::setResource('dbForPlatform', function ($pools, $cache) {
|
|||
return $dbForPlatform;
|
||||
}, ['pools', 'cache']);
|
||||
|
||||
CLI::setResource('console', function () {
|
||||
return new Document(Config::getParam('console'));
|
||||
}, []);
|
||||
|
||||
CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache) {
|
||||
$databases = []; // TODO: @Meldiron This should probably be responsibility of utopia-php/pools
|
||||
|
||||
|
|
|
|||
52
app/config/console.php
Normal file
52
app/config/console.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Initializes console project document.
|
||||
*/
|
||||
|
||||
use Appwrite\Auth\Auth;
|
||||
use Appwrite\Network\Validator\Origin;
|
||||
use Utopia\Database\Helpers\ID;
|
||||
use Utopia\System\System;
|
||||
|
||||
$console = [
|
||||
'$id' => ID::custom('console'),
|
||||
'$internalId' => ID::custom('console'),
|
||||
'name' => 'Appwrite',
|
||||
'$collection' => ID::custom('projects'),
|
||||
'description' => 'Appwrite core engine',
|
||||
'logo' => '',
|
||||
'teamId' => null,
|
||||
'webhooks' => [],
|
||||
'keys' => [],
|
||||
'platforms' => [
|
||||
[
|
||||
'$collection' => ID::custom('platforms'),
|
||||
'name' => 'Localhost',
|
||||
'type' => Origin::CLIENT_TYPE_WEB,
|
||||
'hostname' => 'localhost',
|
||||
], // Current host is added on app init
|
||||
],
|
||||
'legalName' => '',
|
||||
'legalCountry' => '',
|
||||
'legalState' => '',
|
||||
'legalCity' => '',
|
||||
'legalAddress' => '',
|
||||
'legalTaxId' => '',
|
||||
'auths' => [
|
||||
'mockNumbers' => [],
|
||||
'invites' => System::getEnv('_APP_CONSOLE_INVITES', 'enabled') === 'enabled',
|
||||
'limit' => (System::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user
|
||||
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG, // 1 Year in seconds
|
||||
'sessionAlerts' => System::getEnv('_APP_CONSOLE_SESSION_ALERTS', 'disabled') === 'enabled'
|
||||
],
|
||||
'authWhitelistEmails' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [],
|
||||
'authWhitelistIPs' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null)) : [],
|
||||
'oAuthProviders' => [
|
||||
'githubEnabled' => true,
|
||||
'githubSecret' => System::getEnv('_APP_CONSOLE_GITHUB_SECRET', ''),
|
||||
'githubAppid' => System::getEnv('_APP_CONSOLE_GITHUB_APP_ID', '')
|
||||
],
|
||||
];
|
||||
|
||||
return $console;
|
||||
|
|
@ -3383,7 +3383,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "code",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
|
|
@ -3404,7 +3404,8 @@
|
|||
"union-china-pay",
|
||||
"visa",
|
||||
"mir",
|
||||
"maestro"
|
||||
"maestro",
|
||||
"rupay"
|
||||
],
|
||||
"x-enum-name": "CreditCard",
|
||||
"x-enum-keys": [
|
||||
|
|
@ -3423,7 +3424,8 @@
|
|||
"Union China Pay",
|
||||
"Visa",
|
||||
"MIR",
|
||||
"Maestro"
|
||||
"Maestro",
|
||||
"Rupay"
|
||||
]
|
||||
},
|
||||
"in": "path"
|
||||
|
|
@ -4365,7 +4367,7 @@
|
|||
"tags": [
|
||||
"databases"
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.",
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n",
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Document",
|
||||
|
|
|
|||
|
|
@ -3387,7 +3387,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "code",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
|
|
@ -3408,7 +3408,8 @@
|
|||
"union-china-pay",
|
||||
"visa",
|
||||
"mir",
|
||||
"maestro"
|
||||
"maestro",
|
||||
"rupay"
|
||||
],
|
||||
"x-enum-name": "CreditCard",
|
||||
"x-enum-keys": [
|
||||
|
|
@ -3427,7 +3428,8 @@
|
|||
"Union China Pay",
|
||||
"Visa",
|
||||
"MIR",
|
||||
"Maestro"
|
||||
"Maestro",
|
||||
"Rupay"
|
||||
]
|
||||
},
|
||||
"in": "path"
|
||||
|
|
@ -7823,7 +7825,7 @@
|
|||
"tags": [
|
||||
"databases"
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.",
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n",
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Document",
|
||||
|
|
@ -11585,7 +11587,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getCertificate",
|
||||
"weight": 134,
|
||||
"weight": 133,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11692,7 +11694,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getPubSub",
|
||||
"weight": 130,
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11718,54 +11720,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue": {
|
||||
"get": {
|
||||
"summary": "Get queue",
|
||||
"operationId": "healthGetQueue",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Check the Appwrite queue messaging servers are up and connection is successful.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Status",
|
||||
"content": {
|
||||
"application\/json": {
|
||||
"schema": {
|
||||
"$ref": "#\/components\/schemas\/healthStatus"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueue",
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/builds": {
|
||||
"get": {
|
||||
"summary": "Get builds queue",
|
||||
|
|
@ -11788,7 +11742,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueBuilds",
|
||||
"weight": 136,
|
||||
"weight": 135,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11849,7 +11803,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueCertificates",
|
||||
"weight": 135,
|
||||
"weight": 134,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11910,7 +11864,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDatabases",
|
||||
"weight": 137,
|
||||
"weight": 136,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11982,7 +11936,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDeletes",
|
||||
"weight": 138,
|
||||
"weight": 137,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12081,8 +12035,9 @@
|
|||
"v1-audits",
|
||||
"v1-mails",
|
||||
"v1-functions",
|
||||
"v1-usage",
|
||||
"v1-usage-dump",
|
||||
"v1-stats-resources",
|
||||
"v1-stats-usage",
|
||||
"v1-stats-usage-dump",
|
||||
"v1-webhooks",
|
||||
"v1-certificates",
|
||||
"v1-builds",
|
||||
|
|
@ -12130,7 +12085,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueFunctions",
|
||||
"weight": 142,
|
||||
"weight": 141,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12191,7 +12146,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueLogs",
|
||||
"weight": 133,
|
||||
"weight": 132,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12252,7 +12207,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMails",
|
||||
"weight": 139,
|
||||
"weight": 138,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12313,7 +12268,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMessaging",
|
||||
"weight": 140,
|
||||
"weight": 139,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12374,7 +12329,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMigrations",
|
||||
"weight": 141,
|
||||
"weight": 140,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12413,14 +12368,14 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage": {
|
||||
"\/health\/queue\/stats-resources": {
|
||||
"get": {
|
||||
"summary": "Get usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"summary": "Get stats resources queue",
|
||||
"operationId": "healthGetQueueStatsResources",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
|
|
@ -12434,13 +12389,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"method": "getQueueStatsResources",
|
||||
"weight": 142,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md",
|
||||
"demo": "health\/get-queue-stats-resources.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-resources.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -12474,10 +12429,71 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage-dump": {
|
||||
"\/health\/queue\/stats-usage": {
|
||||
"get": {
|
||||
"summary": "Get stats usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
"content": {
|
||||
"application\/json": {
|
||||
"schema": {
|
||||
"$ref": "#\/components\/schemas\/healthQueue"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "threshold",
|
||||
"description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"default": 5000
|
||||
},
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/stats-usage-dump": {
|
||||
"get": {
|
||||
"summary": "Get usage dump queue",
|
||||
"operationId": "healthGetQueueUsageDump",
|
||||
"operationId": "healthGetQueueStatsUsageDump",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
|
|
@ -12495,13 +12511,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsageDump",
|
||||
"method": "getQueueStatsUsageDump",
|
||||
"weight": 144,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage-dump.md",
|
||||
"demo": "health\/get-queue-stats-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage-dump.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -12557,7 +12573,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueWebhooks",
|
||||
"weight": 132,
|
||||
"weight": 131,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12714,7 +12730,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getTime",
|
||||
"weight": 131,
|
||||
"weight": 130,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -17609,17 +17625,17 @@
|
|||
},
|
||||
"endpoint": {
|
||||
"type": "string",
|
||||
"description": "Source's Appwrite Endpoint",
|
||||
"description": "Source Appwrite endpoint",
|
||||
"x-example": "https:\/\/example.com"
|
||||
},
|
||||
"projectId": {
|
||||
"type": "string",
|
||||
"description": "Source's Project ID",
|
||||
"description": "Source Project ID",
|
||||
"x-example": "<PROJECT_ID>"
|
||||
},
|
||||
"apiKey": {
|
||||
"type": "string",
|
||||
"description": "Source's API Key",
|
||||
"description": "Source API Key",
|
||||
"x-example": "<API_KEY>"
|
||||
}
|
||||
},
|
||||
|
|
@ -36052,6 +36068,20 @@
|
|||
"$ref": "#\/components\/schemas\/metric"
|
||||
},
|
||||
"x-example": []
|
||||
},
|
||||
"imageTransformations": {
|
||||
"type": "array",
|
||||
"description": "Aggregated number of files transformations per period.",
|
||||
"items": {
|
||||
"$ref": "#\/components\/schemas\/metric"
|
||||
},
|
||||
"x-example": []
|
||||
},
|
||||
"imageTransformationsTotal": {
|
||||
"type": "integer",
|
||||
"description": "Total aggregated number of files transformations.",
|
||||
"x-example": 0,
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -36059,7 +36089,9 @@
|
|||
"filesTotal",
|
||||
"filesStorageTotal",
|
||||
"files",
|
||||
"storage"
|
||||
"storage",
|
||||
"imageTransformations",
|
||||
"imageTransformationsTotal"
|
||||
]
|
||||
},
|
||||
"usageFunctions": {
|
||||
|
|
@ -36597,6 +36629,18 @@
|
|||
"$ref": "#\/components\/schemas\/metric"
|
||||
},
|
||||
"x-example": []
|
||||
},
|
||||
"imageTransformationsTotal": {
|
||||
"type": "integer",
|
||||
"description": "An array of aggregated number of image transformations.",
|
||||
"x-example": 0,
|
||||
"format": "int32"
|
||||
},
|
||||
"imageTransformations": {
|
||||
"type": "integer",
|
||||
"description": "Total aggregated number of image transformations.",
|
||||
"x-example": 0,
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -36628,7 +36672,9 @@
|
|||
"authPhoneEstimate",
|
||||
"authPhoneCountryBreakdown",
|
||||
"databasesReads",
|
||||
"databasesWrites"
|
||||
"databasesWrites",
|
||||
"imageTransformationsTotal",
|
||||
"imageTransformations"
|
||||
]
|
||||
},
|
||||
"headers": {
|
||||
|
|
|
|||
|
|
@ -3077,7 +3077,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "code",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
|
|
@ -3098,7 +3098,8 @@
|
|||
"union-china-pay",
|
||||
"visa",
|
||||
"mir",
|
||||
"maestro"
|
||||
"maestro",
|
||||
"rupay"
|
||||
],
|
||||
"x-enum-name": "CreditCard",
|
||||
"x-enum-keys": [
|
||||
|
|
@ -3117,7 +3118,8 @@
|
|||
"Union China Pay",
|
||||
"Visa",
|
||||
"MIR",
|
||||
"Maestro"
|
||||
"Maestro",
|
||||
"Rupay"
|
||||
]
|
||||
},
|
||||
"in": "path"
|
||||
|
|
@ -7381,7 +7383,7 @@
|
|||
"tags": [
|
||||
"databases"
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.",
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n",
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Document",
|
||||
|
|
@ -10461,7 +10463,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getCertificate",
|
||||
"weight": 134,
|
||||
"weight": 133,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10570,7 +10572,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getPubSub",
|
||||
"weight": 130,
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10597,55 +10599,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue": {
|
||||
"get": {
|
||||
"summary": "Get queue",
|
||||
"operationId": "healthGetQueue",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Check the Appwrite queue messaging servers are up and connection is successful.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Status",
|
||||
"content": {
|
||||
"application\/json": {
|
||||
"schema": {
|
||||
"$ref": "#\/components\/schemas\/healthStatus"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueue",
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/builds": {
|
||||
"get": {
|
||||
"summary": "Get builds queue",
|
||||
|
|
@ -10668,7 +10621,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueBuilds",
|
||||
"weight": 136,
|
||||
"weight": 135,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10730,7 +10683,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueCertificates",
|
||||
"weight": 135,
|
||||
"weight": 134,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10792,7 +10745,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDatabases",
|
||||
"weight": 137,
|
||||
"weight": 136,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10865,7 +10818,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDeletes",
|
||||
"weight": 138,
|
||||
"weight": 137,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10966,8 +10919,9 @@
|
|||
"v1-audits",
|
||||
"v1-mails",
|
||||
"v1-functions",
|
||||
"v1-usage",
|
||||
"v1-usage-dump",
|
||||
"v1-stats-resources",
|
||||
"v1-stats-usage",
|
||||
"v1-stats-usage-dump",
|
||||
"v1-webhooks",
|
||||
"v1-certificates",
|
||||
"v1-builds",
|
||||
|
|
@ -11015,7 +10969,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueFunctions",
|
||||
"weight": 142,
|
||||
"weight": 141,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11077,7 +11031,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueLogs",
|
||||
"weight": 133,
|
||||
"weight": 132,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11139,7 +11093,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMails",
|
||||
"weight": 139,
|
||||
"weight": 138,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11201,7 +11155,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMessaging",
|
||||
"weight": 140,
|
||||
"weight": 139,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11263,7 +11217,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMigrations",
|
||||
"weight": 141,
|
||||
"weight": 140,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11303,14 +11257,14 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage": {
|
||||
"\/health\/queue\/stats-resources": {
|
||||
"get": {
|
||||
"summary": "Get usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"summary": "Get stats resources queue",
|
||||
"operationId": "healthGetQueueStatsResources",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
|
|
@ -11324,13 +11278,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"method": "getQueueStatsResources",
|
||||
"weight": 142,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md",
|
||||
"demo": "health\/get-queue-stats-resources.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-resources.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -11365,10 +11319,72 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage-dump": {
|
||||
"\/health\/queue\/stats-usage": {
|
||||
"get": {
|
||||
"summary": "Get stats usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
"content": {
|
||||
"application\/json": {
|
||||
"schema": {
|
||||
"$ref": "#\/components\/schemas\/healthQueue"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "threshold",
|
||||
"description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"default": 5000
|
||||
},
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/stats-usage-dump": {
|
||||
"get": {
|
||||
"summary": "Get usage dump queue",
|
||||
"operationId": "healthGetQueueUsageDump",
|
||||
"operationId": "healthGetQueueStatsUsageDump",
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
|
|
@ -11386,13 +11402,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsageDump",
|
||||
"method": "getQueueStatsUsageDump",
|
||||
"weight": 144,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage-dump.md",
|
||||
"demo": "health\/get-queue-stats-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage-dump.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -11449,7 +11465,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueWebhooks",
|
||||
"weight": 132,
|
||||
"weight": 131,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11609,7 +11625,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getTime",
|
||||
"weight": 131,
|
||||
"weight": 130,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
|
|||
|
|
@ -3557,7 +3557,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "code",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-example": "amex",
|
||||
|
|
@ -3577,7 +3577,8 @@
|
|||
"union-china-pay",
|
||||
"visa",
|
||||
"mir",
|
||||
"maestro"
|
||||
"maestro",
|
||||
"rupay"
|
||||
],
|
||||
"x-enum-name": "CreditCard",
|
||||
"x-enum-keys": [
|
||||
|
|
@ -3596,7 +3597,8 @@
|
|||
"Union China Pay",
|
||||
"Visa",
|
||||
"MIR",
|
||||
"Maestro"
|
||||
"Maestro",
|
||||
"Rupay"
|
||||
],
|
||||
"in": "path"
|
||||
},
|
||||
|
|
@ -4547,7 +4549,7 @@
|
|||
"tags": [
|
||||
"databases"
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.",
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n",
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Document",
|
||||
|
|
|
|||
|
|
@ -3577,7 +3577,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "code",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-example": "amex",
|
||||
|
|
@ -3597,7 +3597,8 @@
|
|||
"union-china-pay",
|
||||
"visa",
|
||||
"mir",
|
||||
"maestro"
|
||||
"maestro",
|
||||
"rupay"
|
||||
],
|
||||
"x-enum-name": "CreditCard",
|
||||
"x-enum-keys": [
|
||||
|
|
@ -3616,7 +3617,8 @@
|
|||
"Union China Pay",
|
||||
"Visa",
|
||||
"MIR",
|
||||
"Maestro"
|
||||
"Maestro",
|
||||
"Rupay"
|
||||
],
|
||||
"in": "path"
|
||||
},
|
||||
|
|
@ -8012,7 +8014,7 @@
|
|||
"tags": [
|
||||
"databases"
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.",
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n",
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Document",
|
||||
|
|
@ -11810,7 +11812,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getCertificate",
|
||||
"weight": 134,
|
||||
"weight": 133,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11919,7 +11921,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getPubSub",
|
||||
"weight": 130,
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11945,56 +11947,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue": {
|
||||
"get": {
|
||||
"summary": "Get queue",
|
||||
"operationId": "healthGetQueue",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
"produces": [
|
||||
"application\/json"
|
||||
],
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Check the Appwrite queue messaging servers are up and connection is successful.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Status",
|
||||
"schema": {
|
||||
"$ref": "#\/definitions\/healthStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueue",
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/builds": {
|
||||
"get": {
|
||||
"summary": "Get builds queue",
|
||||
|
|
@ -12019,7 +11971,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueBuilds",
|
||||
"weight": 136,
|
||||
"weight": 135,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12080,7 +12032,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueCertificates",
|
||||
"weight": 135,
|
||||
"weight": 134,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12141,7 +12093,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDatabases",
|
||||
"weight": 137,
|
||||
"weight": 136,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12211,7 +12163,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDeletes",
|
||||
"weight": 138,
|
||||
"weight": 137,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12309,8 +12261,9 @@
|
|||
"v1-audits",
|
||||
"v1-mails",
|
||||
"v1-functions",
|
||||
"v1-usage",
|
||||
"v1-usage-dump",
|
||||
"v1-stats-resources",
|
||||
"v1-stats-usage",
|
||||
"v1-stats-usage-dump",
|
||||
"v1-webhooks",
|
||||
"v1-certificates",
|
||||
"v1-builds",
|
||||
|
|
@ -12357,7 +12310,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueFunctions",
|
||||
"weight": 142,
|
||||
"weight": 141,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12418,7 +12371,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueLogs",
|
||||
"weight": 133,
|
||||
"weight": 132,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12479,7 +12432,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMails",
|
||||
"weight": 139,
|
||||
"weight": 138,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12540,7 +12493,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMessaging",
|
||||
"weight": 140,
|
||||
"weight": 139,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12601,7 +12554,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMigrations",
|
||||
"weight": 141,
|
||||
"weight": 140,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12638,10 +12591,10 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage": {
|
||||
"\/health\/queue\/stats-resources": {
|
||||
"get": {
|
||||
"summary": "Get usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"summary": "Get stats resources queue",
|
||||
"operationId": "healthGetQueueStatsResources",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
|
|
@ -12651,7 +12604,7 @@
|
|||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
|
|
@ -12661,13 +12614,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"method": "getQueueStatsResources",
|
||||
"weight": 142,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md",
|
||||
"demo": "health\/get-queue-stats-resources.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-resources.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -12699,10 +12652,71 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage-dump": {
|
||||
"\/health\/queue\/stats-usage": {
|
||||
"get": {
|
||||
"summary": "Get stats usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
"produces": [
|
||||
"application\/json"
|
||||
],
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
"schema": {
|
||||
"$ref": "#\/definitions\/healthQueue"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "threshold",
|
||||
"description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"default": 5000,
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/stats-usage-dump": {
|
||||
"get": {
|
||||
"summary": "Get usage dump queue",
|
||||
"operationId": "healthGetQueueUsageDump",
|
||||
"operationId": "healthGetQueueStatsUsageDump",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
|
|
@ -12722,13 +12736,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsageDump",
|
||||
"method": "getQueueStatsUsageDump",
|
||||
"weight": 144,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage-dump.md",
|
||||
"demo": "health\/get-queue-stats-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage-dump.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -12784,7 +12798,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueWebhooks",
|
||||
"weight": 132,
|
||||
"weight": 131,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -12945,7 +12959,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getTime",
|
||||
"weight": 131,
|
||||
"weight": 130,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -18070,19 +18084,19 @@
|
|||
},
|
||||
"endpoint": {
|
||||
"type": "string",
|
||||
"description": "Source's Appwrite Endpoint",
|
||||
"description": "Source Appwrite endpoint",
|
||||
"default": null,
|
||||
"x-example": "https:\/\/example.com"
|
||||
},
|
||||
"projectId": {
|
||||
"type": "string",
|
||||
"description": "Source's Project ID",
|
||||
"description": "Source Project ID",
|
||||
"default": null,
|
||||
"x-example": "<PROJECT_ID>"
|
||||
},
|
||||
"apiKey": {
|
||||
"type": "string",
|
||||
"description": "Source's API Key",
|
||||
"description": "Source API Key",
|
||||
"default": null,
|
||||
"x-example": "<API_KEY>"
|
||||
}
|
||||
|
|
@ -36608,6 +36622,21 @@
|
|||
"$ref": "#\/definitions\/metric"
|
||||
},
|
||||
"x-example": []
|
||||
},
|
||||
"imageTransformations": {
|
||||
"type": "array",
|
||||
"description": "Aggregated number of files transformations per period.",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#\/definitions\/metric"
|
||||
},
|
||||
"x-example": []
|
||||
},
|
||||
"imageTransformationsTotal": {
|
||||
"type": "integer",
|
||||
"description": "Total aggregated number of files transformations.",
|
||||
"x-example": 0,
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -36615,7 +36644,9 @@
|
|||
"filesTotal",
|
||||
"filesStorageTotal",
|
||||
"files",
|
||||
"storage"
|
||||
"storage",
|
||||
"imageTransformations",
|
||||
"imageTransformationsTotal"
|
||||
]
|
||||
},
|
||||
"usageFunctions": {
|
||||
|
|
@ -37185,6 +37216,18 @@
|
|||
"$ref": "#\/definitions\/metric"
|
||||
},
|
||||
"x-example": []
|
||||
},
|
||||
"imageTransformationsTotal": {
|
||||
"type": "integer",
|
||||
"description": "An array of aggregated number of image transformations.",
|
||||
"x-example": 0,
|
||||
"format": "int32"
|
||||
},
|
||||
"imageTransformations": {
|
||||
"type": "integer",
|
||||
"description": "Total aggregated number of image transformations.",
|
||||
"x-example": 0,
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -37216,7 +37259,9 @@
|
|||
"authPhoneEstimate",
|
||||
"authPhoneCountryBreakdown",
|
||||
"databasesReads",
|
||||
"databasesWrites"
|
||||
"databasesWrites",
|
||||
"imageTransformationsTotal",
|
||||
"imageTransformations"
|
||||
]
|
||||
},
|
||||
"headers": {
|
||||
|
|
|
|||
|
|
@ -3261,7 +3261,7 @@
|
|||
"parameters": [
|
||||
{
|
||||
"name": "code",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.",
|
||||
"description": "Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"x-example": "amex",
|
||||
|
|
@ -3281,7 +3281,8 @@
|
|||
"union-china-pay",
|
||||
"visa",
|
||||
"mir",
|
||||
"maestro"
|
||||
"maestro",
|
||||
"rupay"
|
||||
],
|
||||
"x-enum-name": "CreditCard",
|
||||
"x-enum-keys": [
|
||||
|
|
@ -3300,7 +3301,8 @@
|
|||
"Union China Pay",
|
||||
"Visa",
|
||||
"MIR",
|
||||
"Maestro"
|
||||
"Maestro",
|
||||
"Rupay"
|
||||
],
|
||||
"in": "path"
|
||||
},
|
||||
|
|
@ -7552,7 +7554,7 @@
|
|||
"tags": [
|
||||
"databases"
|
||||
],
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.",
|
||||
"description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n",
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Document",
|
||||
|
|
@ -10689,7 +10691,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getCertificate",
|
||||
"weight": 134,
|
||||
"weight": 133,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10800,7 +10802,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getPubSub",
|
||||
"weight": 130,
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10827,57 +10829,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue": {
|
||||
"get": {
|
||||
"summary": "Get queue",
|
||||
"operationId": "healthGetQueue",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
"produces": [
|
||||
"application\/json"
|
||||
],
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Check the Appwrite queue messaging servers are up and connection is successful.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Status",
|
||||
"schema": {
|
||||
"$ref": "#\/definitions\/healthStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueue",
|
||||
"weight": 129,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/builds": {
|
||||
"get": {
|
||||
"summary": "Get builds queue",
|
||||
|
|
@ -10902,7 +10853,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueBuilds",
|
||||
"weight": 136,
|
||||
"weight": 135,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -10964,7 +10915,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueCertificates",
|
||||
"weight": 135,
|
||||
"weight": 134,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11026,7 +10977,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDatabases",
|
||||
"weight": 137,
|
||||
"weight": 136,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11097,7 +11048,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueDeletes",
|
||||
"weight": 138,
|
||||
"weight": 137,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11197,8 +11148,9 @@
|
|||
"v1-audits",
|
||||
"v1-mails",
|
||||
"v1-functions",
|
||||
"v1-usage",
|
||||
"v1-usage-dump",
|
||||
"v1-stats-resources",
|
||||
"v1-stats-usage",
|
||||
"v1-stats-usage-dump",
|
||||
"v1-webhooks",
|
||||
"v1-certificates",
|
||||
"v1-builds",
|
||||
|
|
@ -11245,7 +11197,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueFunctions",
|
||||
"weight": 142,
|
||||
"weight": 141,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11307,7 +11259,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueLogs",
|
||||
"weight": 133,
|
||||
"weight": 132,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11369,7 +11321,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMails",
|
||||
"weight": 139,
|
||||
"weight": 138,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11431,7 +11383,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMessaging",
|
||||
"weight": 140,
|
||||
"weight": 139,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11493,7 +11445,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueMigrations",
|
||||
"weight": 141,
|
||||
"weight": 140,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11531,10 +11483,10 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage": {
|
||||
"\/health\/queue\/stats-resources": {
|
||||
"get": {
|
||||
"summary": "Get usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"summary": "Get stats resources queue",
|
||||
"operationId": "healthGetQueueStatsResources",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
|
|
@ -11544,7 +11496,7 @@
|
|||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
|
|
@ -11554,13 +11506,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"method": "getQueueStatsResources",
|
||||
"weight": 142,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage.md",
|
||||
"demo": "health\/get-queue-stats-resources.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-resources.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -11593,10 +11545,72 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/usage-dump": {
|
||||
"\/health\/queue\/stats-usage": {
|
||||
"get": {
|
||||
"summary": "Get stats usage queue",
|
||||
"operationId": "healthGetQueueUsage",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
"produces": [
|
||||
"application\/json"
|
||||
],
|
||||
"tags": [
|
||||
"health"
|
||||
],
|
||||
"description": "Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Health Queue",
|
||||
"schema": {
|
||||
"$ref": "#\/definitions\/healthQueue"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsage",
|
||||
"weight": 143,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
"scope": "health.read",
|
||||
"platforms": [
|
||||
"server"
|
||||
],
|
||||
"packaging": false,
|
||||
"auth": {
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"Project": [],
|
||||
"Key": []
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "threshold",
|
||||
"description": "Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"default": 5000,
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"\/health\/queue\/stats-usage-dump": {
|
||||
"get": {
|
||||
"summary": "Get usage dump queue",
|
||||
"operationId": "healthGetQueueUsageDump",
|
||||
"operationId": "healthGetQueueStatsUsageDump",
|
||||
"consumes": [
|
||||
"application\/json"
|
||||
],
|
||||
|
|
@ -11616,13 +11630,13 @@
|
|||
}
|
||||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueUsageDump",
|
||||
"method": "getQueueStatsUsageDump",
|
||||
"weight": 144,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
"demo": "health\/get-queue-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-usage-dump.md",
|
||||
"demo": "health\/get-queue-stats-usage-dump.md",
|
||||
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/health\/get-queue-stats-usage-dump.md",
|
||||
"rate-limit": 0,
|
||||
"rate-time": 3600,
|
||||
"rate-key": "url:{url},ip:{ip}",
|
||||
|
|
@ -11679,7 +11693,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getQueueWebhooks",
|
||||
"weight": 132,
|
||||
"weight": 131,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
@ -11843,7 +11857,7 @@
|
|||
},
|
||||
"x-appwrite": {
|
||||
"method": "getTime",
|
||||
"weight": 131,
|
||||
"weight": 130,
|
||||
"cookies": false,
|
||||
"type": "",
|
||||
"deprecated": false,
|
||||
|
|
|
|||
|
|
@ -2400,7 +2400,7 @@ App::put('/v1/account/sessions/phone')
|
|||
App::post('/v1/account/tokens/phone')
|
||||
->alias('/v1/account/sessions/phone')
|
||||
->desc('Create phone token')
|
||||
->groups(['api', 'account'])
|
||||
->groups(['api', 'account', 'auth'])
|
||||
->label('scope', 'sessions.write')
|
||||
->label('auth.type', 'phone')
|
||||
->label('audits.event', 'session.create')
|
||||
|
|
|
|||
|
|
@ -243,8 +243,8 @@ function updateAttribute(
|
|||
string $filter = null,
|
||||
string|bool|int|float $default = null,
|
||||
bool $required = null,
|
||||
int|float $min = null,
|
||||
int|float $max = null,
|
||||
int|float|null $min = null,
|
||||
int|float|null $max = null,
|
||||
array $elements = null,
|
||||
array $options = [],
|
||||
string $newKey = null,
|
||||
|
|
@ -300,6 +300,9 @@ function updateAttribute(
|
|||
switch ($attribute->getAttribute('format')) {
|
||||
case APP_DATABASE_ATTRIBUTE_INT_RANGE:
|
||||
case APP_DATABASE_ATTRIBUTE_FLOAT_RANGE:
|
||||
$min ??= $attribute->getAttribute('formatOptions')['min'];
|
||||
$max ??= $attribute->getAttribute('formatOptions')['max'];
|
||||
|
||||
if ($min > $max) {
|
||||
throw new Exception(Exception::ATTRIBUTE_VALUE_INVALID, 'Minimum value must be lesser than maximum value');
|
||||
}
|
||||
|
|
@ -1560,8 +1563,8 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/intege
|
|||
->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?int $min, ?int $max, ?int $default, bool $array, Response $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents) {
|
||||
|
||||
// Ensure attribute default is within range
|
||||
$min = \is_null($min) ? PHP_INT_MIN : $min;
|
||||
$max = \is_null($max) ? PHP_INT_MAX : $max;
|
||||
$min ??= PHP_INT_MIN;
|
||||
$max ??= PHP_INT_MAX;
|
||||
|
||||
if ($min > $max) {
|
||||
throw new Exception(Exception::ATTRIBUTE_VALUE_INVALID, 'Minimum value must be lesser than maximum value');
|
||||
|
|
@ -1637,8 +1640,8 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/float'
|
|||
->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?float $min, ?float $max, ?float $default, bool $array, Response $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents) {
|
||||
|
||||
// Ensure attribute default is within range
|
||||
$min = \is_null($min) ? -PHP_FLOAT_MAX : $min;
|
||||
$max = \is_null($max) ? PHP_FLOAT_MAX : $max;
|
||||
$min ??= -PHP_FLOAT_MAX;
|
||||
$max ??= PHP_FLOAT_MAX;
|
||||
|
||||
if ($min > $max) {
|
||||
throw new Exception(Exception::ATTRIBUTE_VALUE_INVALID, 'Minimum value must be lesser than maximum value');
|
||||
|
|
@ -2349,8 +2352,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/integ
|
|||
->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).')
|
||||
->param('key', '', new Key(), 'Attribute Key.')
|
||||
->param('required', null, new Boolean(), 'Is attribute required?')
|
||||
->param('min', null, new Integer(), 'Minimum value to enforce on new documents')
|
||||
->param('max', null, new Integer(), 'Maximum value to enforce on new documents')
|
||||
->param('min', null, new Integer(), 'Minimum value to enforce on new documents', true)
|
||||
->param('max', null, new Integer(), 'Maximum value to enforce on new documents', true)
|
||||
->param('default', null, new Nullable(new Integer()), 'Default value for attribute when not provided. Cannot be set when attribute is required.')
|
||||
->param('newKey', null, new Key(), 'New attribute key.', true)
|
||||
->inject('response')
|
||||
|
|
@ -2408,8 +2411,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/float
|
|||
->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).')
|
||||
->param('key', '', new Key(), 'Attribute Key.')
|
||||
->param('required', null, new Boolean(), 'Is attribute required?')
|
||||
->param('min', null, new FloatValidator(), 'Minimum value to enforce on new documents')
|
||||
->param('max', null, new FloatValidator(), 'Maximum value to enforce on new documents')
|
||||
->param('min', null, new FloatValidator(), 'Minimum value to enforce on new documents', true)
|
||||
->param('max', null, new FloatValidator(), 'Maximum value to enforce on new documents', true)
|
||||
->param('default', null, new Nullable(new FloatValidator()), 'Default value for attribute when not provided. Cannot be set when attribute is required.')
|
||||
->param('newKey', null, new Key(), 'New attribute key.', true)
|
||||
->inject('response')
|
||||
|
|
|
|||
|
|
@ -40,14 +40,18 @@ App::get('/v1/project/usage')
|
|||
->param('endDate', '', new DateTimeValidator(), 'End date for the usage')
|
||||
->param('period', '1d', new WhiteList(['1h', '1d']), 'Period used', true)
|
||||
->inject('response')
|
||||
->inject('project')
|
||||
->inject('dbForProject')
|
||||
->inject('getLogsDB')
|
||||
->inject('smsRates')
|
||||
->action(function (string $startDate, string $endDate, string $period, Response $response, Database $dbForProject, array $smsRates) {
|
||||
->action(function (string $startDate, string $endDate, string $period, Response $response, Document $project, Database $dbForProject, callable $getLogsDB, array $smsRates) {
|
||||
$stats = $total = $usage = [];
|
||||
$format = 'Y-m-d 00:00:00';
|
||||
$firstDay = (new DateTime($startDate))->format($format);
|
||||
$lastDay = (new DateTime($endDate))->format($format);
|
||||
|
||||
$dbForLogs = call_user_func($getLogsDB, $project);
|
||||
|
||||
$metrics = [
|
||||
'total' => [
|
||||
METRIC_EXECUTIONS,
|
||||
|
|
@ -63,6 +67,7 @@ App::get('/v1/project/usage')
|
|||
METRIC_BUILDS_STORAGE,
|
||||
METRIC_DATABASES_OPERATIONS_READS,
|
||||
METRIC_DATABASES_OPERATIONS_WRITES,
|
||||
METRIC_FILES_IMAGES_TRANSFORMED,
|
||||
],
|
||||
'period' => [
|
||||
METRIC_NETWORK_REQUESTS,
|
||||
|
|
@ -75,6 +80,7 @@ App::get('/v1/project/usage')
|
|||
METRIC_BUILDS_MB_SECONDS,
|
||||
METRIC_DATABASES_OPERATIONS_READS,
|
||||
METRIC_DATABASES_OPERATIONS_WRITES,
|
||||
METRIC_FILES_IMAGES_TRANSFORMED,
|
||||
]
|
||||
];
|
||||
|
||||
|
|
@ -93,9 +99,11 @@ App::get('/v1/project/usage')
|
|||
'1d' => 'Y-m-d\T00:00:00.000P',
|
||||
};
|
||||
|
||||
Authorization::skip(function () use ($dbForProject, $firstDay, $lastDay, $period, $metrics, $limit, &$total, &$stats) {
|
||||
Authorization::skip(function () use ($dbForProject, $dbForLogs, $firstDay, $lastDay, $period, $metrics, $limit, &$total, &$stats) {
|
||||
foreach ($metrics['total'] as $metric) {
|
||||
$result = $dbForProject->findOne('stats', [
|
||||
$db = ($metric === METRIC_FILES_IMAGES_TRANSFORMED) ? $dbForLogs : $dbForProject;
|
||||
|
||||
$result = $db->findOne('stats', [
|
||||
Query::equal('metric', [$metric]),
|
||||
Query::equal('period', ['inf'])
|
||||
]);
|
||||
|
|
@ -103,7 +111,9 @@ App::get('/v1/project/usage')
|
|||
}
|
||||
|
||||
foreach ($metrics['period'] as $metric) {
|
||||
$results = $dbForProject->find('stats', [
|
||||
$db = ($metric === METRIC_FILES_IMAGES_TRANSFORMED) ? $dbForLogs : $dbForProject;
|
||||
|
||||
$results = $db->find('stats', [
|
||||
Query::equal('metric', [$metric]),
|
||||
Query::equal('period', [$period]),
|
||||
Query::greaterThanEqual('time', $firstDay),
|
||||
|
|
@ -363,6 +373,8 @@ App::get('/v1/project/usage')
|
|||
'authPhoneTotal' => $authPhoneTotal,
|
||||
'authPhoneEstimate' => $authPhoneEstimate,
|
||||
'authPhoneCountryBreakdown' => $authPhoneCountryBreakdown,
|
||||
'imageTransformations' => $usage[METRIC_FILES_IMAGES_TRANSFORMED],
|
||||
'imageTransformationsTotal' => $total[METRIC_FILES_IMAGES_TRANSFORMED],
|
||||
]), Response::MODEL_USAGE_PROJECT);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -934,14 +934,11 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
|
|||
->param('rotation', 0, new Range(-360, 360), 'Preview image rotation in degrees. Pass an integer between -360 and 360.', true)
|
||||
->param('background', '', new HexColor(), 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true)
|
||||
->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true)
|
||||
->inject('request')
|
||||
->inject('response')
|
||||
->inject('project')
|
||||
->inject('dbForProject')
|
||||
->inject('mode')
|
||||
->inject('deviceForFiles')
|
||||
->inject('deviceForLocal')
|
||||
->action(function (string $bucketId, string $fileId, int $width, int $height, string $gravity, int $quality, int $borderWidth, string $borderColor, int $borderRadius, float $opacity, int $rotation, string $background, string $output, Request $request, Response $response, Document $project, Database $dbForProject, string $mode, Device $deviceForFiles, Device $deviceForLocal) {
|
||||
->action(function (string $bucketId, string $fileId, int $width, int $height, string $gravity, int $quality, int $borderWidth, string $borderColor, int $borderRadius, float $opacity, int $rotation, string $background, string $output, Response $response, Database $dbForProject, Device $deviceForFiles, Device $deviceForLocal) {
|
||||
|
||||
if (!\extension_loaded('imagick')) {
|
||||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Imagick extension is missing');
|
||||
|
|
@ -1081,8 +1078,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
|
|||
$response
|
||||
->addHeader('Cache-Control', 'private, max-age=2592000') // 30 days
|
||||
->setContentType($contentType)
|
||||
->file($data)
|
||||
;
|
||||
->file($data);
|
||||
|
||||
unset($image);
|
||||
});
|
||||
|
|
@ -1875,9 +1871,12 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
->param('bucketId', '', new UID(), 'Bucket ID.')
|
||||
->param('range', '30d', new WhiteList(['24h', '30d', '90d'], true), 'Date range.', true)
|
||||
->inject('response')
|
||||
->inject('project')
|
||||
->inject('dbForProject')
|
||||
->action(function (string $bucketId, string $range, Response $response, Database $dbForProject) {
|
||||
->inject('getLogsDB')
|
||||
->action(function (string $bucketId, string $range, Response $response, Document $project, Database $dbForProject, callable $getLogsDB) {
|
||||
|
||||
$dbForLogs = call_user_func($getLogsDB, $project);
|
||||
$bucket = $dbForProject->getDocument('buckets', $bucketId);
|
||||
|
||||
if ($bucket->isEmpty()) {
|
||||
|
|
@ -1890,12 +1889,16 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
$metrics = [
|
||||
str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES),
|
||||
str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES_STORAGE),
|
||||
str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED),
|
||||
];
|
||||
|
||||
|
||||
Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats, &$total) {
|
||||
Authorization::skip(function () use ($dbForProject, $dbForLogs, $bucket, $days, $metrics, &$stats) {
|
||||
foreach ($metrics as $metric) {
|
||||
$result = $dbForProject->findOne('stats', [
|
||||
$db = ($metric === str_replace('{bucketInternalId}', $bucket->getInternalId(), METRIC_BUCKET_ID_FILES_IMAGES_TRANSFORMED))
|
||||
? $dbForLogs
|
||||
: $dbForProject;
|
||||
|
||||
$result = $db->findOne('stats', [
|
||||
Query::equal('metric', [$metric]),
|
||||
Query::equal('period', ['inf'])
|
||||
]);
|
||||
|
|
@ -1903,7 +1906,7 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
$stats[$metric]['total'] = $result['value'] ?? 0;
|
||||
$limit = $days['limit'];
|
||||
$period = $days['period'];
|
||||
$results = $dbForProject->find('stats', [
|
||||
$results = $db->find('stats', [
|
||||
Query::equal('metric', [$metric]),
|
||||
Query::equal('period', [$period]),
|
||||
Query::limit($limit),
|
||||
|
|
@ -1944,5 +1947,7 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
'filesStorageTotal' => $usage[$metrics[1]]['total'],
|
||||
'files' => $usage[$metrics[0]]['data'],
|
||||
'storage' => $usage[$metrics[1]]['data'],
|
||||
'imageTransformations' => $usage[$metrics[2]]['data'],
|
||||
'imageTransformationsTotal' => $usage[$metrics[2]]['total'],
|
||||
]), Response::MODEL_USAGE_BUCKETS);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -859,11 +859,9 @@ App::error()
|
|||
$publish = $error->getCode() === 0 || $error->getCode() >= 500;
|
||||
}
|
||||
|
||||
if ($error->getCode() >= 400 && $error->getCode() < 500) {
|
||||
$providerConfig = System::getEnv('_APP_EXPERIMENT_LOGGING_CONFIG', '');
|
||||
if (!empty($providerConfig) && $error->getCode() >= 400 && $error->getCode() < 500) {
|
||||
// Register error logger
|
||||
$providerName = System::getEnv('_APP_EXPERIMENT_LOGGING_PROVIDER', '');
|
||||
$providerConfig = System::getEnv('_APP_EXPERIMENT_LOGGING_CONFIG', '');
|
||||
|
||||
try {
|
||||
$loggingProvider = new DSN($providerConfig ?? '');
|
||||
$providerName = $loggingProvider->getScheme();
|
||||
|
|
|
|||
45
app/init.php
45
app/init.php
|
|
@ -347,6 +347,7 @@ Config::load('apis', __DIR__ . '/config/apis.php'); // List of APIs
|
|||
Config::load('errors', __DIR__ . '/config/errors.php');
|
||||
Config::load('oAuthProviders', __DIR__ . '/config/oAuthProviders.php');
|
||||
Config::load('platforms', __DIR__ . '/config/platforms.php');
|
||||
Config::load('console', __DIR__ . '/config/console.php');
|
||||
Config::load('collections', __DIR__ . '/config/collections.php');
|
||||
Config::load('runtimes', __DIR__ . '/config/runtimes.php');
|
||||
Config::load('runtimes-v2', __DIR__ . '/config/runtimes-v2.php');
|
||||
|
|
@ -817,6 +818,10 @@ $register->set('logger', function () {
|
|||
$providerName = System::getEnv('_APP_LOGGING_PROVIDER', '');
|
||||
$providerConfig = System::getEnv('_APP_LOGGING_CONFIG', '');
|
||||
|
||||
if (empty($providerConfig)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$loggingProvider = new DSN($providerConfig ?? '');
|
||||
|
||||
|
|
@ -1404,45 +1409,7 @@ App::setResource('session', function (Document $user) {
|
|||
}, ['user']);
|
||||
|
||||
App::setResource('console', function () {
|
||||
return new Document([
|
||||
'$id' => ID::custom('console'),
|
||||
'$internalId' => ID::custom('console'),
|
||||
'name' => 'Appwrite',
|
||||
'$collection' => ID::custom('projects'),
|
||||
'description' => 'Appwrite core engine',
|
||||
'logo' => '',
|
||||
'teamId' => null,
|
||||
'webhooks' => [],
|
||||
'keys' => [],
|
||||
'platforms' => [
|
||||
[
|
||||
'$collection' => ID::custom('platforms'),
|
||||
'name' => 'Localhost',
|
||||
'type' => Origin::CLIENT_TYPE_WEB,
|
||||
'hostname' => 'localhost',
|
||||
], // Current host is added on app init
|
||||
],
|
||||
'legalName' => '',
|
||||
'legalCountry' => '',
|
||||
'legalState' => '',
|
||||
'legalCity' => '',
|
||||
'legalAddress' => '',
|
||||
'legalTaxId' => '',
|
||||
'auths' => [
|
||||
'mockNumbers' => [],
|
||||
'invites' => System::getEnv('_APP_CONSOLE_INVITES', 'enabled') === 'enabled',
|
||||
'limit' => (System::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user
|
||||
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG, // 1 Year in seconds
|
||||
'sessionAlerts' => System::getEnv('_APP_CONSOLE_SESSION_ALERTS', 'disabled') === 'enabled'
|
||||
],
|
||||
'authWhitelistEmails' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [],
|
||||
'authWhitelistIPs' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_IPS', null)) : [],
|
||||
'oAuthProviders' => [
|
||||
'githubEnabled' => true,
|
||||
'githubSecret' => System::getEnv('_APP_CONSOLE_GITHUB_SECRET', ''),
|
||||
'githubAppid' => System::getEnv('_APP_CONSOLE_GITHUB_APP_ID', '')
|
||||
],
|
||||
]);
|
||||
return new Document(Config::getParam('console'));
|
||||
}, []);
|
||||
|
||||
App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform, Cache $cache, Document $project) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
"utopia-php/abuse": "0.51.*",
|
||||
"utopia-php/analytics": "0.10.*",
|
||||
"utopia-php/audit": "0.54.0",
|
||||
"utopia-php/cache": "0.11.*",
|
||||
"utopia-php/cache": "0.12.*",
|
||||
"utopia-php/cli": "0.15.*",
|
||||
"utopia-php/config": "0.2.*",
|
||||
"utopia-php/database": "0.60.*",
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
"utopia-php/swoole": "0.8.*",
|
||||
"utopia-php/system": "0.9.*",
|
||||
"utopia-php/telemetry": "0.1.*",
|
||||
"utopia-php/vcs": "0.8.*",
|
||||
"utopia-php/vcs": "0.9.*",
|
||||
"utopia-php/websocket": "0.1.*",
|
||||
"matomo/device-detector": "6.1.*",
|
||||
"dragonmantank/cron-expression": "3.3.2",
|
||||
|
|
|
|||
221
composer.lock
generated
221
composer.lock
generated
|
|
@ -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": "d7e31cf9078e9fb785aa196e5575cf74",
|
||||
"content-hash": "58ad2e1375ec47d944b96864d4aae63f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
|
|
@ -279,16 +279,16 @@
|
|||
},
|
||||
{
|
||||
"name": "brick/math",
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/brick/math.git",
|
||||
"reference": "f510c0a40911935b77b86859eb5223d58d660df1"
|
||||
"reference": "866551da34e9a618e64a819ee1e01c20d8a588ba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/brick/math/zipball/f510c0a40911935b77b86859eb5223d58d660df1",
|
||||
"reference": "f510c0a40911935b77b86859eb5223d58d660df1",
|
||||
"url": "https://api.github.com/repos/brick/math/zipball/866551da34e9a618e64a819ee1e01c20d8a588ba",
|
||||
"reference": "866551da34e9a618e64a819ee1e01c20d8a588ba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -297,7 +297,7 @@
|
|||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.2",
|
||||
"phpunit/phpunit": "^10.1",
|
||||
"vimeo/psalm": "5.16.0"
|
||||
"vimeo/psalm": "6.8.8"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
|
|
@ -327,7 +327,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/brick/math/issues",
|
||||
"source": "https://github.com/brick/math/tree/0.12.1"
|
||||
"source": "https://github.com/brick/math/tree/0.12.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -335,7 +335,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-29T23:19:16+00:00"
|
||||
"time": "2025-02-28T13:11:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "chillerlan/php-qrcode",
|
||||
|
|
@ -709,16 +709,16 @@
|
|||
},
|
||||
{
|
||||
"name": "google/protobuf",
|
||||
"version": "v4.29.3",
|
||||
"version": "v4.30.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/protocolbuffers/protobuf-php.git",
|
||||
"reference": "ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7"
|
||||
"reference": "e1d66682f6836aa87820400f0aa07d9eb566feb6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7",
|
||||
"reference": "ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7",
|
||||
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/e1d66682f6836aa87820400f0aa07d9eb566feb6",
|
||||
"reference": "e1d66682f6836aa87820400f0aa07d9eb566feb6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -747,9 +747,9 @@
|
|||
"proto"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.29.3"
|
||||
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.0"
|
||||
},
|
||||
"time": "2025-01-08T21:00:13+00:00"
|
||||
"time": "2025-03-04T22:54:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "jean85/pretty-package-versions",
|
||||
|
|
@ -1237,16 +1237,16 @@
|
|||
},
|
||||
{
|
||||
"name": "open-telemetry/api",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/opentelemetry-php/api.git",
|
||||
"reference": "8b925df3047628968bc5be722468db1b98b82d51"
|
||||
"reference": "199d7ddda88f5f5619fa73463f1a5a7149ccd1f1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/opentelemetry-php/api/zipball/8b925df3047628968bc5be722468db1b98b82d51",
|
||||
"reference": "8b925df3047628968bc5be722468db1b98b82d51",
|
||||
"url": "https://api.github.com/repos/opentelemetry-php/api/zipball/199d7ddda88f5f5619fa73463f1a5a7149ccd1f1",
|
||||
"reference": "199d7ddda88f5f5619fa73463f1a5a7149ccd1f1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -1303,7 +1303,7 @@
|
|||
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
|
||||
"source": "https://github.com/open-telemetry/opentelemetry-php"
|
||||
},
|
||||
"time": "2025-02-03T21:49:11+00:00"
|
||||
"time": "2025-03-05T21:42:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "open-telemetry/context",
|
||||
|
|
@ -1366,16 +1366,16 @@
|
|||
},
|
||||
{
|
||||
"name": "open-telemetry/exporter-otlp",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/opentelemetry-php/exporter-otlp.git",
|
||||
"reference": "243d9657c44a06f740cf384f486afe954c2b725f"
|
||||
"reference": "b7580440b7481a98da97aceabeb46e1b276c8747"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/243d9657c44a06f740cf384f486afe954c2b725f",
|
||||
"reference": "243d9657c44a06f740cf384f486afe954c2b725f",
|
||||
"url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/b7580440b7481a98da97aceabeb46e1b276c8747",
|
||||
"reference": "b7580440b7481a98da97aceabeb46e1b276c8747",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -1426,7 +1426,7 @@
|
|||
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
|
||||
"source": "https://github.com/open-telemetry/opentelemetry-php"
|
||||
},
|
||||
"time": "2025-01-08T23:50:03+00:00"
|
||||
"time": "2025-03-06T23:21:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "open-telemetry/gen-otlp-protobuf",
|
||||
|
|
@ -2371,16 +2371,16 @@
|
|||
},
|
||||
{
|
||||
"name": "ramsey/collection",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ramsey/collection.git",
|
||||
"reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5"
|
||||
"reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5",
|
||||
"reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5",
|
||||
"url": "https://api.github.com/repos/ramsey/collection/zipball/3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109",
|
||||
"reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -2388,25 +2388,22 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"captainhook/plugin-composer": "^5.3",
|
||||
"ergebnis/composer-normalize": "^2.28.3",
|
||||
"fakerphp/faker": "^1.21",
|
||||
"ergebnis/composer-normalize": "^2.45",
|
||||
"fakerphp/faker": "^1.24",
|
||||
"hamcrest/hamcrest-php": "^2.0",
|
||||
"jangregor/phpstan-prophecy": "^1.0",
|
||||
"mockery/mockery": "^1.5",
|
||||
"jangregor/phpstan-prophecy": "^2.1",
|
||||
"mockery/mockery": "^1.6",
|
||||
"php-parallel-lint/php-console-highlighter": "^1.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.3",
|
||||
"phpcsstandards/phpcsutils": "^1.0.0-rc1",
|
||||
"phpspec/prophecy-phpunit": "^2.0",
|
||||
"phpstan/extension-installer": "^1.2",
|
||||
"phpstan/phpstan": "^1.9",
|
||||
"phpstan/phpstan-mockery": "^1.1",
|
||||
"phpstan/phpstan-phpunit": "^1.3",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"psalm/plugin-mockery": "^1.1",
|
||||
"psalm/plugin-phpunit": "^0.18.4",
|
||||
"ramsey/coding-standard": "^2.0.3",
|
||||
"ramsey/conventional-commits": "^1.3",
|
||||
"vimeo/psalm": "^5.4"
|
||||
"php-parallel-lint/php-parallel-lint": "^1.4",
|
||||
"phpspec/prophecy-phpunit": "^2.3",
|
||||
"phpstan/extension-installer": "^1.4",
|
||||
"phpstan/phpstan": "^2.1",
|
||||
"phpstan/phpstan-mockery": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"ramsey/coding-standard": "^2.3",
|
||||
"ramsey/conventional-commits": "^1.6",
|
||||
"roave/security-advisories": "dev-latest"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
|
@ -2444,19 +2441,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ramsey/collection/issues",
|
||||
"source": "https://github.com/ramsey/collection/tree/2.0.0"
|
||||
"source": "https://github.com/ramsey/collection/tree/2.1.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/ramsey",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/ramsey/collection",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-12-31T21:50:55+00:00"
|
||||
"time": "2025-03-02T04:48:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
|
|
@ -2694,16 +2681,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/http-client",
|
||||
"version": "v7.2.3",
|
||||
"version": "v7.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-client.git",
|
||||
"reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d"
|
||||
"reference": "78981a2ffef6437ed92d4d7e2a86a82f256c6dc6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-client/zipball/7ce6078c79a4a7afff931c413d2959d3bffbfb8d",
|
||||
"reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d",
|
||||
"url": "https://api.github.com/repos/symfony/http-client/zipball/78981a2ffef6437ed92d4d7e2a86a82f256c6dc6",
|
||||
"reference": "78981a2ffef6437ed92d4d7e2a86a82f256c6dc6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -2769,7 +2756,7 @@
|
|||
"http"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-client/tree/v7.2.3"
|
||||
"source": "https://github.com/symfony/http-client/tree/v7.2.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -2785,7 +2772,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-01-28T15:51:35+00:00"
|
||||
"time": "2025-02-13T10:27:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-client-contracts",
|
||||
|
|
@ -3521,23 +3508,24 @@
|
|||
},
|
||||
{
|
||||
"name": "utopia-php/cache",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/cache.git",
|
||||
"reference": "8ebcab5aac7606331cef69b0081f6c9eff2e58bc"
|
||||
"reference": "646038f1d470b759c129348be8fc14da3c00bbd9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/cache/zipball/8ebcab5aac7606331cef69b0081f6c9eff2e58bc",
|
||||
"reference": "8ebcab5aac7606331cef69b0081f6c9eff2e58bc",
|
||||
"url": "https://api.github.com/repos/utopia-php/cache/zipball/646038f1d470b759c129348be8fc14da3c00bbd9",
|
||||
"reference": "646038f1d470b759c129348be8fc14da3c00bbd9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"ext-memcached": "*",
|
||||
"ext-redis": "*",
|
||||
"php": ">=8.0"
|
||||
"php": ">=8.0",
|
||||
"utopia-php/telemetry": "0.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/pint": "1.2.*",
|
||||
|
|
@ -3565,9 +3553,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/cache/issues",
|
||||
"source": "https://github.com/utopia-php/cache/tree/0.11.0"
|
||||
"source": "https://github.com/utopia-php/cache/tree/0.12.0"
|
||||
},
|
||||
"time": "2024-11-05T16:53:58+00:00"
|
||||
"time": "2025-02-25T09:09:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/cli",
|
||||
|
|
@ -3717,23 +3705,23 @@
|
|||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "0.60.3",
|
||||
"version": "0.60.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "c4bc4af3f09a91aea76aac75b4b78fa06598c61d"
|
||||
"reference": "f3c9aa964b39c6205069f038a26e709a15541406"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/c4bc4af3f09a91aea76aac75b4b78fa06598c61d",
|
||||
"reference": "c4bc4af3f09a91aea76aac75b4b78fa06598c61d",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/f3c9aa964b39c6205069f038a26e709a15541406",
|
||||
"reference": "f3c9aa964b39c6205069f038a26e709a15541406",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"ext-pdo": "*",
|
||||
"php": ">=8.1",
|
||||
"utopia-php/cache": "0.11.*",
|
||||
"utopia-php/cache": "0.12.*",
|
||||
"utopia-php/framework": "0.33.*",
|
||||
"utopia-php/mongo": "0.3.*"
|
||||
},
|
||||
|
|
@ -3767,9 +3755,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/0.60.3"
|
||||
"source": "https://github.com/utopia-php/database/tree/0.60.6"
|
||||
},
|
||||
"time": "2025-02-17T12:46:59+00:00"
|
||||
"time": "2025-03-05T01:23:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/domains",
|
||||
|
|
@ -3880,16 +3868,16 @@
|
|||
},
|
||||
{
|
||||
"name": "utopia-php/fetch",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/fetch.git",
|
||||
"reference": "02b12c05aec13399dcc2da8d51f908e328ab63f4"
|
||||
"reference": "524dd50afa8c64670c4fb18f1df4db9b5bb4b3d0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/fetch/zipball/02b12c05aec13399dcc2da8d51f908e328ab63f4",
|
||||
"reference": "02b12c05aec13399dcc2da8d51f908e328ab63f4",
|
||||
"url": "https://api.github.com/repos/utopia-php/fetch/zipball/524dd50afa8c64670c4fb18f1df4db9b5bb4b3d0",
|
||||
"reference": "524dd50afa8c64670c4fb18f1df4db9b5bb4b3d0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -3913,22 +3901,22 @@
|
|||
"description": "A simple library that provides an interface for making HTTP Requests.",
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/fetch/issues",
|
||||
"source": "https://github.com/utopia-php/fetch/tree/0.3.0"
|
||||
"source": "https://github.com/utopia-php/fetch/tree/0.3.1"
|
||||
},
|
||||
"time": "2025-01-17T06:11:10+00:00"
|
||||
"time": "2025-03-05T18:08:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/framework",
|
||||
"version": "0.33.17",
|
||||
"version": "0.33.19",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/http.git",
|
||||
"reference": "73fac6fbce9f56282dba4e52a58cf836ec434644"
|
||||
"reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/http/zipball/73fac6fbce9f56282dba4e52a58cf836ec434644",
|
||||
"reference": "73fac6fbce9f56282dba4e52a58cf836ec434644",
|
||||
"url": "https://api.github.com/repos/utopia-php/http/zipball/64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0",
|
||||
"reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -3960,9 +3948,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/http/issues",
|
||||
"source": "https://github.com/utopia-php/http/tree/0.33.17"
|
||||
"source": "https://github.com/utopia-php/http/tree/0.33.19"
|
||||
},
|
||||
"time": "2025-02-24T17:35:48+00:00"
|
||||
"time": "2025-03-06T11:37:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/image",
|
||||
|
|
@ -4608,22 +4596,24 @@
|
|||
},
|
||||
{
|
||||
"name": "utopia-php/storage",
|
||||
"version": "0.18.9",
|
||||
"version": "0.18.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/storage.git",
|
||||
"reference": "1cf455404e8700b3093fd73d74a38d41cdced90c"
|
||||
"reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/storage/zipball/1cf455404e8700b3093fd73d74a38d41cdced90c",
|
||||
"reference": "1cf455404e8700b3093fd73d74a38d41cdced90c",
|
||||
"url": "https://api.github.com/repos/utopia-php/storage/zipball/76f31158f4251abb207f7a9b16f7cb0bfdb3b39e",
|
||||
"reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-brotli": "*",
|
||||
"ext-curl": "*",
|
||||
"ext-fileinfo": "*",
|
||||
"ext-lz4": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-snappy": "*",
|
||||
"ext-xz": "*",
|
||||
"ext-zlib": "*",
|
||||
|
|
@ -4657,9 +4647,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/storage/issues",
|
||||
"source": "https://github.com/utopia-php/storage/tree/0.18.9"
|
||||
"source": "https://github.com/utopia-php/storage/tree/0.18.10"
|
||||
},
|
||||
"time": "2025-02-11T13:10:40+00:00"
|
||||
"time": "2025-03-03T10:47:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/swoole",
|
||||
|
|
@ -4820,23 +4810,24 @@
|
|||
},
|
||||
{
|
||||
"name": "utopia-php/vcs",
|
||||
"version": "0.8.6",
|
||||
"version": "0.9.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/vcs.git",
|
||||
"reference": "b10225f54d5670f09f83e82e09de9d820ada6931"
|
||||
"reference": "865a00c67e81a20938b883f9aa802303790dd3b5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/vcs/zipball/b10225f54d5670f09f83e82e09de9d820ada6931",
|
||||
"reference": "b10225f54d5670f09f83e82e09de9d820ada6931",
|
||||
"url": "https://api.github.com/repos/utopia-php/vcs/zipball/865a00c67e81a20938b883f9aa802303790dd3b5",
|
||||
"reference": "865a00c67e81a20938b883f9aa802303790dd3b5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"adhocore/jwt": "^1.1",
|
||||
"php": ">=8.0",
|
||||
"utopia-php/cache": "^0.11.0",
|
||||
"utopia-php/framework": "0.*.*"
|
||||
"utopia-php/cache": "0.12.*",
|
||||
"utopia-php/framework": "0.*.*",
|
||||
"utopia-php/system": "0.9.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/pint": "1.2.*",
|
||||
|
|
@ -4863,9 +4854,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/vcs/issues",
|
||||
"source": "https://github.com/utopia-php/vcs/tree/0.8.6"
|
||||
"source": "https://github.com/utopia-php/vcs/tree/0.9.3"
|
||||
},
|
||||
"time": "2024-12-10T13:13:23+00:00"
|
||||
"time": "2025-02-26T16:33:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/websocket",
|
||||
|
|
@ -5052,16 +5043,16 @@
|
|||
"packages-dev": [
|
||||
{
|
||||
"name": "appwrite/sdk-generator",
|
||||
"version": "0.40.0",
|
||||
"version": "0.40.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||
"reference": "d2880132c900f64108d3e4484a6c1ed1bed2303c"
|
||||
"reference": "56f09482d9e2f223911277ab887f197402708049"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d2880132c900f64108d3e4484a6c1ed1bed2303c",
|
||||
"reference": "d2880132c900f64108d3e4484a6c1ed1bed2303c",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/56f09482d9e2f223911277ab887f197402708049",
|
||||
"reference": "56f09482d9e2f223911277ab887f197402708049",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -5097,9 +5088,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.40.0"
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/0.40.2"
|
||||
},
|
||||
"time": "2025-02-04T12:47:33+00:00"
|
||||
"time": "2025-03-06T16:31:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
|
|
@ -8035,16 +8026,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v7.2.0",
|
||||
"version": "v7.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e"
|
||||
"reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
|
||||
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf",
|
||||
"reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -8076,7 +8067,7 @@
|
|||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/v7.2.0"
|
||||
"source": "https://github.com/symfony/process/tree/v7.2.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -8092,7 +8083,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-06T14:24:19+00:00"
|
||||
"time": "2025-02-05T08:33:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@ class Maintenance extends Action
|
|||
$this
|
||||
->desc('Schedules maintenance tasks and publishes them to our queues')
|
||||
->inject('dbForPlatform')
|
||||
->inject('console')
|
||||
->inject('queueForCertificates')
|
||||
->inject('queueForDeletes')
|
||||
->callback(fn (Database $dbForPlatform, Certificate $queueForCertificates, Delete $queueForDeletes) => $this->action($dbForPlatform, $queueForCertificates, $queueForDeletes));
|
||||
->callback(fn (Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes) => $this->action($dbForPlatform, $console, $queueForCertificates, $queueForDeletes));
|
||||
}
|
||||
|
||||
public function action(Database $dbForPlatform, Certificate $queueForCertificates, Delete $queueForDeletes): void
|
||||
public function action(Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes): void
|
||||
{
|
||||
Console::title('Maintenance V1');
|
||||
Console::success(APP_NAME . ' maintenance process v1 has started');
|
||||
|
|
@ -41,7 +42,7 @@ class Maintenance extends Action
|
|||
$cacheRetention = (int) System::getEnv('_APP_MAINTENANCE_RETENTION_CACHE', '2592000'); // 30 days
|
||||
$schedulesDeletionRetention = (int) System::getEnv('_APP_MAINTENANCE_RETENTION_SCHEDULES', '86400'); // 1 Day
|
||||
|
||||
Console::loop(function () use ($interval, $cacheRetention, $schedulesDeletionRetention, $usageStatsRetentionHourly, $dbForPlatform, $queueForDeletes, $queueForCertificates) {
|
||||
Console::loop(function () use ($interval, $cacheRetention, $schedulesDeletionRetention, $usageStatsRetentionHourly, $dbForPlatform, $console, $queueForDeletes, $queueForCertificates) {
|
||||
$time = DateTime::now();
|
||||
|
||||
Console::info("[{$time}] Notifying workers with maintenance tasks every {$interval} seconds");
|
||||
|
|
@ -52,9 +53,14 @@ class Maintenance extends Action
|
|||
->setProject($project)
|
||||
->setUsageRetentionHourlyDateTime(DateTime::addSeconds(new \DateTime(), -1 * $usageStatsRetentionHourly))
|
||||
->trigger();
|
||||
|
||||
});
|
||||
|
||||
$queueForDeletes
|
||||
->setType(DELETE_TYPE_MAINTENANCE)
|
||||
->setProject($console)
|
||||
->setUsageRetentionHourlyDateTime(DateTime::addSeconds(new \DateTime(), -1 * $usageStatsRetentionHourly))
|
||||
->trigger();
|
||||
|
||||
$this->notifyDeleteConnections($queueForDeletes);
|
||||
$this->renewCertificates($dbForPlatform, $queueForCertificates);
|
||||
$this->notifyDeleteCache($cacheRetention, $queueForDeletes);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Exception;
|
|||
use Throwable;
|
||||
use Utopia\Audit\Audit;
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Database\Exception\Authorization;
|
||||
use Utopia\Database\Exception\Structure;
|
||||
|
|
@ -17,15 +16,16 @@ use Utopia\System\System;
|
|||
|
||||
class Audits extends Action
|
||||
{
|
||||
private const BATCH_SIZE_DEVELOPMENT = 1; // smaller batch size for development
|
||||
private const BATCH_SIZE_PRODUCTION = 5_000;
|
||||
private const BATCH_AGGREGATION_INTERVAL = 60; // in seconds
|
||||
protected const BATCH_SIZE_DEVELOPMENT = 1; // smaller batch size for development
|
||||
protected const BATCH_SIZE_PRODUCTION = 5_000;
|
||||
protected const BATCH_AGGREGATION_INTERVAL = 60; // in seconds
|
||||
|
||||
private int $lastTriggeredTime = 0;
|
||||
|
||||
private array $logs = [];
|
||||
|
||||
private function getBatchSize(): int
|
||||
|
||||
protected function getBatchSize(): int
|
||||
{
|
||||
return System::getEnv('_APP_ENV', 'development') === 'development'
|
||||
? self::BATCH_SIZE_DEVELOPMENT
|
||||
|
|
@ -101,7 +101,7 @@ class Audits extends Action
|
|||
'mode' => $mode,
|
||||
'data' => $auditPayload,
|
||||
],
|
||||
'timestamp' => DateTime::formatTz(DateTime::now())
|
||||
'timestamp' => date("Y-m-d H:i:s", $message->getTimestamp()),
|
||||
];
|
||||
|
||||
if (isset($this->logs[$project->getInternalId()])) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Deletes extends Action
|
|||
->inject('project')
|
||||
->inject('dbForPlatform')
|
||||
->inject('getProjectDB')
|
||||
->inject('timelimit')
|
||||
->inject('getLogsDB')
|
||||
->inject('deviceForFiles')
|
||||
->inject('deviceForFunctions')
|
||||
->inject('deviceForBuilds')
|
||||
|
|
@ -57,8 +57,8 @@ class Deletes extends Action
|
|||
->inject('auditRetention')
|
||||
->inject('log')
|
||||
->callback(
|
||||
fn ($message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $timelimit, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, string $auditRetention, Log $log) =>
|
||||
$this->action($message, $project, $dbForPlatform, $getProjectDB, $timelimit, $deviceForFiles, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $executionRetention, $auditRetention, $log)
|
||||
fn ($message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, string $auditRetention, Log $log) =>
|
||||
$this->action($message, $project, $dbForPlatform, $getProjectDB, $getLogsDB, $deviceForFiles, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $executionRetention, $auditRetention, $log)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class Deletes extends Action
|
|||
* @throws Exception
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function action(Message $message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $timelimit, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, string $auditRetention, Log $log): void
|
||||
public function action(Message $message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, string $executionRetention, string $auditRetention, Log $log): void
|
||||
{
|
||||
$payload = $message->getPayload() ?? [];
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ class Deletes extends Action
|
|||
$this->deleteExpiredSessions($project, $getProjectDB);
|
||||
break;
|
||||
case DELETE_TYPE_USAGE:
|
||||
$this->deleteUsageStats($project, $getProjectDB, $hourlyUsageRetentionDatetime);
|
||||
$this->deleteUsageStats($project, $getProjectDB, $getLogsDB, $hourlyUsageRetentionDatetime);
|
||||
break;
|
||||
case DELETE_TYPE_CACHE_BY_RESOURCE:
|
||||
$this->deleteCacheByResource($project, $getProjectDB, $resource, $resourceType);
|
||||
|
|
@ -158,7 +158,7 @@ class Deletes extends Action
|
|||
$this->deleteExpiredTargets($project, $getProjectDB);
|
||||
$this->deleteExecutionLogs($project, $getProjectDB, $executionRetention);
|
||||
$this->deleteAuditLogs($project, $getProjectDB, $auditRetention);
|
||||
$this->deleteUsageStats($project, $getProjectDB, $hourlyUsageRetentionDatetime);
|
||||
$this->deleteUsageStats($project, $getProjectDB, $getLogsDB, $hourlyUsageRetentionDatetime);
|
||||
$this->deleteExpiredSessions($project, $getProjectDB);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -412,14 +412,22 @@ class Deletes extends Action
|
|||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
private function deleteUsageStats(Document $project, callable $getProjectDB, string $hourlyUsageRetentionDatetime): void
|
||||
private function deleteUsageStats(Document $project, callable $getProjectDB, callable $getLogsDB, string $hourlyUsageRetentionDatetime): void
|
||||
{
|
||||
$dbForProject = $getProjectDB($project);
|
||||
// Delete Usage stats
|
||||
$dbForLogs = $getLogsDB($project);
|
||||
|
||||
// Delete Usage stats from projectDB
|
||||
$this->deleteByGroup('stats', [
|
||||
Query::lessThan('time', $hourlyUsageRetentionDatetime),
|
||||
Query::equal('period', ['1h']),
|
||||
], $dbForProject);
|
||||
|
||||
// Delete Usage stats from logsDB
|
||||
$this->deleteByGroup('stats', [
|
||||
Query::lessThan('time', $hourlyUsageRetentionDatetime),
|
||||
Query::equal('period', ['1h']),
|
||||
], $dbForLogs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -851,7 +859,7 @@ class Deletes extends Action
|
|||
} else {
|
||||
Console::error('Failed to delete deployment files: ' . $deploymentPath);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
} catch (Throwable $th) {
|
||||
Console::error('Failed to delete deployment files: ' . $deploymentPath);
|
||||
Console::error('[Error] Type: ' . get_class($th));
|
||||
Console::error('[Error] Message: ' . $th->getMessage());
|
||||
|
|
@ -881,7 +889,7 @@ class Deletes extends Action
|
|||
} else {
|
||||
Console::error('Failed to delete build files: ' . $buildPath);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
} catch (Throwable $th) {
|
||||
Console::error('Failed to delete deployment files: ' . $buildPath);
|
||||
Console::error('[Error] Type: ' . get_class($th));
|
||||
Console::error('[Error] Message: ' . $th->getMessage());
|
||||
|
|
@ -947,7 +955,7 @@ class Deletes extends Action
|
|||
|
||||
try {
|
||||
$documents = $database->deleteDocuments($collection, $queries);
|
||||
} catch (\Throwable $th) {
|
||||
} catch (Throwable $th) {
|
||||
Console::error('Failed to delete documents for collection ' . $collection . ': ' . $th->getMessage());
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class StatsResources extends Action
|
|||
}
|
||||
|
||||
try {
|
||||
$this->countForDatabase($dbForProject, $dbForLogs, $region);
|
||||
$this->countForDatabase($dbForProject, $region);
|
||||
} catch (Throwable $th) {
|
||||
call_user_func_array($this->logError, [$th, "StatsResources", "count_for_database_{$project->getId()}"]);
|
||||
}
|
||||
|
|
@ -242,42 +242,54 @@ class StatsResources extends Action
|
|||
$this->createStatsDocuments($region, METRIC_FILES_IMAGES_TRANSFORMED, $totalImageTransformations);
|
||||
}
|
||||
|
||||
protected function countForDatabase(Database $dbForProject, Database $dbForLogs, string $region)
|
||||
protected function countForDatabase(Database $dbForProject, string $region)
|
||||
{
|
||||
$totalCollections = 0;
|
||||
$totalDocuments = 0;
|
||||
|
||||
$this->foreachDocument($dbForProject, 'databases', [], function ($database) use ($dbForProject, $dbForLogs, $region, &$totalCollections, &$totalDocuments) {
|
||||
$totalDatabaseStorage = 0;
|
||||
|
||||
$this->foreachDocument($dbForProject, 'databases', [], function ($database) use ($dbForProject, $region, &$totalCollections, &$totalDocuments, &$totalDatabaseStorage) {
|
||||
$collections = $dbForProject->count('database_' . $database->getInternalId());
|
||||
|
||||
$metric = str_replace('{databaseInternalId}', $database->getInternalId(), METRIC_DATABASE_ID_COLLECTIONS);
|
||||
$this->createStatsDocuments($region, $metric, $collections);
|
||||
|
||||
$documents = $this->countForCollections($dbForProject, $dbForLogs, $database, $region);
|
||||
[$documents, $storage] = $this->countForCollections($dbForProject, $database, $region);
|
||||
|
||||
$totalDatabaseStorage += $storage;
|
||||
$totalDocuments += $documents;
|
||||
$totalCollections += $collections;
|
||||
});
|
||||
|
||||
$this->createStatsDocuments($region, METRIC_COLLECTIONS, $totalCollections);
|
||||
$this->createStatsDocuments($region, METRIC_DOCUMENTS, $totalDocuments);
|
||||
$this->createStatsDocuments($region, METRIC_DATABASES_STORAGE, $totalDatabaseStorage);
|
||||
}
|
||||
protected function countForCollections(Database $dbForProject, Database $dbForLogs, Document $database, string $region): int
|
||||
protected function countForCollections(Database $dbForProject, Document $database, string $region): array
|
||||
{
|
||||
$databaseDocuments = 0;
|
||||
$this->foreachDocument($dbForProject, 'database_' . $database->getInternalId(), [], function ($collection) use ($dbForProject, $dbForLogs, $database, $region, &$totalCollections, &$databaseDocuments) {
|
||||
$databaseStorage = 0;
|
||||
$this->foreachDocument($dbForProject, 'database_' . $database->getInternalId(), [], function ($collection) use ($dbForProject, $database, $region, &$databaseStorage, &$databaseDocuments) {
|
||||
$documents = $dbForProject->count('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
|
||||
$metric = str_replace(['{databaseInternalId}', '{collectionInternalId}'], [$database->getInternalId(), $collection->getInternalId()], METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS);
|
||||
$this->createStatsDocuments($region, $metric, $documents);
|
||||
|
||||
$databaseDocuments += $documents;
|
||||
|
||||
$collectionStorage = $dbForProject->getSizeOfCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
|
||||
$metric = str_replace(['{databaseInternalId}', '{collectionInternalId}'], [$database->getInternalId(), $collection->getInternalId()], METRIC_DATABASE_ID_COLLECTION_ID_STORAGE);
|
||||
$this->createStatsDocuments($region, $metric, $collectionStorage);
|
||||
$databaseStorage += $collectionStorage;
|
||||
|
||||
});
|
||||
|
||||
$metric = str_replace(['{databaseInternalId}'], [$database->getInternalId()], METRIC_DATABASE_ID_DOCUMENTS);
|
||||
$this->createStatsDocuments($region, $metric, $databaseDocuments);
|
||||
|
||||
return $databaseDocuments;
|
||||
$metric = str_replace(['{databaseInternalId}'], [$database->getInternalId()], METRIC_DATABASE_ID_STORAGE);
|
||||
$this->createStatsDocuments($region, $metric, $databaseStorage);
|
||||
|
||||
return [$databaseDocuments, $databaseStorage];
|
||||
}
|
||||
|
||||
protected function countForFunctions(Database $dbForProject, Database $dbForLogs, string $region)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class StatsUsageDump extends Action
|
|||
METRIC_BUILDS => true,
|
||||
METRIC_COLLECTIONS => true,
|
||||
METRIC_DOCUMENTS => true,
|
||||
METRIC_DATABASES_STORAGE => true,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -63,6 +64,7 @@ class StatsUsageDump extends Action
|
|||
'.deployments.storage',
|
||||
'.builds',
|
||||
'.builds.storage',
|
||||
'.databases.storage'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,6 +42,19 @@ class UsageBuckets extends Model
|
|||
'example' => [],
|
||||
'array' => true
|
||||
])
|
||||
->addRule('imageTransformations', [
|
||||
'type' => Response::MODEL_METRIC,
|
||||
'description' => 'Aggregated number of files transformations per period.',
|
||||
'default' => [],
|
||||
'example' => [],
|
||||
'array' => true
|
||||
])
|
||||
->addRule('imageTransformationsTotal', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Total aggregated number of files transformations.',
|
||||
'default' => 0,
|
||||
'example' => 0,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,6 +197,19 @@ class UsageProject extends Model
|
|||
'example' => [],
|
||||
'array' => true
|
||||
])
|
||||
->addRule('imageTransformations', [
|
||||
'type' => Response::MODEL_METRIC,
|
||||
'description' => 'An array of aggregated number of image transformations.',
|
||||
'default' => [],
|
||||
'example' => [],
|
||||
'array' => true
|
||||
])
|
||||
->addRule('imageTransformationsTotal', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Total aggregated number of image transformations.',
|
||||
'default' => 0,
|
||||
'example' => 0,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class UsageTest extends Scope
|
|||
);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(29, count($response['body']));
|
||||
$this->assertEquals(31, count($response['body']));
|
||||
$this->validateDates($response['body']['network']);
|
||||
$this->validateDates($response['body']['requests']);
|
||||
$this->validateDates($response['body']['users']);
|
||||
|
|
@ -327,7 +327,7 @@ class UsageTest extends Scope
|
|||
]
|
||||
);
|
||||
|
||||
$this->assertEquals(29, count($response['body']));
|
||||
$this->assertEquals(31, count($response['body']));
|
||||
$this->assertEquals(1, count($response['body']['requests']));
|
||||
$this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']);
|
||||
$this->validateDates($response['body']['requests']);
|
||||
|
|
@ -548,7 +548,7 @@ class UsageTest extends Scope
|
|||
]
|
||||
);
|
||||
|
||||
$this->assertEquals(29, count($response['body']));
|
||||
$this->assertEquals(31, count($response['body']));
|
||||
$this->assertEquals(1, count($response['body']['requests']));
|
||||
$this->assertEquals(1, count($response['body']['network']));
|
||||
$this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']);
|
||||
|
|
@ -1142,49 +1142,38 @@ class UsageTest extends Scope
|
|||
|
||||
$tries = 0;
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
// Compare new values with old values
|
||||
$response = $this->client->call(
|
||||
Client::METHOD_GET,
|
||||
'/functions/' . $functionId . '/usage?range=30d',
|
||||
$this->getConsoleHeaders()
|
||||
);
|
||||
$this->assertEventually(function () use ($functionId, $functionsMetrics, $projectMetrics) {
|
||||
// Compare new values with old values
|
||||
$response = $this->client->call(
|
||||
Client::METHOD_GET,
|
||||
'/functions/' . $functionId . '/usage?range=30d',
|
||||
$this->getConsoleHeaders()
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(19, count($response['body']));
|
||||
$this->assertEquals('30d', $response['body']['range']);
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(19, count($response['body']));
|
||||
$this->assertEquals('30d', $response['body']['range']);
|
||||
|
||||
// Check if the new values are greater than the old values
|
||||
$this->assertEquals($functionsMetrics['executionsTotal'] + 1, $response['body']['executionsTotal']);
|
||||
$this->assertGreaterThan($functionsMetrics['executionsTimeTotal'], $response['body']['executionsTimeTotal']);
|
||||
$this->assertGreaterThan($functionsMetrics['executionsMbSecondsTotal'], $response['body']['executionsMbSecondsTotal']);
|
||||
// Check if the new values are greater than the old values
|
||||
$this->assertEquals($functionsMetrics['executionsTotal'] + 1, $response['body']['executionsTotal']);
|
||||
$this->assertGreaterThan($functionsMetrics['executionsTimeTotal'], $response['body']['executionsTimeTotal']);
|
||||
$this->assertGreaterThan($functionsMetrics['executionsMbSecondsTotal'], $response['body']['executionsMbSecondsTotal']);
|
||||
|
||||
$response = $this->client->call(
|
||||
Client::METHOD_GET,
|
||||
'/project/usage',
|
||||
$this->getConsoleHeaders(),
|
||||
[
|
||||
'period' => '1h',
|
||||
'startDate' => self::getToday(),
|
||||
'endDate' => self::getTomorrow(),
|
||||
]
|
||||
);
|
||||
$response = $this->client->call(
|
||||
Client::METHOD_GET,
|
||||
'/project/usage',
|
||||
$this->getConsoleHeaders(),
|
||||
[
|
||||
'period' => '1h',
|
||||
'startDate' => self::getToday(),
|
||||
'endDate' => self::getTomorrow(),
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals($projectMetrics['executionsTotal'] + 1, $response['body']['executionsTotal']);
|
||||
$this->assertGreaterThan($projectMetrics['executionsMbSecondsTotal'], $response['body']['executionsMbSecondsTotal']);
|
||||
|
||||
break;
|
||||
} catch (ExpectationFailedException $th) {
|
||||
if ($tries >= 5) {
|
||||
throw $th;
|
||||
} else {
|
||||
$tries++;
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals($projectMetrics['executionsTotal'] + 1, $response['body']['executionsTotal']);
|
||||
$this->assertGreaterThan($projectMetrics['executionsMbSecondsTotal'], $response['body']['executionsMbSecondsTotal']);
|
||||
});
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
|
|
|
|||
|
|
@ -2419,6 +2419,33 @@ class AccountCustomClientTest extends Scope
|
|||
$message = $smsRequest['data']['message'];
|
||||
$token = substr($message, 0, 6);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
|
||||
// disable phone sessions
|
||||
$response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $this->getProject()['$id'] . '/auth/phone', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => 'console',
|
||||
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||
]), [
|
||||
'status' => false,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(false, $response['body']['authPhone']);
|
||||
|
||||
$response = $this->client->call(Client::METHOD_POST, '/account/verification/phone', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
|
||||
]));
|
||||
|
||||
$this->assertEquals(501, $response['headers']['status-code']);
|
||||
$this->assertEquals("Phone authentication is disabled for this project", $response['body']['message']);
|
||||
|
||||
return \array_merge($data, [
|
||||
'token' => \substr($smsRequest['data']['message'], 0, 6)
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -2309,6 +2309,30 @@ class DatabasesCustomServerTest extends Scope
|
|||
$this->assertEquals(100, $new['body']['min']);
|
||||
$this->assertEquals(2000, $new['body']['max']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 100,
|
||||
'min' => 0,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $update['headers']['status-code']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 10,
|
||||
'max' => 100,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $update['headers']['status-code']);
|
||||
|
||||
/**
|
||||
* Test against failure
|
||||
*/
|
||||
|
|
@ -2368,32 +2392,6 @@ class DatabasesCustomServerTest extends Scope
|
|||
$this->assertEquals(400, $update['headers']['status-code']);
|
||||
$this->assertEquals(AppwriteException::GENERAL_ARGUMENT_INVALID, $update['body']['type']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 100,
|
||||
'min' => 0,
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $update['headers']['status-code']);
|
||||
$this->assertEquals(AppwriteException::GENERAL_ARGUMENT_INVALID, $update['body']['type']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 100,
|
||||
'max' => 0,
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $update['headers']['status-code']);
|
||||
$this->assertEquals(AppwriteException::GENERAL_ARGUMENT_INVALID, $update['body']['type']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
|
@ -2572,6 +2570,30 @@ class DatabasesCustomServerTest extends Scope
|
|||
$this->assertEquals(123.456, $new['body']['min']);
|
||||
$this->assertEquals(2000, $new['body']['max']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/float/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 123.456,
|
||||
'min' => 0.0,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $update['headers']['status-code']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/float/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 23.456,
|
||||
'max' => 100.0,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $update['headers']['status-code']);
|
||||
|
||||
/**
|
||||
* Test against failure
|
||||
*/
|
||||
|
|
@ -2631,32 +2653,6 @@ class DatabasesCustomServerTest extends Scope
|
|||
$this->assertEquals(400, $update['headers']['status-code']);
|
||||
$this->assertEquals(AppwriteException::GENERAL_ARGUMENT_INVALID, $update['body']['type']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/float/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 123.456,
|
||||
'min' => 0.0,
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $update['headers']['status-code']);
|
||||
$this->assertEquals(AppwriteException::GENERAL_ARGUMENT_INVALID, $update['body']['type']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/float/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'required' => false,
|
||||
'default' => 123.456,
|
||||
'max' => 0.0,
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $update['headers']['status-code']);
|
||||
$this->assertEquals(AppwriteException::GENERAL_ARGUMENT_INVALID, $update['body']['type']);
|
||||
|
||||
$update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/float/' . $key, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
|
|
|||
|
|
@ -53,8 +53,9 @@ trait MigrationsBase
|
|||
$this->assertNotEmpty($migration['body']);
|
||||
$this->assertNotEmpty($migration['body']['$id']);
|
||||
|
||||
$attempts = 0;
|
||||
while ($attempts < 5) {
|
||||
$migrationResult = [];
|
||||
|
||||
$this->assertEventually(function () use ($migration, &$migrationResult) {
|
||||
$response = $this->client->call(Client::METHOD_GET, '/migrations/' . $migration['body']['$id'], [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getDestinationProject()['$id'],
|
||||
|
|
@ -66,24 +67,18 @@ trait MigrationsBase
|
|||
$this->assertNotEmpty($response['body']['$id']);
|
||||
|
||||
if ($response['body']['status'] === 'failed') {
|
||||
$this->fail('Migration failed', json_encode($response['body'], JSON_PRETTY_PRINT));
|
||||
$this->fail('Migration failed' . json_encode($response['body'], JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
$this->assertNotEquals('failed', $response['body']['status']);
|
||||
$this->assertEquals('completed', $response['body']['status']);
|
||||
|
||||
if ($response['body']['status'] === 'completed') {
|
||||
return $response['body'];
|
||||
}
|
||||
$migrationResult = $response['body'];
|
||||
|
||||
if ($attempts === 4) {
|
||||
$this->assertEquals('completed', $response['body']['status']);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
$attempts++;
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
return [];
|
||||
return $migrationResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1312,22 +1312,15 @@ class RealtimeCustomClientTest extends Scope
|
|||
$this->assertNotEmpty($deployment['body']['$id']);
|
||||
|
||||
// Poll until deployment is built
|
||||
while (true) {
|
||||
$this->assertEventually(function () use ($function, $deploymentId) {
|
||||
$deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $function['body']['$id'] . '/deployments/' . $deploymentId, [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
]);
|
||||
|
||||
if (
|
||||
$deployment['headers']['status-code'] >= 400
|
||||
|| \in_array($deployment['body']['status'], ['ready', 'failed'])
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
\sleep(1);
|
||||
}
|
||||
$this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body']));
|
||||
});
|
||||
|
||||
$response = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployments/' . $deploymentId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
|
|
|||
|
|
@ -98,11 +98,13 @@ class StorageConsoleClientTest extends Scope
|
|||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(5, count($response['body']));
|
||||
$this->assertEquals(7, count($response['body']));
|
||||
$this->assertEquals('24h', $response['body']['range']);
|
||||
$this->assertIsNumeric($response['body']['filesTotal']);
|
||||
$this->assertIsNumeric($response['body']['filesStorageTotal']);
|
||||
$this->assertIsArray($response['body']['files']);
|
||||
$this->assertIsArray($response['body']['storage']);
|
||||
$this->assertIsArray($response['body']['imageTransformations']);
|
||||
$this->assertIsNumeric($response['body']['imageTransformationsTotal']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\E2E\Services\Webhooks;
|
||||
|
||||
use Appwrite\Tests\Async;
|
||||
use Appwrite\Tests\Retry;
|
||||
use CURLFile;
|
||||
use Tests\E2E\Client;
|
||||
|
|
@ -12,29 +13,20 @@ use Utopia\Database\Validator\Datetime as DatetimeValidator;
|
|||
|
||||
trait WebhooksBase
|
||||
{
|
||||
protected function awaitDeploymentIsBuilt($functionId, $deploymentId, $checkForSuccess = true): void
|
||||
use Async;
|
||||
|
||||
protected function awaitDeploymentIsBuilt($functionId, $deploymentId): void
|
||||
{
|
||||
while (true) {
|
||||
$this->assertEventually(function () use ($functionId, $deploymentId) {
|
||||
$deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/deployments/' . $deploymentId, [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
]);
|
||||
|
||||
if (
|
||||
$deployment['headers']['status-code'] >= 400
|
||||
|| \in_array($deployment['body']['status'], ['ready', 'failed'])
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
\sleep(1);
|
||||
}
|
||||
|
||||
if ($checkForSuccess) {
|
||||
$this->assertEquals(200, $deployment['headers']['status-code']);
|
||||
$this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body']));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static function getWebhookSignature(array $webhook, string $signatureKey): string
|
||||
|
|
|
|||
Loading…
Reference in a new issue