Merge branch 'main' into cors-allow-dev-key

This commit is contained in:
Luke B. Silver 2025-05-21 11:53:09 +01:00 committed by GitHub
commit 30915b4803
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
909 changed files with 12988 additions and 2865 deletions

View file

@ -72,7 +72,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:1.7.0
appwrite/appwrite:1.7.2
```
### Windows
@ -84,7 +84,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^
appwrite/appwrite:1.7.0
appwrite/appwrite:1.7.2
```
#### PowerShell
@ -94,7 +94,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" `
appwrite/appwrite:1.7.0
appwrite/appwrite:1.7.2
```
运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。

View file

@ -78,7 +78,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:1.7.0
appwrite/appwrite:1.7.2
```
### Windows
@ -90,7 +90,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^
appwrite/appwrite:1.7.0
appwrite/appwrite:1.7.2
```
#### PowerShell
@ -100,7 +100,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" `
appwrite/appwrite:1.7.0
appwrite/appwrite:1.7.2
```
Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation.

View file

@ -10,12 +10,15 @@ use Appwrite\Event\StatsUsage;
use Appwrite\Platform\Appwrite;
use Appwrite\Runtimes\Runtimes;
use Executor\Executor;
use Swoole\Runtime;
use Swoole\Timer;
use Utopia\Cache\Adapter\Pool as CachePool;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
use Utopia\CLI\CLI;
use Utopia\CLI\Console;
use Utopia\Config\Config;
use Utopia\Database\Adapter\Pool as DatabasePool;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Validator\Authorization;
@ -23,6 +26,7 @@ use Utopia\DSN\DSN;
use Utopia\Logger\Log;
use Utopia\Platform\Service;
use Utopia\Pools\Group;
use Utopia\Queue\Broker\Pool as BrokerPool;
use Utopia\Queue\Publisher;
use Utopia\Registry\Registry;
use Utopia\System\System;
@ -45,10 +49,7 @@ CLI::setResource('cache', function ($pools) {
$adapters = [];
foreach ($list as $value) {
$adapters[] = $pools
->get($value)
->pop()
->getResource();
$adapters[] = new CachePool($pools->get($value));
}
return new Cache(new Sharding($adapters));
@ -68,12 +69,8 @@ CLI::setResource('dbForPlatform', function ($pools, $cache) {
$attempts++;
try {
// Prepare database connection
$dbAdapter = $pools
->get('console')
->pop()
->getResource();
$dbForPlatform = new Database($dbAdapter, $cache);
$adapter = new DatabasePool($pools->get('console'));
$dbForPlatform = new Database($adapter, $cache);
$dbForPlatform
->setNamespace('_console')
@ -91,7 +88,6 @@ CLI::setResource('dbForPlatform', function ($pools, $cache) {
$ready = true;
} catch (\Throwable $err) {
Console::warning($err->getMessage());
$pools->get('console')->reclaim();
sleep($sleep);
}
} while ($attempts < $maxAttempts && !$ready);
@ -141,12 +137,8 @@ CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform
return $database;
}
$dbAdapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$adapter = new DatabasePool($pools->get($dsn->getHost()));
$database = new Database($adapter, $cache);
$databases[$dsn->getHost()] = $database;
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
@ -172,21 +164,15 @@ CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform
CLI::setResource('getLogsDB', function (Group $pools, Cache $cache) {
$database = null;
return function (?Document $project = null) use ($pools, $cache, $database) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
return $database;
}
$dbAdapter = $pools
->get('logs')
->pop()
->getResource();
$database = new Database(
$dbAdapter,
$cache
);
$adapter = new DatabasePool($pools->get('logs'));
$database = new Database($adapter, $cache);
$database
->setSharedTables(true)
@ -210,7 +196,7 @@ CLI::setResource('queueForStatsResources', function (Publisher $publisher) {
return new StatsResources($publisher);
}, ['publisher']);
CLI::setResource('publisher', function (Group $pools) {
return $pools->get('publisher')->pop()->getResource();
return new BrokerPool(publisher: $pools->get('publisher'));
}, ['pools']);
CLI::setResource('queueForFunctions', function (Publisher $publisher) {
return new Func($publisher);
@ -298,4 +284,6 @@ $cli
$cli->shutdown()->action(fn () => Timer::clearAll());
// Enable coroutines, but disable TCP hooks. These don't work until we use `\Utopia\Cache\Adapter\Pool` and `\Utopia\Database\Adapter\Pool`.
Runtime::enableCoroutine(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP);
run($cli->run(...));

View file

@ -11,7 +11,7 @@ return [
[
'key' => 'web',
'name' => 'Web',
'version' => '18.0.0',
'version' => '18.1.0',
'url' => 'https://github.com/appwrite/sdk-for-web',
'package' => 'https://www.npmjs.com/package/appwrite',
'enabled' => true,
@ -59,7 +59,7 @@ return [
[
'key' => 'flutter',
'name' => 'Flutter',
'version' => '16.0.0',
'version' => '16.1.0',
'url' => 'https://github.com/appwrite/sdk-for-flutter',
'package' => 'https://pub.dev/packages/appwrite',
'enabled' => true,
@ -77,7 +77,7 @@ return [
[
'key' => 'apple',
'name' => 'Apple',
'version' => '10.0.0',
'version' => '10.1.0',
'url' => 'https://github.com/appwrite/sdk-for-apple',
'package' => 'https://github.com/appwrite/sdk-for-apple',
'enabled' => true,
@ -112,7 +112,7 @@ return [
[
'key' => 'android',
'name' => 'Android',
'version' => '8.0.0',
'version' => '8.1.0',
'url' => 'https://github.com/appwrite/sdk-for-android',
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android',
'enabled' => true,
@ -134,7 +134,7 @@ return [
[
'key' => 'react-native',
'name' => 'React Native',
'version' => '0.9.0',
'version' => '0.9.1',
'url' => 'https://github.com/appwrite/sdk-for-react-native',
'package' => 'https://npmjs.com/package/react-native-appwrite',
'enabled' => true,
@ -199,7 +199,7 @@ return [
[
'key' => 'web',
'name' => 'Console',
'version' => '1.3.0',
'version' => '1.7.0',
'url' => 'https://github.com/appwrite/sdk-for-console',
'package' => '',
'enabled' => true,
@ -353,7 +353,7 @@ return [
[
'key' => 'dotnet',
'name' => '.NET',
'version' => '0.15.0',
'version' => '0.13.0',
'url' => 'https://github.com/appwrite/sdk-for-dotnet',
'package' => 'https://www.nuget.org/packages/Appwrite',
'enabled' => true,

View file

@ -4660,6 +4660,115 @@
}
]
},
"put": {
"summary": "Upsert document",
"operationId": "databasesUpsertDocument",
"tags": [
"databases"
],
"description": "Create or update a 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.",
"responses": {
"200": {
"description": "Document",
"content": {
"application\/json": {
"schema": {
"$ref": "#\/components\/schemas\/document"
}
}
}
}
},
"x-appwrite": {
"method": "upsertDocument",
"group": "documents",
"weight": 114,
"cookies": false,
"type": "",
"deprecated": false,
"demo": "databases\/upsert-document.md",
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/databases\/upsert-document.md",
"rate-limit": 120,
"rate-time": 60,
"rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}",
"scope": "documents.write",
"platforms": [
"client",
"server",
"server"
],
"packaging": false,
"auth": {
"Project": []
}
},
"security": [
{
"Project": [],
"Session": [],
"JWT": []
}
],
"parameters": [
{
"name": "databaseId",
"description": "Database ID.",
"required": true,
"schema": {
"type": "string",
"x-example": "<DATABASE_ID>"
},
"in": "path"
},
{
"name": "collectionId",
"description": "Collection ID.",
"required": true,
"schema": {
"type": "string",
"x-example": "<COLLECTION_ID>"
},
"in": "path"
},
{
"name": "documentId",
"description": "Document ID.",
"required": true,
"schema": {
"type": "string",
"x-example": "<DOCUMENT_ID>"
},
"in": "path"
}
],
"requestBody": {
"content": {
"application\/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"description": "Document data as JSON object. Include all required attributes of the document to be created or updated.",
"x-example": "{}"
},
"permissions": {
"type": "array",
"description": "An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).",
"x-example": "[\"read(\"any\")\"]",
"items": {
"type": "string"
}
}
},
"required": [
"data"
]
}
}
}
}
},
"patch": {
"summary": "Update document",
"operationId": "databasesUpdateDocument",
@ -4781,7 +4890,7 @@
"x-appwrite": {
"method": "deleteDocument",
"group": "documents",
"weight": 116,
"weight": 117,
"cookies": false,
"type": "",
"deprecated": false,
@ -4865,7 +4974,7 @@
"x-appwrite": {
"method": "listExecutions",
"group": "executions",
"weight": 391,
"weight": 392,
"cookies": false,
"type": "",
"deprecated": false,
@ -4940,7 +5049,7 @@
"x-appwrite": {
"method": "createExecution",
"group": "executions",
"weight": 389,
"weight": 390,
"cookies": false,
"type": "",
"deprecated": false,
@ -5055,7 +5164,7 @@
"x-appwrite": {
"method": "getExecution",
"group": "executions",
"weight": 390,
"weight": 391,
"cookies": false,
"type": "",
"deprecated": false,
@ -5129,7 +5238,7 @@
"x-appwrite": {
"method": "query",
"group": "graphql",
"weight": 305,
"weight": 306,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5181,7 +5290,7 @@
"x-appwrite": {
"method": "mutation",
"group": "graphql",
"weight": 304,
"weight": 305,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5233,7 +5342,7 @@
"x-appwrite": {
"method": "get",
"group": null,
"weight": 121,
"weight": 122,
"cookies": false,
"type": "",
"deprecated": false,
@ -5285,7 +5394,7 @@
"x-appwrite": {
"method": "listCodes",
"group": null,
"weight": 122,
"weight": 123,
"cookies": false,
"type": "",
"deprecated": false,
@ -5337,7 +5446,7 @@
"x-appwrite": {
"method": "listContinents",
"group": null,
"weight": 126,
"weight": 127,
"cookies": false,
"type": "",
"deprecated": false,
@ -5389,7 +5498,7 @@
"x-appwrite": {
"method": "listCountries",
"group": null,
"weight": 123,
"weight": 124,
"cookies": false,
"type": "",
"deprecated": false,
@ -5441,7 +5550,7 @@
"x-appwrite": {
"method": "listCountriesEU",
"group": null,
"weight": 124,
"weight": 125,
"cookies": false,
"type": "",
"deprecated": false,
@ -5493,7 +5602,7 @@
"x-appwrite": {
"method": "listCountriesPhones",
"group": null,
"weight": 125,
"weight": 126,
"cookies": false,
"type": "",
"deprecated": false,
@ -5545,7 +5654,7 @@
"x-appwrite": {
"method": "listCurrencies",
"group": null,
"weight": 127,
"weight": 128,
"cookies": false,
"type": "",
"deprecated": false,
@ -5597,7 +5706,7 @@
"x-appwrite": {
"method": "listLanguages",
"group": null,
"weight": 128,
"weight": 129,
"cookies": false,
"type": "",
"deprecated": false,
@ -5649,7 +5758,7 @@
"x-appwrite": {
"method": "createSubscriber",
"group": "subscribers",
"weight": 351,
"weight": 352,
"cookies": false,
"type": "",
"deprecated": false,
@ -5732,7 +5841,7 @@
"x-appwrite": {
"method": "deleteSubscriber",
"group": "subscribers",
"weight": 355,
"weight": 356,
"cookies": false,
"type": "",
"deprecated": false,
@ -5807,7 +5916,7 @@
"x-appwrite": {
"method": "listFiles",
"group": "files",
"weight": 211,
"weight": 212,
"cookies": false,
"type": "",
"deprecated": false,
@ -5893,7 +6002,7 @@
"x-appwrite": {
"method": "createFile",
"group": "files",
"weight": 210,
"weight": 211,
"cookies": false,
"type": "upload",
"deprecated": false,
@ -5991,7 +6100,7 @@
"x-appwrite": {
"method": "getFile",
"group": "files",
"weight": 212,
"weight": 213,
"cookies": false,
"type": "",
"deprecated": false,
@ -6063,7 +6172,7 @@
"x-appwrite": {
"method": "updateFile",
"group": "files",
"weight": 217,
"weight": 218,
"cookies": false,
"type": "",
"deprecated": false,
@ -6152,7 +6261,7 @@
"x-appwrite": {
"method": "deleteFile",
"group": "files",
"weight": 218,
"weight": 219,
"cookies": false,
"type": "",
"deprecated": false,
@ -6219,7 +6328,7 @@
"x-appwrite": {
"method": "getFileDownload",
"group": "files",
"weight": 214,
"weight": 215,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6297,7 +6406,7 @@
"x-appwrite": {
"method": "getFilePreview",
"group": "files",
"weight": 213,
"weight": 214,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6524,7 +6633,7 @@
"x-appwrite": {
"method": "getFileView",
"group": "files",
"weight": 215,
"weight": 216,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6609,7 +6718,7 @@
"x-appwrite": {
"method": "list",
"group": "teams",
"weight": 222,
"weight": 223,
"cookies": false,
"type": "",
"deprecated": false,
@ -6685,7 +6794,7 @@
"x-appwrite": {
"method": "create",
"group": "teams",
"weight": 221,
"weight": 222,
"cookies": false,
"type": "",
"deprecated": false,
@ -6770,7 +6879,7 @@
"x-appwrite": {
"method": "get",
"group": "teams",
"weight": 223,
"weight": 224,
"cookies": false,
"type": "",
"deprecated": false,
@ -6832,7 +6941,7 @@
"x-appwrite": {
"method": "updateName",
"group": "teams",
"weight": 225,
"weight": 226,
"cookies": false,
"type": "",
"deprecated": false,
@ -6906,7 +7015,7 @@
"x-appwrite": {
"method": "delete",
"group": "teams",
"weight": 227,
"weight": 228,
"cookies": false,
"type": "",
"deprecated": false,
@ -6970,7 +7079,7 @@
"x-appwrite": {
"method": "listMemberships",
"group": "memberships",
"weight": 229,
"weight": 230,
"cookies": false,
"type": "",
"deprecated": false,
@ -7056,7 +7165,7 @@
"x-appwrite": {
"method": "createMembership",
"group": "memberships",
"weight": 228,
"weight": 229,
"cookies": false,
"type": "",
"deprecated": false,
@ -7167,7 +7276,7 @@
"x-appwrite": {
"method": "getMembership",
"group": "memberships",
"weight": 230,
"weight": 231,
"cookies": false,
"type": "",
"deprecated": false,
@ -7239,7 +7348,7 @@
"x-appwrite": {
"method": "updateMembership",
"group": "memberships",
"weight": 231,
"weight": 232,
"cookies": false,
"type": "",
"deprecated": false,
@ -7326,7 +7435,7 @@
"x-appwrite": {
"method": "deleteMembership",
"group": "memberships",
"weight": 233,
"weight": 234,
"cookies": false,
"type": "",
"deprecated": false,
@ -7400,7 +7509,7 @@
"x-appwrite": {
"method": "updateMembershipStatus",
"group": "memberships",
"weight": 232,
"weight": 233,
"cookies": false,
"type": "",
"deprecated": false,
@ -7498,7 +7607,7 @@
"x-appwrite": {
"method": "getPrefs",
"group": "teams",
"weight": 224,
"weight": 225,
"cookies": false,
"type": "",
"deprecated": false,
@ -7559,7 +7668,7 @@
"x-appwrite": {
"method": "updatePrefs",
"group": "teams",
"weight": 226,
"weight": 227,
"cookies": false,
"type": "",
"deprecated": false,
@ -9752,6 +9861,12 @@
"name": "X-Appwrite-Session",
"description": "The user session to authenticate with",
"in": "header"
},
"DevKey": {
"type": "apiKey",
"name": "X-Appwrite-Dev-Key",
"description": "Your secret dev API key",
"in": "header"
}
}
},

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -4660,6 +4660,115 @@
}
]
},
"put": {
"summary": "Upsert document",
"operationId": "databasesUpsertDocument",
"tags": [
"databases"
],
"description": "Create or update a 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.",
"responses": {
"200": {
"description": "Document",
"content": {
"application\/json": {
"schema": {
"$ref": "#\/components\/schemas\/document"
}
}
}
}
},
"x-appwrite": {
"method": "upsertDocument",
"group": "documents",
"weight": 114,
"cookies": false,
"type": "",
"deprecated": false,
"demo": "databases\/upsert-document.md",
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/databases\/upsert-document.md",
"rate-limit": 120,
"rate-time": 60,
"rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}",
"scope": "documents.write",
"platforms": [
"client",
"server",
"server"
],
"packaging": false,
"auth": {
"Project": []
}
},
"security": [
{
"Project": [],
"Session": [],
"JWT": []
}
],
"parameters": [
{
"name": "databaseId",
"description": "Database ID.",
"required": true,
"schema": {
"type": "string",
"x-example": "<DATABASE_ID>"
},
"in": "path"
},
{
"name": "collectionId",
"description": "Collection ID.",
"required": true,
"schema": {
"type": "string",
"x-example": "<COLLECTION_ID>"
},
"in": "path"
},
{
"name": "documentId",
"description": "Document ID.",
"required": true,
"schema": {
"type": "string",
"x-example": "<DOCUMENT_ID>"
},
"in": "path"
}
],
"requestBody": {
"content": {
"application\/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"description": "Document data as JSON object. Include all required attributes of the document to be created or updated.",
"x-example": "{}"
},
"permissions": {
"type": "array",
"description": "An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).",
"x-example": "[\"read(\"any\")\"]",
"items": {
"type": "string"
}
}
},
"required": [
"data"
]
}
}
}
}
},
"patch": {
"summary": "Update document",
"operationId": "databasesUpdateDocument",
@ -4781,7 +4890,7 @@
"x-appwrite": {
"method": "deleteDocument",
"group": "documents",
"weight": 116,
"weight": 117,
"cookies": false,
"type": "",
"deprecated": false,
@ -4865,7 +4974,7 @@
"x-appwrite": {
"method": "listExecutions",
"group": "executions",
"weight": 391,
"weight": 392,
"cookies": false,
"type": "",
"deprecated": false,
@ -4940,7 +5049,7 @@
"x-appwrite": {
"method": "createExecution",
"group": "executions",
"weight": 389,
"weight": 390,
"cookies": false,
"type": "",
"deprecated": false,
@ -5055,7 +5164,7 @@
"x-appwrite": {
"method": "getExecution",
"group": "executions",
"weight": 390,
"weight": 391,
"cookies": false,
"type": "",
"deprecated": false,
@ -5129,7 +5238,7 @@
"x-appwrite": {
"method": "query",
"group": "graphql",
"weight": 305,
"weight": 306,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5181,7 +5290,7 @@
"x-appwrite": {
"method": "mutation",
"group": "graphql",
"weight": 304,
"weight": 305,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5233,7 +5342,7 @@
"x-appwrite": {
"method": "get",
"group": null,
"weight": 121,
"weight": 122,
"cookies": false,
"type": "",
"deprecated": false,
@ -5285,7 +5394,7 @@
"x-appwrite": {
"method": "listCodes",
"group": null,
"weight": 122,
"weight": 123,
"cookies": false,
"type": "",
"deprecated": false,
@ -5337,7 +5446,7 @@
"x-appwrite": {
"method": "listContinents",
"group": null,
"weight": 126,
"weight": 127,
"cookies": false,
"type": "",
"deprecated": false,
@ -5389,7 +5498,7 @@
"x-appwrite": {
"method": "listCountries",
"group": null,
"weight": 123,
"weight": 124,
"cookies": false,
"type": "",
"deprecated": false,
@ -5441,7 +5550,7 @@
"x-appwrite": {
"method": "listCountriesEU",
"group": null,
"weight": 124,
"weight": 125,
"cookies": false,
"type": "",
"deprecated": false,
@ -5493,7 +5602,7 @@
"x-appwrite": {
"method": "listCountriesPhones",
"group": null,
"weight": 125,
"weight": 126,
"cookies": false,
"type": "",
"deprecated": false,
@ -5545,7 +5654,7 @@
"x-appwrite": {
"method": "listCurrencies",
"group": null,
"weight": 127,
"weight": 128,
"cookies": false,
"type": "",
"deprecated": false,
@ -5597,7 +5706,7 @@
"x-appwrite": {
"method": "listLanguages",
"group": null,
"weight": 128,
"weight": 129,
"cookies": false,
"type": "",
"deprecated": false,
@ -5649,7 +5758,7 @@
"x-appwrite": {
"method": "createSubscriber",
"group": "subscribers",
"weight": 351,
"weight": 352,
"cookies": false,
"type": "",
"deprecated": false,
@ -5732,7 +5841,7 @@
"x-appwrite": {
"method": "deleteSubscriber",
"group": "subscribers",
"weight": 355,
"weight": 356,
"cookies": false,
"type": "",
"deprecated": false,
@ -5807,7 +5916,7 @@
"x-appwrite": {
"method": "listFiles",
"group": "files",
"weight": 211,
"weight": 212,
"cookies": false,
"type": "",
"deprecated": false,
@ -5893,7 +6002,7 @@
"x-appwrite": {
"method": "createFile",
"group": "files",
"weight": 210,
"weight": 211,
"cookies": false,
"type": "upload",
"deprecated": false,
@ -5991,7 +6100,7 @@
"x-appwrite": {
"method": "getFile",
"group": "files",
"weight": 212,
"weight": 213,
"cookies": false,
"type": "",
"deprecated": false,
@ -6063,7 +6172,7 @@
"x-appwrite": {
"method": "updateFile",
"group": "files",
"weight": 217,
"weight": 218,
"cookies": false,
"type": "",
"deprecated": false,
@ -6152,7 +6261,7 @@
"x-appwrite": {
"method": "deleteFile",
"group": "files",
"weight": 218,
"weight": 219,
"cookies": false,
"type": "",
"deprecated": false,
@ -6219,7 +6328,7 @@
"x-appwrite": {
"method": "getFileDownload",
"group": "files",
"weight": 214,
"weight": 215,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6297,7 +6406,7 @@
"x-appwrite": {
"method": "getFilePreview",
"group": "files",
"weight": 213,
"weight": 214,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6524,7 +6633,7 @@
"x-appwrite": {
"method": "getFileView",
"group": "files",
"weight": 215,
"weight": 216,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6609,7 +6718,7 @@
"x-appwrite": {
"method": "list",
"group": "teams",
"weight": 222,
"weight": 223,
"cookies": false,
"type": "",
"deprecated": false,
@ -6685,7 +6794,7 @@
"x-appwrite": {
"method": "create",
"group": "teams",
"weight": 221,
"weight": 222,
"cookies": false,
"type": "",
"deprecated": false,
@ -6770,7 +6879,7 @@
"x-appwrite": {
"method": "get",
"group": "teams",
"weight": 223,
"weight": 224,
"cookies": false,
"type": "",
"deprecated": false,
@ -6832,7 +6941,7 @@
"x-appwrite": {
"method": "updateName",
"group": "teams",
"weight": 225,
"weight": 226,
"cookies": false,
"type": "",
"deprecated": false,
@ -6906,7 +7015,7 @@
"x-appwrite": {
"method": "delete",
"group": "teams",
"weight": 227,
"weight": 228,
"cookies": false,
"type": "",
"deprecated": false,
@ -6970,7 +7079,7 @@
"x-appwrite": {
"method": "listMemberships",
"group": "memberships",
"weight": 229,
"weight": 230,
"cookies": false,
"type": "",
"deprecated": false,
@ -7056,7 +7165,7 @@
"x-appwrite": {
"method": "createMembership",
"group": "memberships",
"weight": 228,
"weight": 229,
"cookies": false,
"type": "",
"deprecated": false,
@ -7167,7 +7276,7 @@
"x-appwrite": {
"method": "getMembership",
"group": "memberships",
"weight": 230,
"weight": 231,
"cookies": false,
"type": "",
"deprecated": false,
@ -7239,7 +7348,7 @@
"x-appwrite": {
"method": "updateMembership",
"group": "memberships",
"weight": 231,
"weight": 232,
"cookies": false,
"type": "",
"deprecated": false,
@ -7326,7 +7435,7 @@
"x-appwrite": {
"method": "deleteMembership",
"group": "memberships",
"weight": 233,
"weight": 234,
"cookies": false,
"type": "",
"deprecated": false,
@ -7400,7 +7509,7 @@
"x-appwrite": {
"method": "updateMembershipStatus",
"group": "memberships",
"weight": 232,
"weight": 233,
"cookies": false,
"type": "",
"deprecated": false,
@ -7498,7 +7607,7 @@
"x-appwrite": {
"method": "getPrefs",
"group": "teams",
"weight": 224,
"weight": 225,
"cookies": false,
"type": "",
"deprecated": false,
@ -7559,7 +7668,7 @@
"x-appwrite": {
"method": "updatePrefs",
"group": "teams",
"weight": 226,
"weight": 227,
"cookies": false,
"type": "",
"deprecated": false,
@ -9752,6 +9861,12 @@
"name": "X-Appwrite-Session",
"description": "The user session to authenticate with",
"in": "header"
},
"DevKey": {
"type": "apiKey",
"name": "X-Appwrite-Dev-Key",
"description": "Your secret dev API key",
"in": "header"
}
}
},

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -61,6 +61,12 @@
"name": "X-Appwrite-Session",
"description": "The user session to authenticate with",
"in": "header"
},
"DevKey": {
"type": "apiKey",
"name": "X-Appwrite-Dev-Key",
"description": "Your secret dev API key",
"in": "header"
}
},
"paths": {
@ -4791,6 +4797,111 @@
}
]
},
"put": {
"summary": "Upsert document",
"operationId": "databasesUpsertDocument",
"consumes": [
"application\/json"
],
"produces": [
"application\/json"
],
"tags": [
"databases"
],
"description": "Create or update a 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.",
"responses": {
"200": {
"description": "Document",
"schema": {
"$ref": "#\/definitions\/document"
}
}
},
"x-appwrite": {
"method": "upsertDocument",
"group": "documents",
"weight": 114,
"cookies": false,
"type": "",
"deprecated": false,
"demo": "databases\/upsert-document.md",
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/databases\/upsert-document.md",
"rate-limit": 120,
"rate-time": 60,
"rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}",
"scope": "documents.write",
"platforms": [
"client",
"server",
"server"
],
"packaging": false,
"auth": {
"Project": []
}
},
"security": [
{
"Project": [],
"Session": [],
"JWT": []
}
],
"parameters": [
{
"name": "databaseId",
"description": "Database ID.",
"required": true,
"type": "string",
"x-example": "<DATABASE_ID>",
"in": "path"
},
{
"name": "collectionId",
"description": "Collection ID.",
"required": true,
"type": "string",
"x-example": "<COLLECTION_ID>",
"in": "path"
},
{
"name": "documentId",
"description": "Document ID.",
"required": true,
"type": "string",
"x-example": "<DOCUMENT_ID>",
"in": "path"
},
{
"name": "payload",
"in": "body",
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"description": "Document data as JSON object. Include all required attributes of the document to be created or updated.",
"default": {},
"x-example": "{}"
},
"permissions": {
"type": "array",
"description": "An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).",
"default": null,
"x-example": "[\"read(\"any\")\"]",
"items": {
"type": "string"
}
}
},
"required": [
"data"
]
}
}
]
},
"patch": {
"summary": "Update document",
"operationId": "databasesUpdateDocument",
@ -4912,7 +5023,7 @@
"x-appwrite": {
"method": "deleteDocument",
"group": "documents",
"weight": 116,
"weight": 117,
"cookies": false,
"type": "",
"deprecated": false,
@ -4990,7 +5101,7 @@
"x-appwrite": {
"method": "listExecutions",
"group": "executions",
"weight": 391,
"weight": 392,
"cookies": false,
"type": "",
"deprecated": false,
@ -5064,7 +5175,7 @@
"x-appwrite": {
"method": "createExecution",
"group": "executions",
"weight": 389,
"weight": 390,
"cookies": false,
"type": "",
"deprecated": false,
@ -5181,7 +5292,7 @@
"x-appwrite": {
"method": "getExecution",
"group": "executions",
"weight": 390,
"weight": 391,
"cookies": false,
"type": "",
"deprecated": false,
@ -5253,7 +5364,7 @@
"x-appwrite": {
"method": "query",
"group": "graphql",
"weight": 305,
"weight": 306,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5327,7 +5438,7 @@
"x-appwrite": {
"method": "mutation",
"group": "graphql",
"weight": 304,
"weight": 305,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5399,7 +5510,7 @@
"x-appwrite": {
"method": "get",
"group": null,
"weight": 121,
"weight": 122,
"cookies": false,
"type": "",
"deprecated": false,
@ -5451,7 +5562,7 @@
"x-appwrite": {
"method": "listCodes",
"group": null,
"weight": 122,
"weight": 123,
"cookies": false,
"type": "",
"deprecated": false,
@ -5503,7 +5614,7 @@
"x-appwrite": {
"method": "listContinents",
"group": null,
"weight": 126,
"weight": 127,
"cookies": false,
"type": "",
"deprecated": false,
@ -5555,7 +5666,7 @@
"x-appwrite": {
"method": "listCountries",
"group": null,
"weight": 123,
"weight": 124,
"cookies": false,
"type": "",
"deprecated": false,
@ -5607,7 +5718,7 @@
"x-appwrite": {
"method": "listCountriesEU",
"group": null,
"weight": 124,
"weight": 125,
"cookies": false,
"type": "",
"deprecated": false,
@ -5659,7 +5770,7 @@
"x-appwrite": {
"method": "listCountriesPhones",
"group": null,
"weight": 125,
"weight": 126,
"cookies": false,
"type": "",
"deprecated": false,
@ -5711,7 +5822,7 @@
"x-appwrite": {
"method": "listCurrencies",
"group": null,
"weight": 127,
"weight": 128,
"cookies": false,
"type": "",
"deprecated": false,
@ -5763,7 +5874,7 @@
"x-appwrite": {
"method": "listLanguages",
"group": null,
"weight": 128,
"weight": 129,
"cookies": false,
"type": "",
"deprecated": false,
@ -5817,7 +5928,7 @@
"x-appwrite": {
"method": "createSubscriber",
"group": "subscribers",
"weight": 351,
"weight": 352,
"cookies": false,
"type": "",
"deprecated": false,
@ -5902,7 +6013,7 @@
"x-appwrite": {
"method": "deleteSubscriber",
"group": "subscribers",
"weight": 355,
"weight": 356,
"cookies": false,
"type": "",
"deprecated": false,
@ -5973,7 +6084,7 @@
"x-appwrite": {
"method": "listFiles",
"group": "files",
"weight": 211,
"weight": 212,
"cookies": false,
"type": "",
"deprecated": false,
@ -6056,7 +6167,7 @@
"x-appwrite": {
"method": "createFile",
"group": "files",
"weight": 210,
"weight": 211,
"cookies": false,
"type": "upload",
"deprecated": false,
@ -6146,7 +6257,7 @@
"x-appwrite": {
"method": "getFile",
"group": "files",
"weight": 212,
"weight": 213,
"cookies": false,
"type": "",
"deprecated": false,
@ -6216,7 +6327,7 @@
"x-appwrite": {
"method": "updateFile",
"group": "files",
"weight": 217,
"weight": 218,
"cookies": false,
"type": "",
"deprecated": false,
@ -6305,7 +6416,7 @@
"x-appwrite": {
"method": "deleteFile",
"group": "files",
"weight": 218,
"weight": 219,
"cookies": false,
"type": "",
"deprecated": false,
@ -6375,7 +6486,7 @@
"x-appwrite": {
"method": "getFileDownload",
"group": "files",
"weight": 214,
"weight": 215,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6454,7 +6565,7 @@
"x-appwrite": {
"method": "getFilePreview",
"group": "files",
"weight": 213,
"weight": 214,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6660,7 +6771,7 @@
"x-appwrite": {
"method": "getFileView",
"group": "files",
"weight": 215,
"weight": 216,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6739,7 +6850,7 @@
"x-appwrite": {
"method": "list",
"group": "teams",
"weight": 222,
"weight": 223,
"cookies": false,
"type": "",
"deprecated": false,
@ -6814,7 +6925,7 @@
"x-appwrite": {
"method": "create",
"group": "teams",
"weight": 221,
"weight": 222,
"cookies": false,
"type": "",
"deprecated": false,
@ -6904,7 +7015,7 @@
"x-appwrite": {
"method": "get",
"group": "teams",
"weight": 223,
"weight": 224,
"cookies": false,
"type": "",
"deprecated": false,
@ -6966,7 +7077,7 @@
"x-appwrite": {
"method": "updateName",
"group": "teams",
"weight": 225,
"weight": 226,
"cookies": false,
"type": "",
"deprecated": false,
@ -7041,7 +7152,7 @@
"x-appwrite": {
"method": "delete",
"group": "teams",
"weight": 227,
"weight": 228,
"cookies": false,
"type": "",
"deprecated": false,
@ -7103,7 +7214,7 @@
"x-appwrite": {
"method": "listMemberships",
"group": "memberships",
"weight": 229,
"weight": 230,
"cookies": false,
"type": "",
"deprecated": false,
@ -7186,7 +7297,7 @@
"x-appwrite": {
"method": "createMembership",
"group": "memberships",
"weight": 228,
"weight": 229,
"cookies": false,
"type": "",
"deprecated": false,
@ -7299,7 +7410,7 @@
"x-appwrite": {
"method": "getMembership",
"group": "memberships",
"weight": 230,
"weight": 231,
"cookies": false,
"type": "",
"deprecated": false,
@ -7369,7 +7480,7 @@
"x-appwrite": {
"method": "updateMembership",
"group": "memberships",
"weight": 231,
"weight": 232,
"cookies": false,
"type": "",
"deprecated": false,
@ -7455,7 +7566,7 @@
"x-appwrite": {
"method": "deleteMembership",
"group": "memberships",
"weight": 233,
"weight": 234,
"cookies": false,
"type": "",
"deprecated": false,
@ -7527,7 +7638,7 @@
"x-appwrite": {
"method": "updateMembershipStatus",
"group": "memberships",
"weight": 232,
"weight": 233,
"cookies": false,
"type": "",
"deprecated": false,
@ -7621,7 +7732,7 @@
"x-appwrite": {
"method": "getPrefs",
"group": "teams",
"weight": 224,
"weight": 225,
"cookies": false,
"type": "",
"deprecated": false,
@ -7682,7 +7793,7 @@
"x-appwrite": {
"method": "updatePrefs",
"group": "teams",
"weight": 226,
"weight": 227,
"cookies": false,
"type": "",
"deprecated": false,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -61,6 +61,12 @@
"name": "X-Appwrite-Session",
"description": "The user session to authenticate with",
"in": "header"
},
"DevKey": {
"type": "apiKey",
"name": "X-Appwrite-Dev-Key",
"description": "Your secret dev API key",
"in": "header"
}
},
"paths": {
@ -4791,6 +4797,111 @@
}
]
},
"put": {
"summary": "Upsert document",
"operationId": "databasesUpsertDocument",
"consumes": [
"application\/json"
],
"produces": [
"application\/json"
],
"tags": [
"databases"
],
"description": "Create or update a 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.",
"responses": {
"200": {
"description": "Document",
"schema": {
"$ref": "#\/definitions\/document"
}
}
},
"x-appwrite": {
"method": "upsertDocument",
"group": "documents",
"weight": 114,
"cookies": false,
"type": "",
"deprecated": false,
"demo": "databases\/upsert-document.md",
"edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/master\/docs\/references\/databases\/upsert-document.md",
"rate-limit": 120,
"rate-time": 60,
"rate-key": "ip:{ip},method:{method},url:{url},userId:{userId}",
"scope": "documents.write",
"platforms": [
"client",
"server",
"server"
],
"packaging": false,
"auth": {
"Project": []
}
},
"security": [
{
"Project": [],
"Session": [],
"JWT": []
}
],
"parameters": [
{
"name": "databaseId",
"description": "Database ID.",
"required": true,
"type": "string",
"x-example": "<DATABASE_ID>",
"in": "path"
},
{
"name": "collectionId",
"description": "Collection ID.",
"required": true,
"type": "string",
"x-example": "<COLLECTION_ID>",
"in": "path"
},
{
"name": "documentId",
"description": "Document ID.",
"required": true,
"type": "string",
"x-example": "<DOCUMENT_ID>",
"in": "path"
},
{
"name": "payload",
"in": "body",
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"description": "Document data as JSON object. Include all required attributes of the document to be created or updated.",
"default": {},
"x-example": "{}"
},
"permissions": {
"type": "array",
"description": "An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https:\/\/appwrite.io\/docs\/permissions).",
"default": null,
"x-example": "[\"read(\"any\")\"]",
"items": {
"type": "string"
}
}
},
"required": [
"data"
]
}
}
]
},
"patch": {
"summary": "Update document",
"operationId": "databasesUpdateDocument",
@ -4912,7 +5023,7 @@
"x-appwrite": {
"method": "deleteDocument",
"group": "documents",
"weight": 116,
"weight": 117,
"cookies": false,
"type": "",
"deprecated": false,
@ -4990,7 +5101,7 @@
"x-appwrite": {
"method": "listExecutions",
"group": "executions",
"weight": 391,
"weight": 392,
"cookies": false,
"type": "",
"deprecated": false,
@ -5064,7 +5175,7 @@
"x-appwrite": {
"method": "createExecution",
"group": "executions",
"weight": 389,
"weight": 390,
"cookies": false,
"type": "",
"deprecated": false,
@ -5181,7 +5292,7 @@
"x-appwrite": {
"method": "getExecution",
"group": "executions",
"weight": 390,
"weight": 391,
"cookies": false,
"type": "",
"deprecated": false,
@ -5253,7 +5364,7 @@
"x-appwrite": {
"method": "query",
"group": "graphql",
"weight": 305,
"weight": 306,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5327,7 +5438,7 @@
"x-appwrite": {
"method": "mutation",
"group": "graphql",
"weight": 304,
"weight": 305,
"cookies": false,
"type": "graphql",
"deprecated": false,
@ -5399,7 +5510,7 @@
"x-appwrite": {
"method": "get",
"group": null,
"weight": 121,
"weight": 122,
"cookies": false,
"type": "",
"deprecated": false,
@ -5451,7 +5562,7 @@
"x-appwrite": {
"method": "listCodes",
"group": null,
"weight": 122,
"weight": 123,
"cookies": false,
"type": "",
"deprecated": false,
@ -5503,7 +5614,7 @@
"x-appwrite": {
"method": "listContinents",
"group": null,
"weight": 126,
"weight": 127,
"cookies": false,
"type": "",
"deprecated": false,
@ -5555,7 +5666,7 @@
"x-appwrite": {
"method": "listCountries",
"group": null,
"weight": 123,
"weight": 124,
"cookies": false,
"type": "",
"deprecated": false,
@ -5607,7 +5718,7 @@
"x-appwrite": {
"method": "listCountriesEU",
"group": null,
"weight": 124,
"weight": 125,
"cookies": false,
"type": "",
"deprecated": false,
@ -5659,7 +5770,7 @@
"x-appwrite": {
"method": "listCountriesPhones",
"group": null,
"weight": 125,
"weight": 126,
"cookies": false,
"type": "",
"deprecated": false,
@ -5711,7 +5822,7 @@
"x-appwrite": {
"method": "listCurrencies",
"group": null,
"weight": 127,
"weight": 128,
"cookies": false,
"type": "",
"deprecated": false,
@ -5763,7 +5874,7 @@
"x-appwrite": {
"method": "listLanguages",
"group": null,
"weight": 128,
"weight": 129,
"cookies": false,
"type": "",
"deprecated": false,
@ -5817,7 +5928,7 @@
"x-appwrite": {
"method": "createSubscriber",
"group": "subscribers",
"weight": 351,
"weight": 352,
"cookies": false,
"type": "",
"deprecated": false,
@ -5902,7 +6013,7 @@
"x-appwrite": {
"method": "deleteSubscriber",
"group": "subscribers",
"weight": 355,
"weight": 356,
"cookies": false,
"type": "",
"deprecated": false,
@ -5973,7 +6084,7 @@
"x-appwrite": {
"method": "listFiles",
"group": "files",
"weight": 211,
"weight": 212,
"cookies": false,
"type": "",
"deprecated": false,
@ -6056,7 +6167,7 @@
"x-appwrite": {
"method": "createFile",
"group": "files",
"weight": 210,
"weight": 211,
"cookies": false,
"type": "upload",
"deprecated": false,
@ -6146,7 +6257,7 @@
"x-appwrite": {
"method": "getFile",
"group": "files",
"weight": 212,
"weight": 213,
"cookies": false,
"type": "",
"deprecated": false,
@ -6216,7 +6327,7 @@
"x-appwrite": {
"method": "updateFile",
"group": "files",
"weight": 217,
"weight": 218,
"cookies": false,
"type": "",
"deprecated": false,
@ -6305,7 +6416,7 @@
"x-appwrite": {
"method": "deleteFile",
"group": "files",
"weight": 218,
"weight": 219,
"cookies": false,
"type": "",
"deprecated": false,
@ -6375,7 +6486,7 @@
"x-appwrite": {
"method": "getFileDownload",
"group": "files",
"weight": 214,
"weight": 215,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6454,7 +6565,7 @@
"x-appwrite": {
"method": "getFilePreview",
"group": "files",
"weight": 213,
"weight": 214,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6660,7 +6771,7 @@
"x-appwrite": {
"method": "getFileView",
"group": "files",
"weight": 215,
"weight": 216,
"cookies": false,
"type": "location",
"deprecated": false,
@ -6739,7 +6850,7 @@
"x-appwrite": {
"method": "list",
"group": "teams",
"weight": 222,
"weight": 223,
"cookies": false,
"type": "",
"deprecated": false,
@ -6814,7 +6925,7 @@
"x-appwrite": {
"method": "create",
"group": "teams",
"weight": 221,
"weight": 222,
"cookies": false,
"type": "",
"deprecated": false,
@ -6904,7 +7015,7 @@
"x-appwrite": {
"method": "get",
"group": "teams",
"weight": 223,
"weight": 224,
"cookies": false,
"type": "",
"deprecated": false,
@ -6966,7 +7077,7 @@
"x-appwrite": {
"method": "updateName",
"group": "teams",
"weight": 225,
"weight": 226,
"cookies": false,
"type": "",
"deprecated": false,
@ -7041,7 +7152,7 @@
"x-appwrite": {
"method": "delete",
"group": "teams",
"weight": 227,
"weight": 228,
"cookies": false,
"type": "",
"deprecated": false,
@ -7103,7 +7214,7 @@
"x-appwrite": {
"method": "listMemberships",
"group": "memberships",
"weight": 229,
"weight": 230,
"cookies": false,
"type": "",
"deprecated": false,
@ -7186,7 +7297,7 @@
"x-appwrite": {
"method": "createMembership",
"group": "memberships",
"weight": 228,
"weight": 229,
"cookies": false,
"type": "",
"deprecated": false,
@ -7299,7 +7410,7 @@
"x-appwrite": {
"method": "getMembership",
"group": "memberships",
"weight": 230,
"weight": 231,
"cookies": false,
"type": "",
"deprecated": false,
@ -7369,7 +7480,7 @@
"x-appwrite": {
"method": "updateMembership",
"group": "memberships",
"weight": 231,
"weight": 232,
"cookies": false,
"type": "",
"deprecated": false,
@ -7455,7 +7566,7 @@
"x-appwrite": {
"method": "deleteMembership",
"group": "memberships",
"weight": 233,
"weight": 234,
"cookies": false,
"type": "",
"deprecated": false,
@ -7527,7 +7638,7 @@
"x-appwrite": {
"method": "updateMembershipStatus",
"group": "memberships",
"weight": 232,
"weight": 233,
"cookies": false,
"type": "",
"deprecated": false,
@ -7621,7 +7732,7 @@
"x-appwrite": {
"method": "getPrefs",
"group": "teams",
"weight": 224,
"weight": 225,
"cookies": false,
"type": "",
"deprecated": false,
@ -7682,7 +7793,7 @@
"x-appwrite": {
"method": "updatePrefs",
"group": "teams",
"weight": 226,
"weight": 227,
"cookies": false,
"type": "",
"deprecated": false,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1351,4 +1351,23 @@ return [
'providerVersion' => '0.3.*',
'variables' => [],
],
[
'key' => 'gallery-for-lynx',
'name' => 'Lynx gallery',
'tagline' => 'A Lynx website showcasing gallery with smooth animations.',
'score' => 1, // 0 to 10 based on looks of screenshot (avoid 1,2,3,8,9,10 if possible)
'useCases' => [UseCases::STARTER],
'screenshotDark' => $url . '/images/sites/templates/gallery-for-lynx-dark.png',
'screenshotLight' => $url . '/images/sites/templates/gallery-for-lynx-light.png',
'frameworks' => [
getFramework('LYNX', [
'providerRootDirectory' => './lynx/gallery',
]),
],
'vcsProvider' => 'github',
'providerRepositoryId' => 'templates-for-sites',
'providerOwner' => 'appwrite',
'providerVersion' => '0.3.*',
'variables' => []
],
];

View file

@ -1347,7 +1347,11 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string
->inject('dbForProject')
->inject('queueForDatabase')
->inject('queueForEvents')
->action(function (string $databaseId, string $collectionId, string $key, ?int $size, ?bool $required, ?string $default, bool $array, bool $encrypt, Response $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents) {
->inject('plan')
->action(function (string $databaseId, string $collectionId, string $key, ?int $size, ?bool $required, ?string $default, bool $array, bool $encrypt, Response $response, Database $dbForProject, EventDatabase $queueForDatabase, Event $queueForEvents, array $plan) {
if ($encrypt && !empty($plan) && !($plan['databasesAllowEncrypt'] ?? false)) {
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Encrypted string attributes are not available on your plan. Please upgrade to create encrypted string attributes.');
}
// Ensure attribute default is within required size
$validator = new Text($size, 0);
if (!is_null($default) && !$validator->isValid($default)) {
@ -3785,7 +3789,12 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen
throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage());
}
$document = $dbForProject->getDocument('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $documentId, $queries);
try {
$document = $dbForProject->getDocument('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), $documentId, $queries);
} catch (QueryException $e) {
throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage());
}
if ($document->isEmpty()) {
throw new Exception(Exception::DOCUMENT_NOT_FOUND);
}
@ -4202,6 +4211,244 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum
$response->dynamic($document, Response::MODEL_DOCUMENT);
});
App::put('/v1/databases/:databaseId/collections/:collectionId/documents/:documentId')
->desc('Upsert document')
->groups(['api', 'database'])
->label('event', 'databases.[databaseId].collections.[collectionId].documents.[documentId].upsert')
->label('scope', 'documents.write')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('audits.event', 'document.upsert')
->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}')
->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}')
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', new Method(
namespace: 'databases',
group: 'documents',
name: 'upsertDocument',
description: '/docs/references/databases/upsert-document.md',
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_DOCUMENT,
)
],
contentType: ContentType::JSON
))
->param('databaseId', '', new UID(), 'Database ID.')
->param('collectionId', '', new UID(), 'Collection ID.')
->param('documentId', '', new CustomId(), 'Document ID.')
->param('data', [], new JSON(), 'Document data as JSON object. Include all required attributes of the document to be created or updated.')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE]), 'An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
->inject('requestTimestamp')
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')
->inject('queueForStatsUsage')
->action(function (string $databaseId, string $collectionId, string $documentId, string|array $data, ?array $permissions, ?\DateTime $requestTimestamp, Response $response, Database $dbForProject, Event $queueForEvents, StatsUsage $queueForStatsUsage) {
$data = (\is_string($data)) ? \json_decode($data, true) : $data; // Cast to JSON array
if (empty($data) && \is_null($permissions)) {
throw new Exception(Exception::DOCUMENT_MISSING_PAYLOAD);
}
$isAPIKey = Auth::isAppUser(Authorization::getRoles());
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
$database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId));
if ($database->isEmpty() || (!$database->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) {
throw new Exception(Exception::DATABASE_NOT_FOUND);
}
$collection = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $collectionId));
if ($collection->isEmpty() || (!$collection->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) {
throw new Exception(Exception::COLLECTION_NOT_FOUND);
}
// Map aggregate permissions into the multiple permissions they represent.
$permissions = Permission::aggregate($permissions, [
Database::PERMISSION_READ,
Database::PERMISSION_UPDATE,
Database::PERMISSION_DELETE,
]);
// Users can only manage their own roles, API keys and Admin users can manage any
$roles = Authorization::getRoles();
if (!$isAPIKey && !$isPrivilegedUser && !\is_null($permissions)) {
foreach (Database::PERMISSIONS as $type) {
foreach ($permissions as $permission) {
$permission = Permission::parse($permission);
if ($permission->getPermission() != $type) {
continue;
}
$role = (new Role(
$permission->getRole(),
$permission->getIdentifier(),
$permission->getDimension()
))->toString();
if (!Authorization::isRole($role)) {
throw new Exception(Exception::USER_UNAUTHORIZED, 'Permissions must be one of: (' . \implode(', ', $roles) . ')');
}
}
}
}
$data['$id'] = $documentId;
$data['$permissions'] = $permissions;
$newDocument = new Document($data);
$operations = 0;
$setCollection = (function (Document $collection, Document $document) use (&$setCollection, $dbForProject, $database, &$operations) {
$operations++;
$relationships = \array_filter(
$collection->getAttribute('attributes', []),
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
);
foreach ($relationships as $relationship) {
$related = $document->getAttribute($relationship->getAttribute('key'));
if (empty($related)) {
continue;
}
$isList = \is_array($related) && \array_values($related) === $related;
if ($isList) {
$relations = $related;
} else {
$relations = [$related];
}
$relatedCollectionId = $relationship->getAttribute('relatedCollection');
$relatedCollection = Authorization::skip(
fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $relatedCollectionId)
);
foreach ($relations as &$relation) {
// If the relation is an array it can be either update or create a child document.
if (
\is_array($relation)
&& \array_values($relation) !== $relation
&& !isset($relation['$id'])
) {
$relation['$id'] = ID::unique();
$relation = new Document($relation);
}
if ($relation instanceof Document) {
$oldDocument = Authorization::skip(fn () => $dbForProject->getDocument(
'database_' . $database->getInternalId() . '_collection_' . $relatedCollection->getInternalId(),
$relation->getId()
));
$relation->removeAttribute('$collectionId');
$relation->removeAttribute('$databaseId');
// Attribute $collection is required for Utopia.
$relation->setAttribute(
'$collection',
'database_' . $database->getInternalId() . '_collection_' . $relatedCollection->getInternalId()
);
if ($oldDocument->isEmpty()) {
if (isset($relation['$id']) && $relation['$id'] === 'unique()') {
$relation['$id'] = ID::unique();
}
}
$setCollection($relatedCollection, $relation);
}
}
if ($isList) {
$document->setAttribute($relationship->getAttribute('key'), \array_values($relations));
} else {
$document->setAttribute($relationship->getAttribute('key'), \reset($relations));
}
}
});
$setCollection($collection, $newDocument);
$queueForStatsUsage
->addMetric(METRIC_DATABASES_OPERATIONS_WRITES, \max(1, $operations))
->addMetric(str_replace('{databaseInternalId}', $database->getInternalId(), METRIC_DATABASE_ID_OPERATIONS_WRITES), \max(1, $operations));
$upserted = [];
try {
$modified = $dbForProject->createOrUpdateDocuments(
'database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(),
[$newDocument],
onNext: function (Document $document) use (&$upserted) {
$upserted[] = $document;
},
);
} catch (ConflictException) {
throw new Exception(Exception::DOCUMENT_UPDATE_CONFLICT);
} catch (DuplicateException) {
throw new Exception(Exception::DOCUMENT_ALREADY_EXISTS);
} catch (RelationshipException $e) {
throw new Exception(Exception::RELATIONSHIP_VALUE_INVALID, $e->getMessage());
} catch (StructureException $e) {
throw new Exception(Exception::DOCUMENT_INVALID_STRUCTURE, $e->getMessage());
}
$document = $upserted[0];
// Add $collectionId and $databaseId for all documents
$processDocument = function (Document $collection, Document $document) use (&$processDocument, $dbForProject, $database) {
$document->setAttribute('$databaseId', $database->getId());
$document->setAttribute('$collectionId', $collection->getId());
$relationships = \array_filter(
$collection->getAttribute('attributes', []),
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
);
foreach ($relationships as $relationship) {
$related = $document->getAttribute($relationship->getAttribute('key'));
if (empty($related)) {
continue;
}
if (!\is_array($related)) {
$related = [$related];
}
$relatedCollectionId = $relationship->getAttribute('relatedCollection');
$relatedCollection = Authorization::skip(
fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $relatedCollectionId)
);
foreach ($related as $relation) {
if ($relation instanceof Document) {
$processDocument($relatedCollection, $relation);
}
}
}
};
$processDocument($collection, $document);
$relationships = \array_map(
fn ($document) => $document->getAttribute('key'),
\array_filter(
$collection->getAttribute('attributes', []),
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
)
);
$queueForEvents
->setParam('databaseId', $databaseId)
->setParam('collectionId', $collection->getId())
->setParam('documentId', $document->getId())
->setContext('collection', $collection)
->setContext('database', $database)
->setPayload($response->getPayload(), sensitive: $relationships);
$response->dynamic($document, Response::MODEL_DOCUMENT);
});
App::patch('/v1/databases/:databaseId/collections/:collectionId/documents')
->desc('Update documents')
->groups(['api', 'database'])

View file

@ -3,13 +3,16 @@
use Appwrite\ClamAV\Network;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
use Appwrite\PubSub\Adapter\Pool as PubSubPool;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response;
use Utopia\App;
use Utopia\Cache\Adapter\Pool as CachePool;
use Utopia\Config\Config;
use Utopia\Database\Adapter\Pool as DatabasePool;
use Utopia\Database\Document;
use Utopia\Domains\Validator\PublicDomain;
use Utopia\Pools\Group;
@ -34,8 +37,8 @@ App::get('/v1/health')
namespace: 'health',
group: 'health',
name: 'get',
auth: [AuthType::KEY],
description: '/docs/references/health/get.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -70,11 +73,11 @@ App::get('/v1/health/db')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'health',
name: 'getDB',
description: '/docs/references/health/get-db.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -86,8 +89,8 @@ App::get('/v1/health/db')
->inject('response')
->inject('pools')
->action(function (Response $response, Group $pools) {
$output = [];
$failures = [];
$configs = [
'Console.DB' => Config::getParam('pools-console'),
@ -97,7 +100,7 @@ App::get('/v1/health/db')
foreach ($configs as $key => $config) {
foreach ($config as $database) {
try {
$adapter = $pools->get($database)->pop()->getResource();
$adapter = new DatabasePool($pools->get($database));
$checkStart = \microtime(true);
@ -108,16 +111,16 @@ App::get('/v1/health/db')
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
} else {
$failure[] = $database;
$failures[] = $database;
}
} catch (\Throwable $th) {
$failure[] = $database;
} catch (\Throwable) {
$failures[] = $database;
}
}
}
if (!empty($failure)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'DB failure on: ' . implode(", ", $failure));
if (!empty($failures)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'DB failure on: ' . implode(", ", $failures));
}
$response->dynamic(new Document([
@ -131,11 +134,11 @@ App::get('/v1/health/cache')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'health',
name: 'getCache',
description: '/docs/references/health/get-cache.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -147,44 +150,39 @@ App::get('/v1/health/cache')
->inject('response')
->inject('pools')
->action(function (Response $response, Group $pools) {
$output = [];
$failures = [];
$configs = [
'Cache' => Config::getParam('pools-cache'),
];
foreach ($configs as $key => $config) {
foreach ($config as $database) {
foreach ($config as $cache) {
try {
/** @var \Utopia\Cache\Adapter $adapter */
$adapter = $pools->get($database)->pop()->getResource();
$adapter = new CachePool($pools->get($cache));
$checkStart = \microtime(true);
if ($adapter->ping()) {
$output[] = new Document([
'name' => $key . " ($database)",
'name' => $key . " ($cache)",
'status' => 'pass',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
} else {
$output[] = new Document([
'name' => $key . " ($database)",
'status' => 'fail',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
$failures[] = $cache;
}
} catch (\Throwable $th) {
$output[] = new Document([
'name' => $key . " ($database)",
'status' => 'fail',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
} catch (\Throwable) {
$failures[] = $cache;
}
}
}
if (!empty($failures)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Cache failure on: ' . implode(", ", $failures));
}
$response->dynamic(new Document([
'statuses' => $output,
'total' => count($output),
@ -196,11 +194,11 @@ App::get('/v1/health/pubsub')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'health',
name: 'getPubSub',
description: '/docs/references/health/get-pubsub.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -212,44 +210,39 @@ App::get('/v1/health/pubsub')
->inject('response')
->inject('pools')
->action(function (Response $response, Group $pools) {
$output = [];
$failures = [];
$configs = [
'PubSub' => Config::getParam('pools-pubsub'),
];
foreach ($configs as $key => $config) {
foreach ($config as $database) {
foreach ($config as $pubsub) {
try {
/** @var \Appwrite\PubSub\Adapter $adapter */
$adapter = $pools->get($database)->pop()->getResource();
$adapter = new PubSubPool($pools->get($pubsub));
$checkStart = \microtime(true);
if ($adapter->ping()) {
$output[] = new Document([
'name' => $key . " ($database)",
'name' => $key . " ($pubsub)",
'status' => 'pass',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
} else {
$output[] = new Document([
'name' => $key . " ($database)",
'status' => 'fail',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
$failures[] = $pubsub;
}
} catch (\Throwable $th) {
$output[] = new Document([
'name' => $key . " ($database)",
'status' => 'fail',
'ping' => \round((\microtime(true) - $checkStart) / 1000)
]);
} catch (\Throwable) {
$failures[] = $pubsub;
}
}
}
if (!empty($failures)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Pubsub failure on: ' . implode(", ", $failures));
}
$response->dynamic(new Document([
'statuses' => $output,
'total' => count($output),
@ -261,11 +254,11 @@ App::get('/v1/health/time')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'health',
name: 'getTime',
description: '/docs/references/health/get-time.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -325,11 +318,11 @@ App::get('/v1/health/queue/webhooks')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueWebhooks',
description: '/docs/references/health/get-queue-webhooks.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -351,18 +344,18 @@ App::get('/v1/health/queue/webhooks')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/logs')
->desc('Get logs queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueLogs',
description: '/docs/references/health/get-queue-logs.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -384,18 +377,18 @@ App::get('/v1/health/queue/logs')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/certificate')
->desc('Get the SSL certificate for a domain')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'health',
name: 'getCertificate',
description: '/docs/references/health/get-certificate.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -441,18 +434,18 @@ App::get('/v1/health/certificate')
'validTo' => $certificatePayload['validTo_time_t'],
'signatureTypeSN' => $certificatePayload['signatureTypeSN'],
]), Response::MODEL_HEALTH_CERTIFICATE);
}, ['response']);
});
App::get('/v1/health/queue/certificates')
->desc('Get certificates queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueCertificates',
description: '/docs/references/health/get-queue-certificates.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -474,18 +467,18 @@ App::get('/v1/health/queue/certificates')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/builds')
->desc('Get builds queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueBuilds',
description: '/docs/references/health/get-queue-builds.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -507,18 +500,18 @@ App::get('/v1/health/queue/builds')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/databases')
->desc('Get databases queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueDatabases',
description: '/docs/references/health/get-queue-databases.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -541,18 +534,18 @@ App::get('/v1/health/queue/databases')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/deletes')
->desc('Get deletes queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueDeletes',
description: '/docs/references/health/get-queue-deletes.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -574,18 +567,18 @@ App::get('/v1/health/queue/deletes')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/mails')
->desc('Get mails queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueMails',
description: '/docs/references/health/get-queue-mails.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -607,18 +600,18 @@ App::get('/v1/health/queue/mails')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/messaging')
->desc('Get messaging queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueMessaging',
description: '/docs/references/health/get-queue-messaging.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -640,18 +633,18 @@ App::get('/v1/health/queue/messaging')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/migrations')
->desc('Get migrations queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueMigrations',
description: '/docs/references/health/get-queue-migrations.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -673,18 +666,18 @@ App::get('/v1/health/queue/migrations')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/functions')
->desc('Get functions queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueFunctions',
description: '/docs/references/health/get-queue-functions.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -706,18 +699,18 @@ App::get('/v1/health/queue/functions')
}
$response->dynamic(new Document([ 'size' => $size ]), Response::MODEL_HEALTH_QUEUE);
}, ['response']);
});
App::get('/v1/health/queue/stats-resources')
->desc('Get stats resources queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueStatsResources',
description: '/docs/references/health/get-queue-stats-resources.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -746,11 +739,11 @@ App::get('/v1/health/queue/stats-usage')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getQueueUsage',
description: '/docs/references/health/get-queue-stats-usage.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -779,11 +772,11 @@ App::get('/v1/health/storage/local')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'storage',
name: 'getStorageLocal',
description: '/docs/references/health/get-storage-local.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -829,11 +822,11 @@ App::get('/v1/health/storage')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'storage',
name: 'getStorage',
description: '/docs/references/health/get-storage.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -878,11 +871,11 @@ App::get('/v1/health/anti-virus')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'health',
name: 'getAntivirus',
description: '/docs/references/health/get-storage-anti-virus.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
@ -924,11 +917,11 @@ App::get('/v1/health/queue/failed/:name')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
auth: [AuthType::KEY],
namespace: 'health',
group: 'queue',
name: 'getFailedJobs',
description: '/docs/references/health/get-failed-queue-jobs.md',
auth: [AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,

View file

@ -24,6 +24,7 @@ use Utopia\App;
use Utopia\Audit\Audit;
use Utopia\Cache\Cache;
use Utopia\Config\Config;
use Utopia\Database\Adapter\Pool as DatabasePool;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
@ -223,7 +224,7 @@ App::post('/v1/projects')
$sharedTables = $sharedTablesV1 || $sharedTablesV2;
if (!$sharedTablesV2) {
$adapter = $pools->get($dsn->getHost())->pop()->getResource();
$adapter = new DatabasePool($pools->get($dsn->getHost()));
$dbForProject = new Database($adapter, $cache);
if ($sharedTables) {

View file

@ -1241,12 +1241,15 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/download')
if (!empty($source)) {
if (!empty($rangeHeader)) {
$response->send(substr($source, $start, ($end - $start + 1)));
return;
}
$response->send($source);
return;
}
if (!empty($rangeHeader)) {
$response->send($deviceForFiles->read($path, $start, ($end - $start + 1)));
return;
}
if ($size > APP_STORAGE_READ_BUFFER) {
@ -1407,6 +1410,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/view')
if (!empty($source)) {
if (!empty($rangeHeader)) {
$response->send(substr($source, $start, ($end - $start + 1)));
return;
}
$response->send($source);
return;
@ -1558,6 +1562,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/push')
if (!empty($source)) {
if (!empty($rangeHeader)) {
$response->send(substr($source, $start, ($end - $start + 1)));
return;
}
$response->send($source);
return;

View file

@ -252,7 +252,6 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
'providerCommitUrl' => $providerCommitUrl,
'providerCommentId' => \strval($latestCommentId),
'providerBranch' => $providerBranch,
'search' => implode(' ', [$deploymentId, $resource->getAttribute('entrypoint', '')]),
'activate' => $activate,
])));

View file

@ -452,16 +452,33 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw
$endpoint = $protocol . '://' . $hostname . "/v1";
// Appwrite vars
if ($type === 'function') {
$vars = \array_merge($vars, [
'APPWRITE_FUNCTION_API_ENDPOINT' => $endpoint,
'APPWRITE_FUNCTION_ID' => $resource->getId(),
'APPWRITE_FUNCTION_NAME' => $resource->getAttribute('name'),
'APPWRITE_FUNCTION_DEPLOYMENT' => $deployment->getId(),
'APPWRITE_FUNCTION_PROJECT_ID' => $project->getId(),
'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'] ?? '',
'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '',
'APPWRITE_FUNCTION_CPUS' => $spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT,
'APPWRITE_FUNCTION_MEMORY' => $spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT,
]);
} elseif ($type === 'site') {
$vars = \array_merge($vars, [
'APPWRITE_SITE_API_ENDPOINT' => $endpoint,
'APPWRITE_SITE_ID' => $resource->getId(),
'APPWRITE_SITE_NAME' => $resource->getAttribute('name'),
'APPWRITE_SITE_DEPLOYMENT' => $deployment->getId(),
'APPWRITE_SITE_PROJECT_ID' => $project->getId(),
'APPWRITE_SITE_RUNTIME_NAME' => $runtime['name'] ?? '',
'APPWRITE_SITE_RUNTIME_VERSION' => $runtime['version'] ?? '',
'APPWRITE_SITE_CPUS' => $spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT,
'APPWRITE_SITE_MEMORY' => $spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT,
]);
}
$vars = \array_merge($vars, [
'APPWRITE_FUNCTION_API_ENDPOINT' => $endpoint,
'APPWRITE_FUNCTION_ID' => $resource->getId(),
'APPWRITE_FUNCTION_NAME' => $resource->getAttribute('name'),
'APPWRITE_FUNCTION_DEPLOYMENT' => $deployment->getId(),
'APPWRITE_FUNCTION_PROJECT_ID' => $project->getId(),
'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'] ?? '',
'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '',
'APPWRITE_FUNCTION_CPUS' => $spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT,
'APPWRITE_FUNCTION_MEMORY' => $spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT,
'APPWRITE_VERSION' => APP_VERSION_STABLE,
'APPWRITE_REGION' => $project->getAttribute('region'),
'APPWRITE_DEPLOYMENT_TYPE' => $deployment->getAttribute('type', ''),

View file

@ -15,9 +15,11 @@ use Utopia\Audit\Audit;
use Utopia\CLI\Console;
use Utopia\Compression\Compression;
use Utopia\Config\Config;
use Utopia\Database\Adapter\Pool as DatabasePool;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception\Duplicate as DuplicateException;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
@ -170,7 +172,7 @@ function createDatabase(App $app, string $resourceKey, string $dbName, array $co
$sleep = 1;
$attempts = 0;
do {
while (true) {
try {
$attempts++;
$resource = $app->getResource($resourceKey);
@ -179,13 +181,12 @@ function createDatabase(App $app, string $resourceKey, string $dbName, array $co
break; // exit loop on success
} catch (\Exception $e) {
Console::warning(" └── Database not ready. Retrying connection ({$attempts})...");
$pools->reclaim();
if ($attempts >= $max) {
throw new \Exception(' └── Failed to connect to database: ' . $e->getMessage());
}
sleep($sleep);
}
} while ($attempts < $max);
}
Console::success("[Setup] - $dbName database init started...");
@ -368,11 +369,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
$cache = $app->getResource('cache');
foreach ($sharedTablesV2 as $hostname) {
$adapter = $pools
->get($hostname)
->pop()
->getResource();
$adapter = new DatabasePool($pools->get($hostname));
$dbForProject = (new Database($adapter, $cache))
->setDatabase('appwrite')
->setSharedTables(true)
@ -382,7 +379,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
try {
Console::success('[Setup] - Creating project database: ' . $hostname . '...');
$dbForProject->create();
} catch (Duplicate) {
} catch (DuplicateException) {
Console::success('[Setup] - Skip: metadata table already exists');
}
@ -408,7 +405,6 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
}
}
$pools->reclaim();
Console::success('[Setup] - Server database init completed...');
});
@ -523,6 +519,7 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool
Console::error('[Error] Message: ' . $th->getMessage());
Console::error('[Error] File: ' . $th->getFile());
Console::error('[Error] Line: ' . $th->getLine());
Console::error('[Error] Trace: ' . $th->getTraceAsString());
$swooleResponse->setStatusCode(500);
@ -540,8 +537,6 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool
];
$swooleResponse->end(\json_encode($output));
} finally {
$pools->reclaim();
}
});

View file

@ -38,7 +38,7 @@ const APP_RESOURCE_TOKEN_ACCESS = 24 * 60 * 60; // 24 hours
const APP_FILE_ACCESS = 24 * 60 * 60; // 24 hours
const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours
const APP_CACHE_BUSTER = 4319;
const APP_VERSION_STABLE = '1.7.0';
const APP_VERSION_STABLE = '1.7.2';
const APP_DATABASE_ATTRIBUTE_EMAIL = 'email';
const APP_DATABASE_ATTRIBUTE_ENUM = 'enum';
const APP_DATABASE_ATTRIBUTE_IP = 'ip';

View file

@ -216,13 +216,13 @@ $register->set('pools', function () {
'mysql',
'mariadb' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) {
return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) {
return new PDO("mysql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};charset=utf8mb4", $dsnUser, $dsnPass, array(
return new PDO("mysql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase};charset=utf8mb4", $dsnUser, $dsnPass, [
\PDO::ATTR_TIMEOUT => 3, // Seconds
\PDO::ATTR_PERSISTENT => false,
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
\PDO::ATTR_EMULATE_PREPARES => true,
\PDO::ATTR_STRINGIFY_FETCHES => true
));
]);
});
},
'redis' => function () use ($dsnHost, $dsnPort, $dsnPass) {

View file

@ -24,10 +24,12 @@ use Appwrite\Utopia\Request;
use Executor\Executor;
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
use Utopia\App;
use Utopia\Cache\Adapter\Pool as CachePool;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
use Utopia\Config\Config;
use Utopia\Database\Adapter\Pool as DatabasePool;
use Utopia\Database\Database;
use Utopia\Database\DateTime as DatabaseDateTime;
use Utopia\Database\Document;
@ -38,6 +40,7 @@ use Utopia\DSN\DSN;
use Utopia\Locale\Locale;
use Utopia\Logger\Log;
use Utopia\Pools\Group;
use Utopia\Queue\Broker\Pool as BrokerPool;
use Utopia\Queue\Publisher;
use Utopia\Storage\Device;
use Utopia\Storage\Device\AWS;
@ -74,10 +77,10 @@ App::setResource('localeCodes', function () {
// Queues
App::setResource('publisher', function (Group $pools) {
return $pools->get('publisher')->pop()->getResource();
return new BrokerPool(publisher: $pools->get('publisher'));
}, ['pools']);
App::setResource('consumer', function (Group $pools) {
return $pools->get('consumer')->pop()->getResource();
return new BrokerPool(consumer: $pools->get('consumer'));
}, ['pools']);
App::setResource('queueForMessaging', function (Publisher $publisher) {
return new Messaging($publisher);
@ -331,12 +334,8 @@ App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform
$dsn = new DSN('mysql://' . $project->getAttribute('database'));
}
$dbAdapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$adapter = new DatabasePool($pools->get($dsn->getHost()));
$database = new Database($adapter, $cache);
$database
->setMetadata('host', \gethostname())
@ -362,12 +361,8 @@ App::setResource('dbForProject', function (Group $pools, Database $dbForPlatform
}, ['pools', 'dbForPlatform', 'cache', 'project']);
App::setResource('dbForPlatform', function (Group $pools, Cache $cache) {
$dbAdapter = $pools
->get('console')
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$adapter = new DatabasePool($pools->get('console'));
$database = new Database($adapter, $cache);
$database
->setNamespace('_console')
@ -380,7 +375,7 @@ App::setResource('dbForPlatform', function (Group $pools, Cache $cache) {
}, ['pools', 'cache']);
App::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache) {
$databases = []; // TODO: @Meldiron This should probably be responsibility of utopia-php/pools
$databases = [];
return function (Document $project) use ($pools, $dbForPlatform, $cache, &$databases) {
if ($project->isEmpty() || $project->getId() === 'console') {
@ -422,12 +417,8 @@ App::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform
return $database;
}
$dbAdapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$adapter = new DatabasePool($pools->get($dsn->getHost()));
$database = new Database($adapter, $cache);
$databases[$dsn->getHost()] = $database;
$configure($database);
@ -437,21 +428,15 @@ App::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform
App::setResource('getLogsDB', function (Group $pools, Cache $cache) {
$database = null;
return function (?Document $project = null) use ($pools, $cache, $database) {
return function (?Document $project = null) use ($pools, $cache, &$database) {
if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') {
$database->setTenant($project->getInternalId());
return $database;
}
$dbAdapter = $pools
->get('logs')
->pop()
->getResource();
$database = new Database(
$dbAdapter,
$cache
);
$adapter = new DatabasePool($pools->get('logs'));
$database = new Database($adapter, $cache);
$database
->setSharedTables(true)
@ -475,10 +460,7 @@ App::setResource('cache', function (Group $pools) {
$adapters = [];
foreach ($list as $value) {
$adapters[] = $pools
->get($value)
->pop()
->getResource();
$adapters[] = new CachePool($pools->get($value));
}
return new Cache(new Sharding($adapters));

View file

@ -5,6 +5,7 @@ use Appwrite\Extend\Exception;
use Appwrite\Extend\Exception as AppwriteException;
use Appwrite\Messaging\Adapter\Realtime;
use Appwrite\Network\Validator\Origin;
use Appwrite\PubSub\Adapter\Pool as PubSubPool;
use Appwrite\Utopia\Request;
use Appwrite\Utopia\Response;
use Swoole\Http\Request as SwooleRequest;
@ -15,10 +16,12 @@ use Swoole\Timer;
use Utopia\Abuse\Abuse;
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
use Utopia\App;
use Utopia\Cache\Adapter\Pool as CachePool;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
use Utopia\Config\Config;
use Utopia\Database\Adapter\Pool as DatabasePool;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
@ -28,13 +31,15 @@ use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\DSN\DSN;
use Utopia\Logger\Log;
use Utopia\Pools\Group;
use Utopia\Registry\Registry;
use Utopia\System\System;
use Utopia\Telemetry\Adapter\None as NoTelemetry;
use Utopia\WebSocket\Adapter;
use Utopia\WebSocket\Server;
/**
* @var \Utopia\Registry\Registry $register
* @var Registry $register
*/
require_once __DIR__ . '/init.php';
@ -46,17 +51,17 @@ if (!function_exists('getConsoleDB')) {
{
global $register;
/** @var \Utopia\Pools\Group $pools */
static $database = null;
if ($database !== null) {
return $database;
}
/** @var Group $pools */
$pools = $register->get('pools');
$dbAdapter = $pools
->get('console')
->pop()
->getResource()
;
$database = new Database($dbAdapter, getCache());
$adapter = new DatabasePool($pools->get('console'));
$database = new Database($adapter, getCache());
$database
->setNamespace('_console')
->setMetadata('host', \gethostname())
@ -72,7 +77,13 @@ if (!function_exists('getProjectDB')) {
{
global $register;
/** @var \Utopia\Pools\Group $pools */
static $databases = [];
if (isset($databases[$project->getInternalId()])) {
return $databases[$project->getInternalId()];
}
/** @var Group $pools */
$pools = $register->get('pools');
if ($project->isEmpty() || $project->getId() === 'console') {
@ -86,11 +97,7 @@ if (!function_exists('getProjectDB')) {
$dsn = new DSN('mysql://' . $project->getAttribute('database'));
}
$adapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$adapter = new DatabasePool($pools->get($dsn->getHost()));
$database = new Database($adapter, getCache());
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
@ -111,7 +118,7 @@ if (!function_exists('getProjectDB')) {
->setMetadata('host', \gethostname())
->setMetadata('project', $project->getId());
return $database;
return $databases[$project->getInternalId()] = $database;
}
}
@ -121,20 +128,22 @@ if (!function_exists('getCache')) {
{
global $register;
$pools = $register->get('pools'); /** @var \Utopia\Pools\Group $pools */
static $cache = null;
if ($cache !== null) {
return $cache;
}
$pools = $register->get('pools'); /** @var Group $pools */
$list = Config::getParam('pools-cache', []);
$adapters = [];
foreach ($list as $value) {
$adapters[] = $pools
->get($value)
->pop()
->getResource()
;
$adapters[] = new CachePool($pools->get($value));
}
return new Cache(new Sharding($adapters));
return $cache = new Cache(new Sharding($adapters));
}
}
@ -142,6 +151,12 @@ if (!function_exists('getCache')) {
if (!function_exists('getRedis')) {
function getRedis(): \Redis
{
static $redis = null;
if ($redis !== null) {
return $redis;
}
$host = System::getEnv('_APP_REDIS_HOST', 'localhost');
$port = System::getEnv('_APP_REDIS_PORT', 6379);
$pass = System::getEnv('_APP_REDIS_PASS', '');
@ -160,21 +175,39 @@ if (!function_exists('getRedis')) {
if (!function_exists('getTimelimit')) {
function getTimelimit(): TimeLimitRedis
{
return new TimeLimitRedis("", 0, 1, getRedis());
static $timelimit = null;
if ($timelimit !== null) {
return $timelimit;
}
return $timelimit = new TimeLimitRedis("", 0, 1, getRedis());
}
}
if (!function_exists('getRealtime')) {
function getRealtime(): Realtime
{
return new Realtime();
static $realtime = null;
if ($realtime !== null) {
return $realtime;
}
return $realtime = new Realtime();
}
}
if (!function_exists('getTelemetry')) {
function getTelemetry(int $workerId): Utopia\Telemetry\Adapter
{
return new NoTelemetry();
static $telemetry = null;
if ($telemetry !== null) {
return $telemetry;
}
return $telemetry = new NoTelemetry();
}
}
@ -273,7 +306,6 @@ $server->onStart(function () use ($stats, $register, $containerId, &$statsDocume
sleep(DATABASE_RECONNECT_SLEEP);
}
} while (true);
$register->get('pools')->reclaim();
});
/**
@ -299,9 +331,7 @@ $server->onStart(function () use ($stats, $register, $containerId, &$statsDocume
Authorization::skip(fn () => $database->updateDocument('realtime', $statsDocument->getId(), $statsDocument));
} catch (Throwable $th) {
call_user_func($logError, $th, "updateWorkerDocument");
} finally {
$register->get('pools')->reclaim();
$logError($th, "updateWorkerDocument");
}
});
}
@ -370,8 +400,6 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
'data' => $event['data']
]));
}
$register->get('pools')->reclaim();
}
}
/**
@ -407,8 +435,8 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
}
$start = time();
/** @var \Appwrite\PubSub\Adapter $pubsub */
$pubsub = $register->get('pools')->get('pubsub')->pop()->getResource();
$pubsub = new PubSubPool($register->get('pools')->get('pubsub'));
if ($pubsub->ping(true)) {
$attempts = 0;
Console::success('Pub/sub connection established (worker: ' . $workerId . ')');
@ -436,8 +464,6 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
$realtime->unsubscribe($connection);
$realtime->subscribe($projectId, $connection, $roles, $channels);
$register->get('pools')->reclaim();
}
}
@ -463,14 +489,12 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
}
});
} catch (Throwable $th) {
call_user_func($logError, $th, "pubSubConnection");
$logError($th, "pubSubConnection");
Console::error('Pub/sub error: ' . $th->getMessage());
$attempts++;
sleep(DATABASE_RECONNECT_SLEEP);
continue;
} finally {
$register->get('pools')->reclaim();
}
}
@ -572,7 +596,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
$stats->incr($project->getId(), 'connections');
$stats->incr($project->getId(), 'connectionsTotal');
} catch (Throwable $th) {
call_user_func($logError, $th, "initServer");
$logError($th, "initServer");
// Handle SQL error code is 'HY000'
$code = $th->getCode();
@ -596,8 +620,6 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
Console::error('[Error] Code: ' . $response['data']['code']);
Console::error('[Error] Message: ' . $response['data']['message']);
}
} finally {
$register->get('pools')->reclaim();
}
});
@ -696,8 +718,6 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
if ($th->getCode() === 1008) {
$server->close($connection, $th->getCode());
}
} finally {
$register->get('pools')->reclaim();
}
});

View file

@ -177,7 +177,7 @@ $image = $this->getParam('image', '');
appwrite-console:
<<: *x-logging
container_name: appwrite-console
image: <?php echo $organization; ?>/console:6.0.1
image: <?php echo $organization; ?>/console:6.0.8
restart: unless-stopped
networks:
- appwrite

View file

@ -20,10 +20,12 @@ use Appwrite\Platform\Appwrite;
use Executor\Executor;
use Swoole\Runtime;
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
use Utopia\Cache\Adapter\Pool as CachePool;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
use Utopia\Config\Config;
use Utopia\Database\Adapter\Pool as DatabasePool;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
@ -33,6 +35,7 @@ use Utopia\Logger\Log;
use Utopia\Logger\Logger;
use Utopia\Platform\Service;
use Utopia\Pools\Group;
use Utopia\Queue\Broker\Pool as BrokerPool;
use Utopia\Queue\Message;
use Utopia\Queue\Publisher;
use Utopia\Queue\Server;
@ -41,21 +44,17 @@ use Utopia\System\System;
use Utopia\Telemetry\Adapter\None as NoTelemetry;
Authorization::disable();
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
Runtime::enableCoroutine();
Server::setResource('register', fn () => $register);
Server::setResource('dbForPlatform', function (Cache $cache, Registry $register) {
$pools = $register->get('pools');
$database = $pools
->get('console')
->pop()
->getResource();
$adapter = new DatabasePool($pools->get('console'));
$dbForPlatform = new Database($adapter, $cache);
$dbForPlatform->setNamespace('_console');
$adapter = new Database($database, $cache);
$adapter->setNamespace('_console');
return $adapter;
return $dbForPlatform;
}, ['cache', 'register']);
Server::setResource('project', function (Message $message, Database $dbForPlatform) {
@ -83,20 +82,9 @@ Server::setResource('dbForProject', function (Cache $cache, Registry $register,
$dsn = new DSN('mysql://' . $project->getAttribute('database'));
}
$adapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$adapter = new DatabasePool($pools->get($dsn->getHost()));
$database = new Database($adapter, $cache);
try {
$dsn = new DSN($project->getAttribute('database'));
} catch (\InvalidArgumentException) {
// TODO: Temporary until all projects are using shared tables
$dsn = new DSN('mysql://' . $project->getAttribute('database'));
}
$sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', ''));
if (\in_array($dsn->getHost(), $sharedTables)) {
@ -151,12 +139,8 @@ Server::setResource('getProjectDB', function (Group $pools, Database $dbForPlatf
return $database;
}
$dbAdapter = $pools
->get($dsn->getHost())
->pop()
->getResource();
$database = new Database($dbAdapter, $cache);
$adapter = new DatabasePool($pools->get($dsn->getHost()));
$database = new Database($adapter, $cache);
$databases[$dsn->getHost()] = $database;
@ -188,15 +172,8 @@ Server::setResource('getLogsDB', function (Group $pools, Cache $cache) {
return $database;
}
$dbAdapter = $pools
->get('logs')
->pop()
->getResource();
$database = new Database(
$dbAdapter,
$cache
);
$adapter = new DatabasePool($pools->get('logs'));
$database = new Database($adapter, $cache);
$database
->setSharedTables(true)
@ -234,11 +211,7 @@ Server::setResource('cache', function (Registry $register) {
$adapters = [];
foreach ($list as $value) {
$adapters[] = $pools
->get($value)
->pop()
->getResource()
;
$adapters[] = new CachePool($pools->get($value));
}
return new Cache(new Sharding($adapters));
@ -268,11 +241,11 @@ Server::setResource('timelimit', function (\Redis $redis) {
Server::setResource('log', fn () => new Log());
Server::setResource('publisher', function (Group $pools) {
return $pools->get('publisher')->pop()->getResource();
return new BrokerPool(publisher: $pools->get('publisher'));
}, ['pools']);
Server::setResource('consumer', function (Group $pools) {
return $pools->get('consumer')->pop()->getResource();
return new BrokerPool(consumer: $pools->get('consumer'));
}, ['pools']);
Server::setResource('queueForStatsUsage', function (Publisher $publisher) {
@ -463,13 +436,6 @@ try {
$worker = $platform->getWorker();
$worker
->shutdown()
->inject('pools')
->action(function (Group $pools) {
$pools->reclaim();
});
$worker
->error()
->inject('error')
@ -477,8 +443,7 @@ $worker
->inject('log')
->inject('pools')
->inject('project')
->action(function (Throwable $error, ?Logger $logger, Log $log, Group $pools, Document $project) use ($queueName) {
$pools->reclaim();
->action(function (Throwable $error, ?Logger $logger, Log $log, Group $pools, Document $project) use ($worker, $queueName) {
$version = System::getEnv('_APP_VERSION', 'UNKNOWN');
if ($logger) {

View file

@ -54,7 +54,7 @@
"utopia-php/config": "0.2.*",
"utopia-php/detector": "0.1.*",
"utopia-php/database": "0.69.*",
"utopia-php/domains": "0.5.*",
"utopia-php/domains": "0.8.0",
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
"utopia-php/fetch": "0.4.*",
@ -67,7 +67,7 @@
"utopia-php/platform": "0.7.*",
"utopia-php/pools": "0.8.*",
"utopia-php/preloader": "0.2.*",
"utopia-php/queue": "0.9.*",
"utopia-php/queue": "0.10.*",
"utopia-php/registry": "0.5.*",
"utopia-php/storage": "0.18.*",
"utopia-php/swoole": "0.8.*",

76
composer.lock generated
View file

@ -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": "735023e2b70ce47fe65985f195b257bd",
"content-hash": "9f5de64d73e2ef73d796fa64f2baf232",
"packages": [
{
"name": "adhocore/jwt",
@ -3555,16 +3555,16 @@
},
{
"name": "utopia-php/detector",
"version": "0.1.4",
"version": "0.1.5",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/detector.git",
"reference": "895a4147463965b5f9cbc083b764b6476f547879"
"reference": "b5d6ba51352485b524589bc0ee8d07a9efafe718"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/detector/zipball/895a4147463965b5f9cbc083b764b6476f547879",
"reference": "895a4147463965b5f9cbc083b764b6476f547879",
"url": "https://api.github.com/repos/utopia-php/detector/zipball/b5d6ba51352485b524589bc0ee8d07a9efafe718",
"reference": "b5d6ba51352485b524589bc0ee8d07a9efafe718",
"shasum": ""
},
"require": {
@ -3594,30 +3594,31 @@
],
"support": {
"issues": "https://github.com/utopia-php/detector/issues",
"source": "https://github.com/utopia-php/detector/tree/0.1.4"
"source": "https://github.com/utopia-php/detector/tree/0.1.5"
},
"time": "2025-04-09T11:50:45+00:00"
"time": "2025-05-19T11:01:28+00:00"
},
{
"name": "utopia-php/domains",
"version": "0.5.0",
"version": "0.8.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/domains.git",
"reference": "bf07f60326f8389f378ddf6fcde86217e5cfe18c"
"reference": "650463d2a1525273eb03223c48da9fb1a768bbf7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/domains/zipball/bf07f60326f8389f378ddf6fcde86217e5cfe18c",
"reference": "bf07f60326f8389f378ddf6fcde86217e5cfe18c",
"url": "https://api.github.com/repos/utopia-php/domains/zipball/650463d2a1525273eb03223c48da9fb1a768bbf7",
"reference": "650463d2a1525273eb03223c48da9fb1a768bbf7",
"shasum": ""
},
"require": {
"php": ">=8.0",
"utopia-php/framework": "0.*.*"
"utopia-php/framework": "0.33.*"
},
"require-dev": {
"laravel/pint": "1.2.*",
"phpstan/phpstan": "1.9.x-dev",
"phpunit/phpunit": "^9.3"
},
"type": "library",
@ -3654,9 +3655,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/domains/issues",
"source": "https://github.com/utopia-php/domains/tree/0.5.0"
"source": "https://github.com/utopia-php/domains/tree/0.8.0"
},
"time": "2024-01-03T22:04:27+00:00"
"time": "2025-05-16T10:03:59+00:00"
},
{
"name": "utopia-php/dsn",
@ -3746,16 +3747,16 @@
},
{
"name": "utopia-php/framework",
"version": "0.33.19",
"version": "0.33.20",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/http.git",
"reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0"
"reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/http/zipball/64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0",
"reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0",
"url": "https://api.github.com/repos/utopia-php/http/zipball/e1c7ab4e0b5b0a9a70256b1e00912e101e76a131",
"reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131",
"shasum": ""
},
"require": {
@ -3787,9 +3788,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/http/issues",
"source": "https://github.com/utopia-php/http/tree/0.33.19"
"source": "https://github.com/utopia-php/http/tree/0.33.20"
},
"time": "2025-03-06T11:37:49+00:00"
"time": "2025-05-18T23:51:21+00:00"
},
{
"name": "utopia-php/image",
@ -4104,16 +4105,16 @@
},
{
"name": "utopia-php/platform",
"version": "0.7.4",
"version": "0.7.7",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/platform.git",
"reference": "a5b93d8177702ec458c3af9137663133c012b71b"
"reference": "8c43cd866148a7c4c495e3401268429e338004b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/platform/zipball/a5b93d8177702ec458c3af9137663133c012b71b",
"reference": "a5b93d8177702ec458c3af9137663133c012b71b",
"url": "https://api.github.com/repos/utopia-php/platform/zipball/8c43cd866148a7c4c495e3401268429e338004b3",
"reference": "8c43cd866148a7c4c495e3401268429e338004b3",
"shasum": ""
},
"require": {
@ -4122,11 +4123,11 @@
"php": ">=8.0",
"utopia-php/cli": "0.15.*",
"utopia-php/framework": "0.33.*",
"utopia-php/queue": "0.9.*"
"utopia-php/queue": "0.10.*"
},
"require-dev": {
"laravel/pint": "1.2.*",
"phpunit/phpunit": "^9.3"
"laravel/pint": "1.*",
"phpunit/phpunit": "9.*"
},
"type": "library",
"autoload": {
@ -4148,9 +4149,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/platform/issues",
"source": "https://github.com/utopia-php/platform/tree/0.7.4"
"source": "https://github.com/utopia-php/platform/tree/0.7.7"
},
"time": "2025-03-13T13:00:12+00:00"
"time": "2025-05-20T09:23:44+00:00"
},
{
"name": "utopia-php/pools",
@ -4259,16 +4260,16 @@
},
{
"name": "utopia-php/queue",
"version": "0.9.1",
"version": "0.10.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/queue.git",
"reference": "32b6f84c55aae761db5a5ae76cc91ca8dbc8bc32"
"reference": "0eccc559168ea72241c39a4c482d868314666be1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/queue/zipball/32b6f84c55aae761db5a5ae76cc91ca8dbc8bc32",
"reference": "32b6f84c55aae761db5a5ae76cc91ca8dbc8bc32",
"url": "https://api.github.com/repos/utopia-php/queue/zipball/0eccc559168ea72241c39a4c482d868314666be1",
"reference": "0eccc559168ea72241c39a4c482d868314666be1",
"shasum": ""
},
"require": {
@ -4277,6 +4278,7 @@
"utopia-php/cli": "0.15.*",
"utopia-php/fetch": "0.4.*",
"utopia-php/framework": "0.33.*",
"utopia-php/pools": "0.8.*",
"utopia-php/telemetry": "0.1.*"
},
"require-dev": {
@ -4318,9 +4320,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/queue/issues",
"source": "https://github.com/utopia-php/queue/tree/0.9.1"
"source": "https://github.com/utopia-php/queue/tree/0.10.0"
},
"time": "2025-03-28T19:49:36+00:00"
"time": "2025-04-17T12:15:52+00:00"
},
{
"name": "utopia-php/registry",
@ -8240,7 +8242,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -8264,5 +8266,5 @@
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.6.0"
"plugin-api-version": "2.3.0"
}

View file

@ -213,7 +213,7 @@ services:
appwrite-console:
<<: *x-logging
container_name: appwrite-console
image: appwrite/console:6.0.1
image: appwrite/console:6.0.8
restart: unless-stopped
networks:
- appwrite
@ -951,7 +951,7 @@ services:
hostname: exc1
<<: *x-logging
stop_signal: SIGINT
image: openruntimes/executor:0.7.14
image: openruntimes/executor:0.7.16
restart: unless-stopped
networks:
- appwrite

View file

@ -0,0 +1,24 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Databases;
Client client = new Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setKey(""); //
Databases databases = new Databases(client);
databases.createDocuments(
"<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId
listOf(), // documents
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
Log.d("Appwrite", result.toString());
})
);

View file

@ -0,0 +1,26 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Databases;
Client client = new Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>"); // Your project ID
Databases databases = new Databases(client);
databases.upsertDocument(
"<DATABASE_ID>", // databaseId
"<COLLECTION_ID>", // collectionId
"<DOCUMENT_ID>", // documentId
mapOf( "a" to "b" ), // data
listOf("read("any")"), // permissions (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
Log.d("Appwrite", result.toString());
})
);

View file

@ -0,0 +1,15 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases
val client = Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setKey("") //
val databases = Databases(client)
val result = databases.createDocuments(
databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>",
documents = listOf(),
)

View file

@ -0,0 +1,17 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Databases
val client = Client(context)
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
val databases = Databases(client)
val result = databases.upsertDocument(
databaseId = "<DATABASE_ID>",
collectionId = "<COLLECTION_ID>",
documentId = "<DOCUMENT_ID>",
data = mapOf( "a" to "b" ),
permissions = listOf("read("any")"), // (optional)
)

View file

@ -0,0 +1,14 @@
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setKey("") //
let databases = Databases(client)
let documentList = try await databases.createDocuments(
databaseId: "<DATABASE_ID>",
collectionId: "<COLLECTION_ID>",
documents: []
)

View file

@ -0,0 +1,16 @@
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
let databases = Databases(client)
let document = try await databases.upsertDocument(
databaseId: "<DATABASE_ID>",
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: [:],
permissions: ["read("any")"] // optional
)

View file

@ -0,0 +1,13 @@
import 'package:appwrite/appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setKey(''); //
Databases databases = Databases(client);
DocumentList result = await databases.createDocuments(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
);

View file

@ -0,0 +1,15 @@
import 'package:appwrite/appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
Databases databases = Databases(client);
Document result = await databases.upsertDocument(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {},
permissions: ["read("any")"], // optional
);

View file

@ -0,0 +1,18 @@
mutation {
databasesCreateDocuments(
databaseId: "<DATABASE_ID>",
collectionId: "<COLLECTION_ID>",
documents: []
) {
total
documents {
_id
_collectionId
_databaseId
_createdAt
_updatedAt
_permissions
data
}
}
}

View file

@ -0,0 +1,17 @@
mutation {
databasesUpsertDocument(
databaseId: "<DATABASE_ID>",
collectionId: "<COLLECTION_ID>",
documentId: "<DOCUMENT_ID>",
data: "{}",
permissions: ["read("any")"]
) {
_id
_collectionId
_databaseId
_createdAt
_updatedAt
_permissions
data
}
}

View file

@ -0,0 +1,15 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setKey(''); //
const databases = new Databases(client);
const result = await databases.createDocuments(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
[] // documents
);
console.log(result);

View file

@ -0,0 +1,17 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.upsertDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
{}, // data
["read("any")"] // permissions (optional)
);
console.log(result);

View file

@ -0,0 +1,11 @@
POST /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1
Host: cloud.appwrite.io
Content-Type: application/json
X-Appwrite-Response-Format: 1.7.0
X-Appwrite-Project: <YOUR_PROJECT_ID>
X-Appwrite-Session:
X-Appwrite-JWT: <YOUR_JWT>
{
"documents": []
}

View file

@ -0,0 +1,12 @@
PUT /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1
Host: cloud.appwrite.io
Content-Type: application/json
X-Appwrite-Response-Format: 1.7.0
X-Appwrite-Project: <YOUR_PROJECT_ID>
X-Appwrite-Session:
X-Appwrite-JWT: <YOUR_JWT>
{
"data": {},
"permissions": ["read(\"any\")"]
}

View file

@ -0,0 +1,15 @@
import { Client, Databases } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setKey(''); //
const databases = new Databases(client);
const result = await databases.createDocuments(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
[] // documents
);
console.log(result);

View file

@ -0,0 +1,17 @@
import { Client, Databases } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.upsertDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
{}, // data
["read("any")"] // permissions (optional)
);
console.log(result);

View file

@ -0,0 +1 @@
appwrite account createAnonymousSession

View file

@ -0,0 +1,3 @@
appwrite account createEmailPasswordSession \
--email email@example.com \
--password password

View file

@ -0,0 +1,4 @@
appwrite account createEmailToken \
--userId <USER_ID> \
--email email@example.com \

View file

@ -0,0 +1 @@
appwrite account createJWT

View file

@ -0,0 +1,5 @@
appwrite account createMagicURLToken \
--userId <USER_ID> \
--email email@example.com \

View file

@ -0,0 +1,2 @@
appwrite account createMfaAuthenticator \
--type totp

View file

@ -0,0 +1,2 @@
appwrite account createMfaChallenge \
--factor email

View file

@ -0,0 +1 @@
appwrite account createMfaRecoveryCodes

View file

@ -0,0 +1,5 @@
appwrite account createOAuth2Session \
--provider amazon \

View file

@ -0,0 +1,5 @@
appwrite account createOAuth2Token \
--provider amazon \

View file

@ -0,0 +1,3 @@
appwrite account createPhoneToken \
--userId <USER_ID> \
--phone +12065550100

View file

@ -0,0 +1 @@
appwrite account createPhoneVerification

View file

@ -0,0 +1,4 @@
appwrite account createPushTarget \
--targetId <TARGET_ID> \
--identifier <IDENTIFIER> \

View file

@ -0,0 +1,3 @@
appwrite account createRecovery \
--email email@example.com \
--url https://example.com

View file

@ -0,0 +1,3 @@
appwrite account createSession \
--userId <USER_ID> \
--secret <SECRET>

View file

@ -0,0 +1,2 @@
appwrite account createVerification \
--url https://example.com

View file

@ -0,0 +1,5 @@
appwrite account create \
--userId <USER_ID> \
--email email@example.com \
--password '' \

View file

@ -0,0 +1,2 @@
appwrite account deleteIdentity \
--identityId <IDENTITY_ID>

View file

@ -0,0 +1,2 @@
appwrite account deleteMfaAuthenticator \
--type totp

View file

@ -0,0 +1,2 @@
appwrite account deletePushTarget \
--targetId <TARGET_ID>

View file

@ -0,0 +1,2 @@
appwrite account deleteSession \
--sessionId <SESSION_ID>

View file

@ -0,0 +1 @@
appwrite account deleteSessions

View file

@ -0,0 +1 @@
appwrite account delete

View file

@ -0,0 +1 @@
appwrite account getMfaRecoveryCodes

View file

@ -0,0 +1 @@
appwrite account getPrefs

View file

@ -0,0 +1,2 @@
appwrite account getSession \
--sessionId <SESSION_ID>

View file

@ -0,0 +1 @@
appwrite account get

View file

@ -0,0 +1,2 @@
appwrite account listIdentities \

View file

@ -0,0 +1,2 @@
appwrite account listLogs \

View file

@ -0,0 +1 @@
appwrite account listMfaFactors

View file

@ -0,0 +1 @@
appwrite account listSessions

View file

@ -0,0 +1,3 @@
appwrite account updateEmail \
--email email@example.com \
--password password

View file

@ -0,0 +1,2 @@
appwrite account updateMFA \
--mfa false

View file

@ -0,0 +1,3 @@
appwrite account updateMagicURLSession \
--userId <USER_ID> \
--secret <SECRET>

View file

@ -0,0 +1,3 @@
appwrite account updateMfaAuthenticator \
--type totp \
--otp <OTP>

View file

@ -0,0 +1,3 @@
appwrite account updateMfaChallenge \
--challengeId <CHALLENGE_ID> \
--otp <OTP>

View file

@ -0,0 +1 @@
appwrite account updateMfaRecoveryCodes

View file

@ -0,0 +1,2 @@
appwrite account updateName \
--name <NAME>

View file

@ -0,0 +1,3 @@
appwrite account updatePassword \
--password '' \

View file

@ -0,0 +1,3 @@
appwrite account updatePhoneSession \
--userId <USER_ID> \
--secret <SECRET>

View file

@ -0,0 +1,3 @@
appwrite account updatePhoneVerification \
--userId <USER_ID> \
--secret <SECRET>

View file

@ -0,0 +1,3 @@
appwrite account updatePhone \
--phone +12065550100 \
--password password

View file

@ -0,0 +1,2 @@
appwrite account updatePrefs \
--prefs '{ "key": "value" }'

View file

@ -0,0 +1,3 @@
appwrite account updatePushTarget \
--targetId <TARGET_ID> \
--identifier <IDENTIFIER>

View file

@ -0,0 +1,4 @@
appwrite account updateRecovery \
--userId <USER_ID> \
--secret <SECRET> \
--password ''

View file

@ -0,0 +1,2 @@
appwrite account updateSession \
--sessionId <SESSION_ID>

View file

@ -0,0 +1 @@
appwrite account updateStatus

View file

@ -0,0 +1,3 @@
appwrite account updateVerification \
--userId <USER_ID> \
--secret <SECRET>

View file

@ -0,0 +1,2 @@
appwrite assistant chat \
--prompt <PROMPT>

View file

@ -0,0 +1,5 @@
appwrite avatars getBrowser \
--code aa \

View file

@ -0,0 +1,5 @@
appwrite avatars getCreditCard \
--code amex \

Some files were not shown because too many files have changed in this diff Show more