Merge remote-tracking branch 'origin/sync-mongodb' into sync-mongodb

This commit is contained in:
ArnabChatterjee20k
2026-03-10 16:34:10 +05:30
134 changed files with 13518 additions and 1261 deletions
+3 -3
View File
@@ -50,9 +50,9 @@ _APP_DB_ROOT_PASS=rootsecretpassword
_APP_DB_ADAPTER_DOCUMENTSDB=mongodb
_APP_DB_HOST_DOCUMENTSDB=mongodb
_APP_DB_PORT_DOCUMENTSDB=27017
_APP_DB_ADAPTER_VECTORDB=postgresql
_APP_DB_HOST_VECTORDB=postgresql
_APP_DB_PORT_VECTORDB=5432
_APP_DB_ADAPTER_VECTORSDB=postgresql
_APP_DB_HOST_VECTORSDB=postgresql
_APP_DB_PORT_VECTORSDB=5432
_APP_EMBEDDING_MODELS=embeddinggemma
_APP_EMBEDDING_ENDPOINT='http://ollama:11434/api/embed'
_APP_EMBEDDING_TIMEOUT=30000
+7 -7
View File
@@ -111,7 +111,7 @@ $ git push origin [name_of_your_new_branch]
## Setup From Source
To set up a working **development environment**, just fork the project git repository and install the backend and frontend dependencies using the proper package manager and create run the docker-compose stack.
To set up a working **development environment**, just fork the project git repository and install the backend and frontend dependencies using the proper package manager and run the docker-compose stack.
> If you just want to install Appwrite for day-to-day use and not as a contributor, you can reference the [installation guide](https://github.com/appwrite/appwrite#installation), the [getting started guide](https://appwrite.io/docs/quick-starts), or the main [README](README.md) file.
@@ -173,12 +173,12 @@ Learn more at our [Technology Stack](#technology-stack) section.
- [MVVM](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel) - Appwrite console architecture
##### Container Namespace Conventions
To keep our services easy to understand within Docker we follow a naming convention for all our containers depending on it's intended use.
To keep our services easy to understand within Docker we follow a naming convention for all our containers depending on its intended use.
`appwrite-worker-X` - Workers (`src/Appwrite/Platform/Workers/*`)
`appwrite-task-X` - Tasks (`src/Appwrite/Platform/Tasks/*`)
Other containes should be named the same as their service, for example `redis` should just be called `redis`.
Other containers should be named the same as their service, for example `redis` should just be called `redis`.
##### Security
@@ -189,7 +189,7 @@ Other containes should be named the same as their service, for example `redis` s
## Modules
As Appwrite grows, we noticed approach of having all service endpoints in `app/controllers/api/[service].php` is not maintainable. Not only it creates massive files, it also doesnt contain all product's features such as workers or tasks. While there might still be some occurances of those controller files, we avoid it in all new development, and gradually migrate existing controllers to **HTTP modules**.
As Appwrite grows, we noticed approach of having all service endpoints in `app/controllers/api/[service].php` is not maintainable. Not only it creates massive files, it also doesn't contain all product's features such as workers or tasks. While there might still be some occurrences of those controller files, we avoid it in all new development, and gradually migrate existing controllers to **HTTP modules**.
### HTTP Endpoints
@@ -204,7 +204,7 @@ Tips and tricks:
1. If endpoint doesn't have resource, use service name as resource name too
> Example: `Modules/Sites/Http/Sites/Get.php`
2. If there are multiple resources, use then all in folder structure
2. If there are multiple resources, use them all in folder structure
> Example: `Modules/Sites/Http/Deployments/Builds/Create.php`
3. Action can only be `Get`, `Create`, `Update`, `Delete` or `XList`
@@ -395,7 +395,7 @@ These are the current metrics we collect usage stats for:
> Note: The curly brackets in the metric name represents a template and is replaced with a value when the metric is processed.
Metrics are collected within 3 scopes Daily, monthly, an infinity. Adding new usage metric in order to aggregate usage stats is very simple, but very much dependent on where do you want to collect
Metrics are collected within 3 scopes Daily, monthly, and infinity. Adding new usage metric in order to aggregate usage stats is very simple, but very much dependent on where do you want to collect
statistics ,via API or via background worker. For both cases you will need to add a `const` variable in `app/init.php` under the usage metrics list using the naming convention `METRIC_<RESOURCE_NAME>` as shown below.
```php
@@ -661,7 +661,7 @@ docker compose exec redis redis-cli FLUSHALL
## Using preview domains locally
Appwrite Functions are automatically given a domain you can visit to execute the function. This domain has format `[SOMETHING].functions.localhost` unless you changed `_APP_DOMAIN_FUNCTIONS` environment variable. This default value works great when running Appwrite locally, but it can be impossible to use preview domains with Cloud woekspaces such as Gitpod or GitHub Codespaces.
Appwrite Functions are automatically given a domain you can visit to execute the function. This domain has format `[SOMETHING].functions.localhost` unless you changed `_APP_DOMAIN_FUNCTIONS` environment variable. This default value works great when running Appwrite locally, but it can be impossible to use preview domains with Cloud workspaces such as Gitpod or GitHub Codespaces.
To use preview domains on Cloud workspaces, you can visit hostname provided by them, and supply function's preview domain as URL parameter:
+1
View File
@@ -70,6 +70,7 @@ RUN chmod +x /usr/local/bin/doctor && \
chmod +x /usr/local/bin/sdks && \
chmod +x /usr/local/bin/specs && \
chmod +x /usr/local/bin/ssl && \
chmod +x /usr/local/bin/time-travel && \
chmod +x /usr/local/bin/screenshot && \
chmod +x /usr/local/bin/test && \
chmod +x /usr/local/bin/upgrade && \
+2 -2
View File
@@ -4,7 +4,7 @@
$common = include __DIR__ . '/collections/common.php';
$projects = include __DIR__ . '/collections/projects.php';
$databases = include __DIR__ . '/collections/databases.php';
$vectordb = include __DIR__ . '/collections/vectordb.php';
$vectorsdb = include __DIR__ . '/collections/vectorsdb.php';
$platform = include __DIR__ . '/collections/platform.php';
$logs = include __DIR__ . '/collections/logs.php';
@@ -27,7 +27,7 @@ unset($common['files']);
$collections = [
'buckets' => $buckets,
'databases' => $databases,
'vectordb' => $vectordb,
'vectorsdb' => $vectorsdb,
'projects' => array_merge_recursive($projects, $common),
'console' => array_merge_recursive($platform, $common),
'logs' => $logs,
+1 -22
View File
@@ -786,6 +786,7 @@ return [
'filters' => [],
],
[
// At the moment, always empty (no runtime supports it yet)
'array' => false,
'$id' => ID::custom('startCommand'),
'type' => Database::VAR_STRING,
@@ -796,17 +797,6 @@ return [
'default' => null,
'filters' => [],
],
[
'array' => false,
'$id' => ID::custom('specification'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 128,
'signed' => false,
'required' => false,
'default' => APP_COMPUTE_SPECIFICATION_DEFAULT,
'filters' => [],
],
[
'array' => false,
'$id' => ID::custom('buildSpecification'),
@@ -1264,17 +1254,6 @@ return [
'array' => false,
'filters' => [],
],
[
'array' => false,
'$id' => ID::custom('specification'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 128,
'signed' => false,
'required' => false,
'default' => APP_COMPUTE_SPECIFICATION_DEFAULT,
'filters' => [],
],
[
'array' => false,
'$id' => ID::custom('buildSpecification'),
+26 -26
View File
@@ -77,13 +77,13 @@ Http::get('/v1/project/usage')
METRIC_DATABASES_OPERATIONS_WRITES,
METRIC_DATABASES_OPERATIONS_WRITES_DOCUMENTSDB,
METRIC_FILES_IMAGES_TRANSFORMED,
// VectorDB totals
METRIC_DATABASES_VECTORDB,
METRIC_COLLECTIONS_VECTORDB,
METRIC_DOCUMENTS_VECTORDB,
METRIC_DATABASES_STORAGE_VECTORDB,
METRIC_DATABASES_OPERATIONS_READS_VECTORDB,
METRIC_DATABASES_OPERATIONS_WRITES_VECTORDB,
// VectorsDB totals
METRIC_DATABASES_VECTORSDB,
METRIC_COLLECTIONS_VECTORSDB,
METRIC_DOCUMENTS_VECTORSDB,
METRIC_DATABASES_STORAGE_VECTORSDB,
METRIC_DATABASES_OPERATIONS_READS_VECTORSDB,
METRIC_DATABASES_OPERATIONS_WRITES_VECTORSDB,
// Embeddings totals
METRIC_EMBEDDINGS_TEXT,
METRIC_EMBEDDINGS_TEXT_TOTAL_TOKENS,
@@ -105,13 +105,13 @@ Http::get('/v1/project/usage')
METRIC_DATABASES_OPERATIONS_WRITES,
METRIC_DATABASES_OPERATIONS_WRITES_DOCUMENTSDB,
METRIC_FILES_IMAGES_TRANSFORMED,
// VectorDB time series
METRIC_DATABASES_VECTORDB,
METRIC_COLLECTIONS_VECTORDB,
METRIC_DOCUMENTS_VECTORDB,
METRIC_DATABASES_STORAGE_VECTORDB,
METRIC_DATABASES_OPERATIONS_READS_VECTORDB,
METRIC_DATABASES_OPERATIONS_WRITES_VECTORDB,
// VectorsDB time series
METRIC_DATABASES_VECTORSDB,
METRIC_COLLECTIONS_VECTORSDB,
METRIC_DOCUMENTS_VECTORSDB,
METRIC_DATABASES_STORAGE_VECTORSDB,
METRIC_DATABASES_OPERATIONS_READS_VECTORSDB,
METRIC_DATABASES_OPERATIONS_WRITES_VECTORSDB,
// Embeddings time series
METRIC_EMBEDDINGS_TEXT,
METRIC_EMBEDDINGS_TEXT_TOTAL_TOKENS,
@@ -404,12 +404,12 @@ Http::get('/v1/project/usage')
'databasesWritesTotal' => $total[METRIC_DATABASES_OPERATIONS_WRITES],
'documentsdbDatabasesReadsTotal' => $total[METRIC_DATABASES_OPERATIONS_READS_DOCUMENTSDB],
'documentsdbDatabasesWritesTotal' => $total[METRIC_DATABASES_OPERATIONS_WRITES_DOCUMENTSDB],
'vectordbDatabasesTotal' => $total[METRIC_DATABASES_VECTORDB] ?? 0,
'vectordbCollectionsTotal' => $total[METRIC_COLLECTIONS_VECTORDB] ?? 0,
'vectordbDocumentsTotal' => $total[METRIC_DOCUMENTS_VECTORDB] ?? 0,
'vectordbDatabasesStorageTotal' => $total[METRIC_DATABASES_STORAGE_VECTORDB] ?? 0,
'vectordbDatabasesReadsTotal' => $total[METRIC_DATABASES_OPERATIONS_READS_VECTORDB] ?? 0,
'vectordbDatabasesWritesTotal' => $total[METRIC_DATABASES_OPERATIONS_WRITES_VECTORDB] ?? 0,
'vectorsdbDatabasesTotal' => $total[METRIC_DATABASES_VECTORSDB] ?? 0,
'vectorsdbCollectionsTotal' => $total[METRIC_COLLECTIONS_VECTORSDB] ?? 0,
'vectorsdbDocumentsTotal' => $total[METRIC_DOCUMENTS_VECTORSDB] ?? 0,
'vectorsdbDatabasesStorageTotal' => $total[METRIC_DATABASES_STORAGE_VECTORSDB] ?? 0,
'vectorsdbDatabasesReadsTotal' => $total[METRIC_DATABASES_OPERATIONS_READS_VECTORSDB] ?? 0,
'vectorsdbDatabasesWritesTotal' => $total[METRIC_DATABASES_OPERATIONS_WRITES_VECTORSDB] ?? 0,
'executionsBreakdown' => $executionsBreakdown,
'bucketsBreakdown' => $bucketsBreakdown,
'databasesReads' => $usage[METRIC_DATABASES_OPERATIONS_READS],
@@ -417,12 +417,12 @@ Http::get('/v1/project/usage')
'documentsdbDatabasesReads' => $usage[METRIC_DATABASES_OPERATIONS_READS_DOCUMENTSDB],
'documentsdbDatabasesWrites' => $usage[METRIC_DATABASES_OPERATIONS_WRITES_DOCUMENTSDB],
'documentsdbDatabasesStorage' => $usage[METRIC_DATABASES_STORAGE_DOCUMENTSDB],
'vectordbDatabases' => $usage[METRIC_DATABASES_VECTORDB] ?? [],
'vectordbCollections' => $usage[METRIC_COLLECTIONS_VECTORDB] ?? [],
'vectordbDocuments' => $usage[METRIC_DOCUMENTS_VECTORDB] ?? [],
'vectordbDatabasesStorage' => $usage[METRIC_DATABASES_STORAGE_VECTORDB] ?? [],
'vectordbDatabasesReads' => $usage[METRIC_DATABASES_OPERATIONS_READS_VECTORDB] ?? [],
'vectordbDatabasesWrites' => $usage[METRIC_DATABASES_OPERATIONS_WRITES_VECTORDB] ?? [],
'vectorsdbDatabases' => $usage[METRIC_DATABASES_VECTORSDB] ?? [],
'vectorsdbCollections' => $usage[METRIC_COLLECTIONS_VECTORSDB] ?? [],
'vectorsdbDocuments' => $usage[METRIC_DOCUMENTS_VECTORSDB] ?? [],
'vectorsdbDatabasesStorage' => $usage[METRIC_DATABASES_STORAGE_VECTORSDB] ?? [],
'vectorsdbDatabasesReads' => $usage[METRIC_DATABASES_OPERATIONS_READS_VECTORSDB] ?? [],
'vectorsdbDatabasesWrites' => $usage[METRIC_DATABASES_OPERATIONS_WRITES_VECTORSDB] ?? [],
'databasesStorageBreakdown' => $databasesStorageBreakdown,
'executionsMbSecondsBreakdown' => $executionsMbSecondsBreakdown,
'buildsMbSecondsBreakdown' => $buildsMbSecondsBreakdown,
+19 -7
View File
@@ -30,6 +30,8 @@ use Appwrite\Utopia\Response\Filters\V16 as ResponseV16;
use Appwrite\Utopia\Response\Filters\V17 as ResponseV17;
use Appwrite\Utopia\Response\Filters\V18 as ResponseV18;
use Appwrite\Utopia\Response\Filters\V19 as ResponseV19;
use Appwrite\Utopia\Response\Filters\V20 as ResponseV20;
use Appwrite\Utopia\Response\Filters\V21 as ResponseV21;
use Appwrite\Utopia\View;
use Executor\Executor;
use MaxMind\Db\Reader;
@@ -322,7 +324,7 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S
};
$runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []);
$spec = Config::getParam('specifications')[$resource->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$spec = Config::getParam('specifications')[$resource->getAttribute('runtimeSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$runtime = match ($type) {
'function' => $runtimes[$resource->getAttribute('runtime')] ?? null,
@@ -552,6 +554,10 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S
}
}
if (!empty($deployment->getAttribute('startCommand', ''))) {
$startCommand = 'cd /usr/local/server/src/function/ && ' . $deployment->getAttribute('startCommand', '');
}
$runtimeEntrypoint = match ($version) {
'v2' => '',
default => "cp /tmp/code.$extension /mnt/code/code.$extension && nohup helpers/start.sh \"$startCommand\"",
@@ -933,17 +939,23 @@ Http::init()
*/
$responseFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', ''));
if ($responseFormat) {
if (version_compare($responseFormat, '1.4.0', '<')) {
$response->addFilter(new ResponseV16());
if (version_compare($responseFormat, '1.9.0', '<')) {
$response->addFilter(new ResponseV21());
}
if (version_compare($responseFormat, '1.5.0', '<')) {
$response->addFilter(new ResponseV17());
if (version_compare($responseFormat, '1.8.0', '<')) {
$response->addFilter(new ResponseV20());
}
if (version_compare($responseFormat, '1.7.0', '<')) {
$response->addFilter(new ResponseV19());
}
if (version_compare($responseFormat, '1.6.0', '<')) {
$response->addFilter(new ResponseV18());
}
if (version_compare($responseFormat, '1.7.0', '<')) {
$response->addFilter(new ResponseV19());
if (version_compare($responseFormat, '1.5.0', '<')) {
$response->addFilter(new ResponseV17());
}
if (version_compare($responseFormat, '1.4.0', '<')) {
$response->addFilter(new ResponseV16());
}
if (version_compare($responseFormat, APP_VERSION_STABLE, '>')) {
$warnings[] = "The current SDK is built for Appwrite " . $responseFormat . ". However, the current Appwrite server version is " . APP_VERSION_STABLE . ". Please downgrade your SDK to match the Appwrite version: https://appwrite.io/docs/sdks";
+3 -1
View File
@@ -214,6 +214,8 @@ Http::init()
}
if (!$dbKey) {
\var_dump($apiKey);
\var_dump($request->getHeader('x-appwrite-key', ''));
throw new Exception(Exception::USER_UNAUTHORIZED);
}
@@ -471,7 +473,7 @@ Http::init()
$path = $route->getMatchedPath();
$databaseType = match (true) {
str_contains($path, '/documentsdb') => DATABASE_TYPE_DOCUMENTSDB,
str_contains($path, '/vectordb') => DATABASE_TYPE_VECTORDB,
str_contains($path, '/vectorsdb') => DATABASE_TYPE_VECTORSDB,
default => '',
};
+2 -2
View File
@@ -420,8 +420,8 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $tot
$documentsSharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES_V1', ''));
$documentsSharedTablesV2 = \array_diff($documentsSharedTables, $documentsSharedTablesV1);
$vectorSharedTables = \explode(',', System::getEnv('_APP_DATABASE_VECTORDB_SHARED_TABLES', ''));
$vectorSharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_VECTORDB_SHARED_TABLES_V1', ''));
$vectorSharedTables = \explode(',', System::getEnv('_APP_DATABASE_VECTORSDB_SHARED_TABLES', ''));
$vectorSharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_VECTORSDB_SHARED_TABLES_V1', ''));
$vectorSharedTablesV2 = \array_diff($vectorSharedTables, $vectorSharedTablesV1);
$cache = $app->getResource('cache');
+17 -16
View File
@@ -93,6 +93,7 @@ const APP_SOCIAL_YOUTUBE = 'https://www.youtube.com/c/appwrite?sub_confirmation=
const APP_COMPUTE_CPUS_DEFAULT = 0.5;
const APP_COMPUTE_MEMORY_DEFAULT = 512;
const APP_COMPUTE_SPECIFICATION_DEFAULT = Specification::S_1VCPU_512MB;
const APP_COMPUTE_DEPLOYMENT_MAX_RETENTION = 100 * 365; // 100 years
const APP_SDK_PLATFORM_SERVER = 'server';
const APP_SDK_PLATFORM_CLIENT = 'client';
const APP_SDK_PLATFORM_CONSOLE = 'console';
@@ -303,20 +304,20 @@ const METRIC_DATABASE_ID_OPERATIONS_READS_DOCUMENTSDB = 'documentsdb.{databaseIn
const METRIC_DATABASES_OPERATIONS_WRITES_DOCUMENTSDB = 'documentsdb.databases.operations.writes';
const METRIC_DATABASE_ID_OPERATIONS_WRITES_DOCUMENTSDB = 'documentsdb.{databaseInternalId}.databases.operations.writes';
// vectordb
const METRIC_DATABASES_VECTORDB = 'vectordb.databases';
const METRIC_COLLECTIONS_VECTORDB = 'vectordb.collections';
const METRIC_DATABASES_STORAGE_VECTORDB = 'vectordb.databases.storage';
const METRIC_DATABASE_ID_COLLECTIONS_VECTORDB = 'vectordb.{databaseInternalId}.collections';
const METRIC_DATABASE_ID_STORAGE_VECTORDB = 'vectordb.{databaseInternalId}.databases.storage';
const METRIC_DOCUMENTS_VECTORDB = 'vectordb.documents';
const METRIC_DATABASE_ID_DOCUMENTS_VECTORDB = 'vectordb.{databaseInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS_VECTORDB = 'vectordb.{databaseInternalId}.{collectionInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_STORAGE_VECTORDB = 'vectordb.{databaseInternalId}.{collectionInternalId}.databases.storage';
const METRIC_DATABASES_OPERATIONS_READS_VECTORDB = 'vectordb.databases.operations.reads';
const METRIC_DATABASE_ID_OPERATIONS_READS_VECTORDB = 'vectordb.{databaseInternalId}.databases.operations.reads';
const METRIC_DATABASES_OPERATIONS_WRITES_VECTORDB = 'vectordb.databases.operations.writes';
const METRIC_DATABASE_ID_OPERATIONS_WRITES_VECTORDB = 'vectordb.{databaseInternalId}.databases.operations.writes';
// vectorsdb
const METRIC_DATABASES_VECTORSDB = 'vectorsdb.databases';
const METRIC_COLLECTIONS_VECTORSDB = 'vectorsdb.collections';
const METRIC_DATABASES_STORAGE_VECTORSDB = 'vectorsdb.databases.storage';
const METRIC_DATABASE_ID_COLLECTIONS_VECTORSDB = 'vectorsdb.{databaseInternalId}.collections';
const METRIC_DATABASE_ID_STORAGE_VECTORSDB = 'vectorsdb.{databaseInternalId}.databases.storage';
const METRIC_DOCUMENTS_VECTORSDB = 'vectorsdb.documents';
const METRIC_DATABASE_ID_DOCUMENTS_VECTORSDB = 'vectorsdb.{databaseInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS_VECTORSDB = 'vectorsdb.{databaseInternalId}.{collectionInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_STORAGE_VECTORSDB = 'vectorsdb.{databaseInternalId}.{collectionInternalId}.databases.storage';
const METRIC_DATABASES_OPERATIONS_READS_VECTORSDB = 'vectorsdb.databases.operations.reads';
const METRIC_DATABASE_ID_OPERATIONS_READS_VECTORSDB = 'vectorsdb.{databaseInternalId}.databases.operations.reads';
const METRIC_DATABASES_OPERATIONS_WRITES_VECTORSDB = 'vectorsdb.databases.operations.writes';
const METRIC_DATABASE_ID_OPERATIONS_WRITES_VECTORSDB = 'vectorsdb.{databaseInternalId}.databases.operations.writes';
const METRIC_EMBEDDINGS_TEXT = 'embeddings.text';
const METRIC_EMBEDDINGS_MODEL_TEXT = 'embeddings.text.{embeddingModel}';
const METRIC_EMBEDDINGS_TEXT_TOTAL_ERROR = 'embeddings.text.totalErrors';
@@ -439,11 +440,11 @@ const PROJECT_STATUS_ACTIVE = 'active';
const DATABASE_TYPE_LEGACY = 'legacy';
const DATABASE_TYPE_TABLESDB = 'tablesdb';
const DATABASE_TYPE_DOCUMENTSDB = 'documentsdb';
const DATABASE_TYPE_VECTORDB = 'vectordb';
const DATABASE_TYPE_VECTORSDB = 'vectorsdb';
// CSV import/export allowed database types
const CSV_ALLOWED_DATABASE_TYPES = [
DATABASE_TYPE_LEGACY,
DATABASE_TYPE_TABLESDB,
DATABASE_TYPE_VECTORDB
DATABASE_TYPE_VECTORSDB
];
+8 -8
View File
@@ -149,12 +149,12 @@ use Appwrite\Utopia\Response\Model\UsageSites;
use Appwrite\Utopia\Response\Model\UsageStorage;
use Appwrite\Utopia\Response\Model\UsageTable;
use Appwrite\Utopia\Response\Model\UsageUsers;
use Appwrite\Utopia\Response\Model\UsageVectorDB;
use Appwrite\Utopia\Response\Model\UsageVectorDBs;
use Appwrite\Utopia\Response\Model\UsageVectorsDB;
use Appwrite\Utopia\Response\Model\UsageVectorsDBs;
use Appwrite\Utopia\Response\Model\User;
use Appwrite\Utopia\Response\Model\Variable;
use Appwrite\Utopia\Response\Model\VcsContent;
use Appwrite\Utopia\Response\Model\VectorDBCollection;
use Appwrite\Utopia\Response\Model\VectorsDBCollection;
use Appwrite\Utopia\Response\Model\Webhook;
// General
@@ -219,7 +219,7 @@ Response::setModel(new BaseList('Migrations List', Response::MODEL_MIGRATION_LIS
Response::setModel(new BaseList('Migrations Firebase Projects List', Response::MODEL_MIGRATION_FIREBASE_PROJECT_LIST, 'projects', Response::MODEL_MIGRATION_FIREBASE_PROJECT));
Response::setModel(new BaseList('Specifications List', Response::MODEL_SPECIFICATION_LIST, 'specifications', Response::MODEL_SPECIFICATION));
Response::setModel(new BaseList('VCS Content List', Response::MODEL_VCS_CONTENT_LIST, 'contents', Response::MODEL_VCS_CONTENT));
Response::setModel(new BaseList('VectorDB Collections List', Response::MODEL_VECTORDB_COLLECTION_LIST, 'collections', Response::MODEL_VECTORDB_COLLECTION));
Response::setModel(new BaseList('VectorsDB Collections List', Response::MODEL_VECTORSDB_COLLECTION_LIST, 'collections', Response::MODEL_VECTORSDB_COLLECTION));
Response::setModel(new BaseList('Embedding list', Response::MODEL_EMBEDDING_LIST, 'embeddings', Response::MODEL_EMBEDDING));
// Entities
@@ -252,12 +252,12 @@ Response::setModel(new AttributeLongtext());
Response::setModel(new UsageDocumentsDBs());
Response::setModel(new UsageDocumentsDB());
// VectorDB API Models
Response::setModel(new VectorDBCollection());
// VectorsDB API Models
Response::setModel(new VectorsDBCollection());
Response::setModel(new AttributeObject());
Response::setModel(new AttributeVector());
Response::setModel(new UsageVectorDBs());
Response::setModel(new UsageVectorDB());
Response::setModel(new UsageVectorsDBs());
Response::setModel(new UsageVectorsDB());
// Table API Models
Response::setModel(new Table());
+6 -6
View File
@@ -176,10 +176,10 @@ $register->set('pools', function () {
'pass' => System::getEnv('_APP_DB_PASS', ''),
'path' => System::getEnv('_APP_DB_SCHEMA', ''),
]);
$fallbackForVectorDB = 'db_main=' . AppwriteURL::unparse([
'scheme' => System::getEnv('_APP_DB_ADAPTER_VECTORDB', 'postgresql'),
'host' => System::getEnv('_APP_DB_HOST_VECTORDB', 'postgresql'),
'port' => System::getEnv('_APP_DB_PORT_VECTORDB', '5432'),
$fallbackForVectorsDB = 'db_main=' . AppwriteURL::unparse([
'scheme' => System::getEnv('_APP_DB_ADAPTER_VECTORSDB', 'postgresql'),
'host' => System::getEnv('_APP_DB_HOST_VECTORSDB', 'postgresql'),
'port' => System::getEnv('_APP_DB_PORT_VECTORSDB', '5432'),
'user' => System::getEnv('_APP_DB_USER', ''),
'pass' => System::getEnv('_APP_DB_PASS', ''),
'path' => System::getEnv('_APP_DB_SCHEMA', ''),
@@ -204,9 +204,9 @@ $register->set('pools', function () {
'multiple' => true,
'schemes' => ['mongodb'],
],
'vectordb' => [
'vectorsdb' => [
'type' => 'database',
'dsns' => System::getEnv('_APP_CONNECTIONS_DATABASE_VECTORDB', $fallbackForVectorDB),
'dsns' => System::getEnv('_APP_CONNECTIONS_DATABASE_VECTORSDB', $fallbackForVectorsDB),
'multiple' => true,
'schemes' => ['postgresql'],
],
+1 -1
View File
@@ -680,7 +680,7 @@ Http::setResource('dbForProject', function (Group $pools, Database $dbForPlatfor
$path = $request->getURI();
$databaseType = match (true) {
str_contains($path, '/documentsdb') => DATABASE_TYPE_DOCUMENTSDB,
str_contains($path, '/vectordb') => DATABASE_TYPE_VECTORDB,
str_contains($path, '/vectorsdb') => DATABASE_TYPE_VECTORSDB,
default => '',
};
+6 -1
View File
@@ -763,7 +763,7 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
$database = getConsoleDB();
$database->setAuthorization($authorization);
if ($projectId !== 'console') {
if (!empty($projectId) && $projectId !== 'console') {
$project = $authorization->skip(fn () => $database->getDocument('projects', $projectId));
$database = getProjectDB($project);
@@ -795,6 +795,11 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Message format is not valid.');
}
// Ping does not require project context; other messages do (e.g. after unsubscribe during auth)
if (empty($projectId) && ($message['type'] ?? '') !== 'ping') {
throw new Exception(Exception::REALTIME_POLICY_VIOLATION, 'Missing project context. Reconnect to the project first.');
}
switch ($message['type']) {
case 'ping':
$server->send([$connection], json_encode([
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
exec php /usr/src/code/app/cli.php time-travel "$@"
Generated
+3
View File
@@ -9138,5 +9138,8 @@
"platform-dev": {
"ext-fileinfo": "*"
},
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.9.0"
}
+18 -18
View File
@@ -153,12 +153,12 @@ services:
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_DB_ADAPTER_VECTORDB
- _APP_DB_HOST_VECTORDB
- _APP_DB_PORT_VECTORDB
- _APP_DB_SCHEMA_VECTORDB
- _APP_DB_USER_VECTORDB
- _APP_DB_PASS_VECTORDB
- _APP_DB_ADAPTER_VECTORSDB
- _APP_DB_HOST_VECTORSDB
- _APP_DB_PORT_VECTORSDB
- _APP_DB_SCHEMA_VECTORSDB
- _APP_DB_USER_VECTORSDB
- _APP_DB_PASS_VECTORSDB
- _APP_SMTP_HOST
- _APP_SMTP_PORT
- _APP_SMTP_SECURE
@@ -312,12 +312,12 @@ services:
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_DB_ADAPTER_VECTORDB
- _APP_DB_HOST_VECTORDB
- _APP_DB_PORT_VECTORDB
- _APP_DB_SCHEMA_VECTORDB
- _APP_DB_USER_VECTORDB
- _APP_DB_PASS_VECTORDB
- _APP_DB_ADAPTER_VECTORSDB
- _APP_DB_HOST_VECTORSDB
- _APP_DB_PORT_VECTORSDB
- _APP_DB_SCHEMA_VECTORSDB
- _APP_DB_USER_VECTORSDB
- _APP_DB_PASS_VECTORSDB
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_LOGGING_CONFIG_REALTIME
@@ -489,12 +489,12 @@ services:
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_DB_ADAPTER_VECTORDB
- _APP_DB_HOST_VECTORDB
- _APP_DB_PORT_VECTORDB
- _APP_DB_SCHEMA_VECTORDB
- _APP_DB_USER_VECTORDB
- _APP_DB_PASS_VECTORDB
- _APP_DB_ADAPTER_VECTORSDB
- _APP_DB_HOST_VECTORSDB
- _APP_DB_PORT_VECTORSDB
- _APP_DB_SCHEMA_VECTORSDB
- _APP_DB_USER_VECTORSDB
- _APP_DB_PASS_VECTORSDB
- _APP_LOGGING_CONFIG
- _APP_WORKERS_NUM
- _APP_QUEUE_NAME
+3 -3
View File
@@ -534,7 +534,7 @@ class Event
$parsed = self::parseEventPattern($pattern);
// to switch the resource types from databases to the required prefix
// eg; all databases events get fired with databases. prefix which mainly depicts legacy type
// so a projection from databases to the actual prefix(documentsdb, vectordb,etc)
// so a projection from databases to the actual prefix(documentsdb, vectorsdb,etc)
if ((str_contains($pattern, 'databases.') && $database && $database->getAttribute('type') !== 'legacy')) {
$parsed = self::getDatabaseTypeEvents($database, $parsed);
}
@@ -746,8 +746,8 @@ class Event
];
break;
case 'documentsdb':
case 'vectordb':
// sending the type itself(eg: documentsdb, vectordb)
case 'vectorsdb':
// sending the type itself(eg: documentsdb, vectorsdb)
$eventMap = [
'databases' => $database->getAttribute('type')
];
+2 -2
View File
@@ -493,7 +493,7 @@ class Realtime extends MessagingAdapter
case 'databases':
case 'tablesdb':
case 'documentsdb':
case 'vectordb':
case 'vectorsdb':
$resource = $parts[4] ?? '';
if (in_array($resource, ['columns', 'attributes', 'indexes'])) {
$channels[] = 'console';
@@ -627,7 +627,7 @@ class Realtime extends MessagingAdapter
break;
case 'documentsdb':
case 'vectordb':
case 'vectorsdb':
$channels[] = 'documents';
$channels[] = "{$basePrefix}.{$databaseId}.collections.{$resourceId}.documents";
$channels[] = "{$basePrefix}.{$databaseId}.collections.{$resourceId}.documents.{$payloadId}";
@@ -26,7 +26,7 @@ const COLLECTIONS = 'collection';
const LEGACY = 'legacy';
const TABLESDB = 'tablesdb';
const DOCUMENTSDB = 'documentsdb';
const VECTORDB = 'vectordb';
const VECTORSDB = 'vectorsdb';
const MIN_VECTOR_DIMENSION = 1;
const MAX_VECTOR_DIMENSION = 16000;
@@ -25,8 +25,8 @@ class Action extends AppwriteAction
if (\str_contains($path, '/documentsdb')) {
$this->context = DATABASE_TYPE_DOCUMENTSDB;
}
if (\str_contains($path, '/vectordb')) {
$this->context = DATABASE_TYPE_VECTORDB;
if (\str_contains($path, '/vectorsdb')) {
$this->context = DATABASE_TYPE_VECTORSDB;
}
return parent::setHttpPath($path);
}
@@ -27,8 +27,8 @@ abstract class Action extends UtopiaAction
if (\str_contains($path, '/tablesdb')) {
$this->context = TABLES;
$this->databaseType = TABLESDB;
} elseif (\str_contains($path, '/vectordb')) {
$this->databaseType = VECTORDB;
} elseif (\str_contains($path, '/vectorsdb')) {
$this->databaseType = VECTORSDB;
}
return parent::setHttpPath($path);
}
@@ -30,8 +30,8 @@ abstract class Action extends DatabasesAction
$this->context = ROWS;
} elseif (str_contains($path, '/documentsdb/')) {
$this->databaseType = DATABASE_TYPE_DOCUMENTSDB;
} elseif (str_contains($path, '/vectordb/')) {
$this->databaseType = DATABASE_TYPE_VECTORDB;
} elseif (str_contains($path, '/vectorsdb/')) {
$this->databaseType = DATABASE_TYPE_VECTORSDB;
}
$contextId = '$' . $this->getCollectionsEventsContext() . 'Id';
@@ -64,13 +64,13 @@ class Create extends Action
$databaseSharedTables = \explode(',', System::getEnv('_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES', ''));
$databaseSharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES_V1', ''));
break;
case VECTORDB:
$databases = Config::getParam('pools-vectordb', []);
$databaseKeys = System::getEnv('_APP_DATABASE_VECTORDB_KEYS', '');
$databaseOverride = System::getEnv('_APP_DATABASE_VECTORDB_OVERRIDE');
$dbScheme = System::getEnv('_APP_DB_HOST_VECTORDB', 'postgresql');
$databaseSharedTables = \explode(',', System::getEnv('_APP_DATABASE_VECTORDB_SHARED_TABLES', ''));
$databaseSharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_VECTORDB_SHARED_TABLES_V1', ''));
case VECTORSDB:
$databases = Config::getParam('pools-vectorsdb', []);
$databaseKeys = System::getEnv('_APP_DATABASE_VECTORSDB_KEYS', '');
$databaseOverride = System::getEnv('_APP_DATABASE_VECTORSDB_OVERRIDE');
$dbScheme = System::getEnv('_APP_DB_HOST_VECTORSDB', 'postgresql');
$databaseSharedTables = \explode(',', System::getEnv('_APP_DATABASE_VECTORSDB_SHARED_TABLES', ''));
$databaseSharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_VECTORSDB_SHARED_TABLES_V1', ''));
break;
default:
// legacy/tablesdb
@@ -143,7 +143,7 @@ class Create extends Action
protected function getDatabaseCollection()
{
return match ($this->getDatabaseType()) {
'vectordb' => (Config::getParam('collections', [])['vectordb'] ?? [])['collections'] ?? [],
'vectorsdb' => (Config::getParam('collections', [])['vectorsdb'] ?? [])['collections'] ?? [],
default => (Config::getParam('collections', [])['databases'] ?? [])['collections'] ?? [],
};
}
@@ -45,9 +45,9 @@ abstract class Action extends DatabasesAction
$this->context = COLLECTIONS;
$this->databaseType = DOCUMENTSDB;
break;
case str_contains($path, '/vectordb'):
case str_contains($path, '/vectorsdb'):
$this->context = COLLECTIONS;
$this->databaseType = VECTORDB;
$this->databaseType = VECTORSDB;
break;
}
return parent::setHttpPath($path);
@@ -169,7 +169,7 @@ class Update extends Action
$databaseDoc = null;
switch ($this->getDatabaseType()) {
case DATABASE_TYPE_DOCUMENTSDB:
case DATABASE_TYPE_VECTORDB:
case DATABASE_TYPE_VECTORSDB:
$databaseDoc = $authorization->skip(fn () => $dbForProject->findOne('databases', [
Query::equal('$sequence', [$firstOperation['databaseInternalId']])
]));
@@ -32,7 +32,7 @@ class Get extends Action
{
$this->databaseType = match (true) {
str_contains($path, '/documentsdb') => DATABASE_TYPE_DOCUMENTSDB,
str_contains($path, '/vectordb') => DATABASE_TYPE_VECTORDB,
str_contains($path, '/vectorsdb') => DATABASE_TYPE_VECTORSDB,
default => DATABASE_TYPE_LEGACY,
};
@@ -30,7 +30,7 @@ class XList extends Action
{
$this->databaseType = match (true) {
str_contains($path, '/documentsdb') => DATABASE_TYPE_DOCUMENTSDB,
str_contains($path, '/vectordb') => DATABASE_TYPE_VECTORDB,
str_contains($path, '/vectorsdb') => DATABASE_TYPE_VECTORSDB,
default => DATABASE_TYPE_LEGACY,
};
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
@@ -32,19 +32,19 @@ class Create extends CollectionAction
{
public static function getName(): string
{
return 'createVectorDBCollection';
return 'createVectorsDBCollection';
}
protected function getResponseModel(): string
{
return UtopiaResponse::MODEL_VECTORDB_COLLECTION;
return UtopiaResponse::MODEL_VECTORSDB_COLLECTION;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_POST)
->setHttpPath('/v1/vectordb/:databaseId/collections')
->setHttpPath('/v1/vectorsdb/:databaseId/collections')
->desc('Create collection')
->groups(['api', 'database'])
->label('event', 'databases.[databaseId].collections.[collectionId].create')
@@ -53,10 +53,10 @@ class Create extends CollectionAction
->label('audits.event', 'collection.create')
->label('audits.resource', 'database/{request.databaseId}/collection/{response.$id}')
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'collections',
name: 'createCollection',
description: '/docs/references/vectordb/create-collection.md',
description: '/docs/references/vectorsdb/create-collection.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -119,7 +119,7 @@ class Create extends CollectionAction
$attributes = [];
$indexes = [];
$collections = (Config::getParam('collections', [])['vectordb'] ?? [])['collections'] ?? [];
$collections = (Config::getParam('collections', [])['vectorsdb'] ?? [])['collections'] ?? [];
foreach ($collections['defaultAttributes'] as $attribute) {
if ($attribute['$id'] === 'embeddings') {
$attribute['size'] = $dimension;
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Delete as CollectionDelete;
use Appwrite\SDK\AuthType;
@@ -15,19 +15,19 @@ class Delete extends CollectionDelete
{
public static function getName(): string
{
return 'deleteVectorDBCollection';
return 'deleteVectorsDBCollection';
}
protected function getResponseModel(): string
{
return UtopiaResponse::MODEL_VECTORDB_COLLECTION;
return UtopiaResponse::MODEL_VECTORSDB_COLLECTION;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_DELETE)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId')
->desc('Delete collection')
->groups(['api', 'database', 'schema'])
->label('scope', 'collections.write')
@@ -36,10 +36,10 @@ class Delete extends CollectionDelete
->label('audits.event', 'collection.delete')
->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}')
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'collections',
name: 'deleteCollection',
description: '/docs/references/vectordb/delete-collection.md',
description: '/docs/references/vectorsdb/delete-collection.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Bulk;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bulk;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Bulk\Delete as DocumentsDelete;
use Appwrite\SDK\AuthType;
@@ -17,7 +17,7 @@ class Delete extends DocumentsDelete
{
public static function getName(): string
{
return 'deleteVectorDBDocuments';
return 'deleteVectorsDBDocuments';
}
protected function getResponseModel(): string
@@ -29,7 +29,7 @@ class Delete extends DocumentsDelete
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_DELETE)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents')
->desc('Delete documents')
->groups(['api', 'database'])
->label('scope', 'documents.write')
@@ -40,10 +40,10 @@ class Delete extends DocumentsDelete
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'deleteDocuments',
description: '/docs/references/vectordb/delete-documents.md',
description: '/docs/references/vectorsdb/delete-documents.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Bulk;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bulk;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Bulk\Update as DocumentsUpdate;
use Appwrite\SDK\AuthType;
@@ -18,7 +18,7 @@ class Update extends DocumentsUpdate
{
public static function getName(): string
{
return 'updateVectorDBDocuments';
return 'updateVectorsDBDocuments';
}
protected function getResponseModel(): string
@@ -30,7 +30,7 @@ class Update extends DocumentsUpdate
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_PATCH)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents')
->desc('Update documents')
->groups(['api', 'database'])
->label('scope', 'documents.write')
@@ -41,10 +41,10 @@ class Update extends DocumentsUpdate
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'updateDocuments',
description: '/docs/references/vectordb/update-documents.md',
description: '/docs/references/vectorsdb/update-documents.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Bulk;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bulk;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Bulk\Upsert as DocumentsUpsert;
use Appwrite\SDK\AuthType;
@@ -17,7 +17,7 @@ class Upsert extends DocumentsUpsert
{
public static function getName(): string
{
return 'upsertVectorDBDocuments';
return 'upsertVectorsDBDocuments';
}
protected function getResponseModel(): string
@@ -29,7 +29,7 @@ class Upsert extends DocumentsUpsert
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents')
->desc('Upsert documents')
->groups(['api', 'database'])
->label('scope', 'documents.write')
@@ -41,10 +41,10 @@ class Upsert extends DocumentsUpsert
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', [
new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'upsertDocuments',
description: '/docs/references/vectordb/upsert-documents.md',
description: '/docs/references/vectorsdb/upsert-documents.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Create as DocumentCreate;
use Appwrite\SDK\AuthType;
@@ -21,7 +21,7 @@ class Create extends DocumentCreate
{
public static function getName(): string
{
return 'createVectorDBDocument';
return 'createVectorsDBDocument';
}
protected function getResponseModel(): string
@@ -38,7 +38,7 @@ class Create extends DocumentCreate
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_POST)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents')
->desc('Create document')
->groups(['api', 'database'])
->label('scope', 'documents.write')
@@ -50,11 +50,11 @@ class Create extends DocumentCreate
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', [
new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'createDocument',
desc: 'Create document',
description: '/docs/references/vectordb/create-document.md',
description: '/docs/references/vectorsdb/create-document.md',
auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
@@ -72,11 +72,11 @@ class Create extends DocumentCreate
]
),
new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'createDocuments',
desc: 'Create documents',
description: '/docs/references/vectordb/create-documents.md',
description: '/docs/references/vectorsdb/create-documents.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Delete as DocumentDelete;
use Appwrite\SDK\AuthType;
@@ -15,7 +15,7 @@ class Delete extends DocumentDelete
{
public static function getName(): string
{
return 'deleteVectorDBDocument';
return 'deleteVectorsDBDocument';
}
/**
@@ -33,7 +33,7 @@ class Delete extends DocumentDelete
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_DELETE)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents/:documentId')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents/:documentId')
->desc('Delete document')
->groups(['api', 'database'])
->label('scope', 'documents.write')
@@ -45,10 +45,10 @@ class Delete extends DocumentDelete
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'deleteDocument',
description: '/docs/references/vectordb/delete-document.md',
description: '/docs/references/vectorsdb/delete-document.md',
auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Get as DocumentGet;
use Appwrite\SDK\AuthType;
@@ -17,7 +17,7 @@ class Get extends DocumentGet
{
public static function getName(): string
{
return 'getVectorDBDocument';
return 'getVectorsDBDocument';
}
protected function getResponseModel(): string
@@ -29,16 +29,16 @@ class Get extends DocumentGet
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents/:documentId')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents/:documentId')
->desc('Get document')
->groups(['api', 'database'])
->label('scope', 'documents.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'getDocument',
description: '/docs/references/vectordb/get-document.md',
description: '/docs/references/vectorsdb/get-document.md',
auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Logs;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Logs;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Logs\XList as DocumentLogXList;
use Appwrite\SDK\AuthType;
@@ -17,23 +17,23 @@ class XList extends DocumentLogXList
{
public static function getName(): string
{
return 'listVectorDBDocumentLogs';
return 'listVectorsDBDocumentLogs';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents/:documentId/logs')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents/:documentId/logs')
->desc('List document logs')
->groups(['api', 'database'])
->label('scope', 'documents.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'logs',
name: 'listDocumentLogs',
description: '/docs/references/vectordb/get-document-logs.md',
description: '/docs/references/vectorsdb/get-document-logs.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Update as DocumentUpdate;
use Appwrite\SDK\AuthType;
@@ -18,7 +18,7 @@ class Update extends DocumentUpdate
{
public static function getName(): string
{
return 'updateVectorDBDocument';
return 'updateVectorsDBDocument';
}
protected function getResponseModel(): string
@@ -30,7 +30,7 @@ class Update extends DocumentUpdate
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_PATCH)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents/:documentId')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents/:documentId')
->desc('Update document')
->groups(['api', 'database'])
->label('event', 'databases.[databaseId].collections.[collectionId].documents.[documentId].update')
@@ -42,10 +42,10 @@ class Update extends DocumentUpdate
->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2)
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'updateDocument',
description: '/docs/references/vectordb/update-document.md',
description: '/docs/references/vectorsdb/update-document.md',
auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Upsert as DocumentUpsert;
use Appwrite\SDK\AuthType;
@@ -19,7 +19,7 @@ class Upsert extends DocumentUpsert
{
public static function getName(): string
{
return 'upsertVectorDBDocument';
return 'upsertVectorsDBDocument';
}
protected function getResponseModel(): string
@@ -31,7 +31,7 @@ class Upsert extends DocumentUpsert
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents/:documentId')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents/:documentId')
->desc('Upsert a document')
->groups(['api', 'database'])
->label('event', 'databases.[databaseId].collections.[collectionId].documents.[documentId].upsert')
@@ -44,10 +44,10 @@ class Upsert extends DocumentUpsert
->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT)
->label('sdk', [
new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'upsertDocument',
description: '/docs/references/vectordb/upsert-document.md',
description: '/docs/references/vectorsdb/upsert-document.md',
auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\XList as DocumentXList;
use Appwrite\SDK\AuthType;
@@ -19,7 +19,7 @@ class XList extends DocumentXList
{
public static function getName(): string
{
return 'listVectorDBDocuments';
return 'listVectorsDBDocuments';
}
protected function getResponseModel(): string
@@ -31,16 +31,16 @@ class XList extends DocumentXList
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/documents')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/documents')
->desc('List documents')
->groups(['api', 'database'])
->label('scope', 'documents.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'listDocuments',
description: '/docs/references/vectordb/list-documents.md',
description: '/docs/references/vectorsdb/list-documents.md',
auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Get as CollectionGet;
use Appwrite\SDK\AuthType;
@@ -15,28 +15,28 @@ class Get extends CollectionGet
{
public static function getName(): string
{
return 'getVectorDBCollection';
return 'getVectorsDBCollection';
}
protected function getResponseModel(): string
{
return UtopiaResponse::MODEL_VECTORDB_COLLECTION;
return UtopiaResponse::MODEL_VECTORSDB_COLLECTION;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId')
->desc('Get collection')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'collections',
name: 'getCollection',
description: '/docs/references/vectordb/get-collection.md',
description: '/docs/references/vectorsdb/get-collection.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Create as IndexCreate;
use Appwrite\SDK\AuthType;
@@ -21,7 +21,7 @@ class Create extends IndexCreate
{
public static function getName(): string
{
return 'createVectorDBIndex';
return 'createVectorsDBIndex';
}
protected function getResponseModel(): string
@@ -33,7 +33,7 @@ class Create extends IndexCreate
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_POST)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/indexes')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/indexes')
->desc('Create index')
->groups(['api', 'database'])
->label('event', 'databases.[databaseId].tables.[tableId].indexes.[indexId].create')
@@ -42,10 +42,10 @@ class Create extends IndexCreate
->label('audits.event', 'index.create')
->label('audits.resource', 'database/{request.databaseId}/collection/{request.tableId}')
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'createIndex',
description: '/docs/references/vectordb/create-index.md',
description: '/docs/references/vectorsdb/create-index.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Delete as IndexDelete;
use Appwrite\SDK\AuthType;
@@ -16,7 +16,7 @@ class Delete extends IndexDelete
{
public static function getName(): string
{
return 'deleteVectorDBIndex';
return 'deleteVectorsDBIndex';
}
/**
@@ -32,7 +32,7 @@ class Delete extends IndexDelete
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_DELETE)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/indexes/:key')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/indexes/:key')
->desc('Delete index')
->groups(['api', 'database'])
->label('scope', 'collections.write')
@@ -41,10 +41,10 @@ class Delete extends IndexDelete
->label('audits.event', 'index.delete')
->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}')
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'deleteIndex', // getName needs to be different from parent action to avoid conflict in path name
description: '/docs/references/vectordb/delete-index.md',
description: '/docs/references/vectorsdb/delete-index.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Get as IndexGet;
use Appwrite\SDK\AuthType;
@@ -16,7 +16,7 @@ class Get extends IndexGet
{
public static function getName(): string
{
return 'getVectorDBIndex';
return 'getVectorsDBIndex';
}
protected function getResponseModel(): string
@@ -28,16 +28,16 @@ class Get extends IndexGet
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/indexes/:key')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/indexes/:key')
->desc('Get index')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'getIndex', // getName needs to be different from parent action to avoid conflict in path name
description: '/docs/references/vectordb/get-index.md',
description: '/docs/references/vectorsdb/get-index.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\XList as IndexXList;
use Appwrite\SDK\AuthType;
@@ -17,7 +17,7 @@ class XList extends IndexXList
{
public static function getName(): string
{
return 'listVectorDBIndexes';
return 'listVectorsDBIndexes';
}
protected function getResponseModel(): string
@@ -29,16 +29,16 @@ class XList extends IndexXList
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/indexes')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/indexes')
->desc('List indexes')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'listIndexes', // getName needs to be different from parent action to avoid conflict in path name
description: '/docs/references/vectordb/list-indexes.md',
description: '/docs/references/vectorsdb/list-indexes.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Logs;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Logs;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Logs\XList as CollectionLogXList;
use Appwrite\SDK\AuthType;
@@ -17,23 +17,23 @@ class XList extends CollectionLogXList
{
public static function getName(): string
{
return 'listVectorDBCollectionLogs';
return 'listVectorsDBCollectionLogs';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/logs')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/logs')
->desc('List collection logs')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'listCollectionLogs',
description: '/docs/references/vectordb/get-collection-logs.md',
description: '/docs/references/vectorsdb/get-collection-logs.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections;
use Appwrite\Event\Event;
use Appwrite\Extend\Exception;
@@ -24,19 +24,19 @@ class Update extends CollectionAction
{
public static function getName(): string
{
return 'updateVectorDBCollection';
return 'updateVectorsDBCollection';
}
protected function getResponseModel(): string
{
return UtopiaResponse::MODEL_VECTORDB_COLLECTION;
return UtopiaResponse::MODEL_VECTORSDB_COLLECTION;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId')
->desc('Update collection')
->groups(['api', 'database', 'schema'])
->label('scope', 'collections.write')
@@ -45,15 +45,15 @@ class Update extends CollectionAction
->label('audits.event', 'collection.update')
->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}')
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'collections',
name: 'updateCollection',
description: '/docs/references/vectordb/update-collection.md',
description: '/docs/references/vectorsdb/update-collection.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
code: SwooleResponse::STATUS_CODE_OK,
model: UtopiaResponse::MODEL_VECTORDB_COLLECTION,
model: UtopiaResponse::MODEL_VECTORSDB_COLLECTION,
)
],
contentType: ContentType::JSON
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Usage;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Usage;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Usage\Get as CollectionUsageGet;
use Appwrite\SDK\AuthType;
@@ -16,7 +16,7 @@ class Get extends CollectionUsageGet
{
public static function getName(): string
{
return 'getVectorDBCollectionUsage';
return 'getVectorsDBCollectionUsage';
}
protected function getResponseModel(): string
@@ -26,23 +26,23 @@ class Get extends CollectionUsageGet
protected function getMetric(): string
{
return METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS_VECTORDB;
return METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS_VECTORSDB;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections/:collectionId/usage')
->setHttpPath('/v1/vectorsdb/:databaseId/collections/:collectionId/usage')
->desc('Get collection usage stats')
->groups(['api', 'database', 'usage'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: null,
name: 'getCollectionUsage',
description: '/docs/references/vectordb/get-collection-usage.md',
description: '/docs/references/vectorsdb/get-collection-usage.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\XList as CollectionXList;
use Appwrite\SDK\AuthType;
@@ -18,28 +18,28 @@ class XList extends CollectionXList
{
public static function getName(): string
{
return 'listVectorDBCollections';
return 'listVectorsDBCollections';
}
protected function getResponseModel(): string
{
return UtopiaResponse::MODEL_VECTORDB_COLLECTION_LIST;
return UtopiaResponse::MODEL_VECTORSDB_COLLECTION_LIST;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/collections')
->setHttpPath('/v1/vectorsdb/:databaseId/collections')
->desc('List collections')
->groups(['api', 'database'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'collections',
name: 'listCollections',
description: '/docs/references/vectordb/list-collections.md',
description: '/docs/references/vectorsdb/list-collections.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB;
use Appwrite\Platform\Modules\Databases\Http\Databases\Create as DatabaseCreate;
use Appwrite\SDK\AuthType;
@@ -17,14 +17,14 @@ class Create extends DatabaseCreate
{
public static function getName(): string
{
return 'createVectorDBDatabase';
return 'createVectorsDBDatabase';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_POST)
->setHttpPath('/v1/vectordb')
->setHttpPath('/v1/vectorsdb')
->desc('Create database')
->groups(['api', 'database'])
->label('event', 'databases.[databaseId].create')
@@ -33,10 +33,10 @@ class Create extends DatabaseCreate
->label('audits.event', 'database.create')
->label('audits.resource', 'database/{response.$id}')
->label('sdk', new Method(
namespace: 'vectorDB',
group: 'vectordb',
namespace: 'vectorsDB',
group: 'vectorsdb',
name: 'create',
description: '/docs/references/vectordb/create.md',
description: '/docs/references/vectorsdb/create.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB;
use Appwrite\Platform\Modules\Databases\Http\Databases\Delete as DatabaseDelete;
use Appwrite\SDK\AuthType;
@@ -15,14 +15,14 @@ class Delete extends DatabaseDelete
{
public static function getName(): string
{
return 'deleteVectorDBDatabase';
return 'deleteVectorsDBDatabase';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_DELETE)
->setHttpPath('/v1/vectordb/:databaseId')
->setHttpPath('/v1/vectorsdb/:databaseId')
->desc('Delete database')
->groups(['api', 'database', 'schema'])
->label('scope', 'databases.write')
@@ -31,10 +31,10 @@ class Delete extends DatabaseDelete
->label('audits.event', 'database.delete')
->label('audits.resource', 'database/{request.databaseId}')
->label('sdk', new Method(
namespace: 'vectorDB',
group: 'vectordb',
namespace: 'vectorsDB',
group: 'vectorsdb',
name: 'delete',
description: '/docs/references/vectordb/delete.md',
description: '/docs/references/vectorsdb/delete.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Embeddings\Text;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Embeddings\Text;
use Appwrite\Event\StatsUsage;
use Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Documents\Action as CreateDocumentAction;
@@ -42,23 +42,23 @@ class Create extends CreateDocumentAction
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_POST)
->setHttpPath('/v1/vectordb/embeddings/text')
->setHttpPath('/v1/vectorsdb/embeddings/text')
->desc('Create Text Embeddings')
->groups(['api', 'database'])
->label('scope', 'documents.write')
->label('resourceType', RESOURCE_TYPE_EMBEDDINGS_TEXT)
->label('audits.event', 'embedding.create')
->label('audits.resource', 'vectordb/embeddings/text')
->label('audits.resource', 'vectorsdb/embeddings/text')
->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: 'vectorDB',
namespace: 'vectorsDB',
group: $this->getSdkGroup(),
name: 'createTextEmbeddings',
desc: 'Create Text Embedding',
description: '/docs/references/vectordb/create-document.md',
description: '/docs/references/vectorsdb/create-document.md',
auth: [AuthType::ADMIN, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB;
use Appwrite\Platform\Modules\Databases\Http\Databases\Get as DatabaseGet;
use Appwrite\SDK\AuthType;
@@ -15,23 +15,23 @@ class Get extends DatabaseGet
{
public static function getName(): string
{
return 'getVectorDBDatabase';
return 'getVectorsDBDatabase';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId')
->setHttpPath('/v1/vectorsdb/:databaseId')
->desc('Get database')
->groups(['api', 'database'])
->label('scope', 'databases.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
group: 'vectordb',
namespace: 'vectorsDB',
group: 'vectorsdb',
name: 'get',
description: '/docs/references/vectordb/get.md',
description: '/docs/references/vectorsdb/get.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Logs;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Logs;
use Appwrite\Platform\Modules\Databases\Http\Databases\Logs\XList as DatabaseLogs;
use Appwrite\SDK\AuthType;
@@ -18,24 +18,24 @@ class XList extends DatabaseLogs
{
public static function getName(): string
{
return 'listVectorDBLogs';
return 'listVectorsDBLogs';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/logs')
->setHttpPath('/v1/vectorsdb/:databaseId/logs')
->desc('List database logs')
->groups(['api', 'database'])
->label('scope', 'databases.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', [
new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'logs',
name: 'listDatabaseLogs',
description: '/docs/references/vectordb/get-logs.md',
description: '/docs/references/vectorsdb/get-logs.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions;
use Appwrite\Platform\Modules\Databases\Http\Databases\Transactions\Create as TransactionsCreate;
use Appwrite\SDK\AuthType;
@@ -15,7 +15,7 @@ class Create extends TransactionsCreate
{
public static function getName(): string
{
return 'createVectorDBTransaction';
return 'createVectorsDBTransaction';
}
protected function getResponseModel(): string
@@ -27,16 +27,16 @@ class Create extends TransactionsCreate
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_POST)
->setHttpPath('/v1/vectordb/transactions')
->setHttpPath('/v1/vectorsdb/transactions')
->desc('Create transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.write')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'transactions',
name: 'createTransaction',
description: '/docs/references/vectordb/create-transaction.md',
description: '/docs/references/vectorsdb/create-transaction.md',
auth: [AuthType::ADMIN, AuthType::KEY, AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions;
use Appwrite\Platform\Modules\Databases\Http\Databases\Transactions\Delete as TransactionsDelete;
use Appwrite\SDK\AuthType;
@@ -15,7 +15,7 @@ class Delete extends TransactionsDelete
{
public static function getName(): string
{
return 'deleteVectorDBTransaction';
return 'deleteVectorsDBTransaction';
}
protected function getResponseModel(): string
@@ -27,16 +27,16 @@ class Delete extends TransactionsDelete
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_DELETE)
->setHttpPath('/v1/vectordb/transactions/:transactionId')
->setHttpPath('/v1/vectorsdb/transactions/:transactionId')
->desc('Delete transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.write')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'transactions',
name: 'deleteTransaction',
description: '/docs/references/vectordb/delete-transaction.md',
description: '/docs/references/vectorsdb/delete-transaction.md',
auth: [AuthType::ADMIN, AuthType::KEY, AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions;
use Appwrite\Platform\Modules\Databases\Http\Databases\Transactions\Get as TransactionsGet;
use Appwrite\SDK\AuthType;
@@ -15,7 +15,7 @@ class Get extends TransactionsGet
{
public static function getName(): string
{
return 'getVectorDBTransaction';
return 'getVectorsDBTransaction';
}
protected function getResponseModel(): string
@@ -27,16 +27,16 @@ class Get extends TransactionsGet
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/transactions/:transactionId')
->setHttpPath('/v1/vectorsdb/transactions/:transactionId')
->desc('Get transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'transactions',
name: 'getTransaction',
description: '/docs/references/vectordb/get-transaction.md',
description: '/docs/references/vectorsdb/get-transaction.md',
auth: [AuthType::ADMIN, AuthType::KEY, AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions\Operations;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions\Operations;
use Appwrite\Platform\Modules\Databases\Http\Databases\Transactions\Operations\Create as OperationsCreate;
use Appwrite\SDK\AuthType;
@@ -17,7 +17,7 @@ class Create extends OperationsCreate
{
public static function getName(): string
{
return 'createVectorDBOperations';
return 'createVectorsDBOperations';
}
protected function getResponseModel(): string
@@ -29,16 +29,16 @@ class Create extends OperationsCreate
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_POST)
->setHttpPath('/v1/vectordb/transactions/:transactionId/operations')
->setHttpPath('/v1/vectorsdb/transactions/:transactionId/operations')
->desc('Create operations')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.write')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'transactions',
name: 'createOperations',
description: '/docs/references/vectordb/create-operations.md',
description: '/docs/references/vectorsdb/create-operations.md',
auth: [AuthType::ADMIN, AuthType::KEY, AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions;
use Appwrite\Platform\Modules\Databases\Http\Databases\Transactions\Update as TransactionsUpdate;
use Appwrite\SDK\AuthType;
@@ -16,7 +16,7 @@ class Update extends TransactionsUpdate
{
public static function getName(): string
{
return 'updateVectorDBTransaction';
return 'updateVectorsDBTransaction';
}
protected function getResponseModel(): string
@@ -28,16 +28,16 @@ class Update extends TransactionsUpdate
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_PATCH)
->setHttpPath('/v1/vectordb/transactions/:transactionId')
->setHttpPath('/v1/vectorsdb/transactions/:transactionId')
->desc('Update transaction')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.write')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'transactions',
name: 'updateTransaction',
description: '/docs/references/vectordb/update-transaction.md',
description: '/docs/references/vectorsdb/update-transaction.md',
auth: [AuthType::ADMIN, AuthType::KEY, AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions;
use Appwrite\Platform\Modules\Databases\Http\Databases\Transactions\XList as TransactionsList;
use Appwrite\SDK\AuthType;
@@ -15,7 +15,7 @@ class XList extends TransactionsList
{
public static function getName(): string
{
return 'listVectorDBTransactions';
return 'listVectorsDBTransactions';
}
protected function getResponseModel(): string
@@ -27,16 +27,16 @@ class XList extends TransactionsList
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/transactions')
->setHttpPath('/v1/vectorsdb/transactions')
->desc('List transactions')
->groups(['api', 'database', 'transactions'])
->label('scope', 'documents.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: 'transactions',
name: 'listTransactions',
description: '/docs/references/vectordb/list-transactions.md',
description: '/docs/references/vectorsdb/list-transactions.md',
auth: [AuthType::ADMIN, AuthType::KEY, AuthType::SESSION, AuthType::JWT],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB;
use Appwrite\Platform\Modules\Databases\Http\Databases\Update as DatabaseUpdate;
use Appwrite\SDK\AuthType;
@@ -17,14 +17,14 @@ class Update extends DatabaseUpdate
{
public static function getName(): string
{
return 'updateVectorDBDatabase';
return 'updateVectorsDBDatabase';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT)
->setHttpPath('/v1/vectordb/:databaseId')
->setHttpPath('/v1/vectorsdb/:databaseId')
->desc('Update database')
->groups(['api', 'database', 'schema'])
->label('scope', 'databases.write')
@@ -33,10 +33,10 @@ class Update extends DatabaseUpdate
->label('audits.event', 'database.update')
->label('audits.resource', 'database/{response.$id}')
->label('sdk', new Method(
namespace: 'vectorDB',
group: 'vectordb',
namespace: 'vectorsDB',
group: 'vectorsdb',
name: 'update',
description: '/docs/references/vectordb/update.md',
description: '/docs/references/vectorsdb/update.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Usage;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Usage;
use Appwrite\Platform\Modules\Databases\Http\Databases\Usage\Get as DatabaseUsageGet;
use Appwrite\SDK\AuthType;
@@ -16,34 +16,34 @@ class Get extends DatabaseUsageGet
{
public static function getName(): string
{
return 'getVectorDBUsage';
return 'getVectorsDBUsage';
}
public function getResponseModel(): string
{
return UtopiaResponse::MODEL_USAGE_VECTORDB;
return UtopiaResponse::MODEL_USAGE_VECTORSDB;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/:databaseId/usage')
->desc('Get VectorDB usage stats')
->setHttpPath('/v1/vectorsdb/:databaseId/usage')
->desc('Get VectorsDB usage stats')
->groups(['api', 'database', 'usage'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', [
new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: null,
name: 'getUsage',
description: '/docs/references/vectordb/get-database-usage.md',
description: '/docs/references/vectorsdb/get-database-usage.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: SwooleResponse::STATUS_CODE_OK,
model: UtopiaResponse::MODEL_USAGE_VECTORDB,
model: UtopiaResponse::MODEL_USAGE_VECTORSDB,
)
],
contentType: ContentType::JSON,
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB\Usage;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB\Usage;
use Appwrite\Platform\Modules\Databases\Http\Databases\Usage\XList as DatabaseUsageXList;
use Appwrite\SDK\AuthType;
@@ -15,34 +15,34 @@ class XList extends DatabaseUsageXList
{
public static function getName(): string
{
return 'listVectorDBUsage';
return 'listVectorsDBUsage';
}
public function getResponseModel(): string
{
return UtopiaResponse::MODEL_USAGE_VECTORDBS;
return UtopiaResponse::MODEL_USAGE_VECTORSDBS;
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb/usage')
->desc('Get VectorDB usage stats')
->setHttpPath('/v1/vectorsdb/usage')
->desc('Get VectorsDB usage stats')
->groups(['api', 'database', 'usage'])
->label('scope', 'collections.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', [
new Method(
namespace: 'vectorDB',
namespace: 'vectorsDB',
group: null,
name: 'listUsage',
description: '/docs/references/vectordb/list-usage.md',
description: '/docs/references/vectorsdb/list-usage.md',
auth: [AuthType::ADMIN],
responses: [
new SDKResponse(
code: SwooleResponse::STATUS_CODE_OK,
model: UtopiaResponse::MODEL_USAGE_VECTORDBS,
model: UtopiaResponse::MODEL_USAGE_VECTORSDBS,
)
],
contentType: ContentType::JSON
@@ -1,6 +1,6 @@
<?php
namespace Appwrite\Platform\Modules\Databases\Http\VectorDB;
namespace Appwrite\Platform\Modules\Databases\Http\VectorsDB;
use Appwrite\Platform\Modules\Databases\Http\Databases\XList as DatabaseXList;
use Appwrite\SDK\AuthType;
@@ -17,23 +17,23 @@ class XList extends DatabaseXList
{
public static function getName(): string
{
return 'listVectorDBDatabases';
return 'listVectorsDBDatabases';
}
public function __construct()
{
$this
->setHttpMethod(self::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/vectordb')
->setHttpPath('/v1/vectorsdb')
->desc('List databases')
->groups(['api', 'database'])
->label('scope', 'databases.read')
->label('resourceType', RESOURCE_TYPE_DATABASES)
->label('sdk', new Method(
namespace: 'vectorDB',
group: 'vectordb',
namespace: 'vectorsDB',
group: 'vectorsdb',
name: 'list',
description: '/docs/references/vectordb/list.md',
description: '/docs/references/vectorsdb/list.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
@@ -6,7 +6,7 @@ use Appwrite\Platform\Modules\Databases\Http\Init\Timeout;
use Appwrite\Platform\Modules\Databases\Services\Registry\DocumentsDB as DocumentsDBRegistry;
use Appwrite\Platform\Modules\Databases\Services\Registry\Legacy as LegacyRegistry;
use Appwrite\Platform\Modules\Databases\Services\Registry\TablesDB as TablesDBDBRegistry;
use Appwrite\Platform\Modules\Databases\Services\Registry\VectorDB as VectorDBRegistry;
use Appwrite\Platform\Modules\Databases\Services\Registry\VectorsDB as VectorsDBRegistry;
use Utopia\Platform\Service;
class Http extends Service
@@ -21,7 +21,7 @@ class Http extends Service
LegacyRegistry::class,
TablesDBDBRegistry::class,
DocumentsDBRegistry::class,
VectorDBRegistry::class
VectorsDBRegistry::class
] as $registrar) {
new $registrar($this);
}
@@ -2,43 +2,43 @@
namespace Appwrite\Platform\Modules\Databases\Services\Registry;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Create as CreateCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Delete as DeleteCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Bulk\Delete as DeleteDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Bulk\Update as UpdateDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Bulk\Upsert as UpsertDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Create as CreateDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Delete as DeleteDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Get as GetDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Update as UpdateDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\Upsert as UpsertDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Documents\XList as ListDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Get as GetCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes\Create as CreateIndex;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes\Delete as DeleteIndex;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes\Get as GetIndex;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Indexes\XList as ListIndexes;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Logs\XList as ListCollectionLogs;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Update as UpdateCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\Usage\Get as GetCollectionUsage;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Collections\XList as ListCollections;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Create as CreateVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Delete as DeleteVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Embeddings\Text\Create as CreateTextEmbeddings;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Get as GetVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions\Create as CreateTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions\Delete as DeleteTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions\Get as GetTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions\Operations\Create as CreateOperations;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions\Update as UpdateTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Transactions\XList as ListTransactions;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Update as UpdateVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Usage\Get as GetVectorDatabaseUsage;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\Usage\XList as ListVectorDatabaseUsage;
use Appwrite\Platform\Modules\Databases\Http\VectorDB\XList as ListVectorDatabases;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Create as CreateCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Delete as DeleteCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bulk\Delete as DeleteDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bulk\Update as UpdateDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Bulk\Upsert as UpsertDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Create as CreateDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Delete as DeleteDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Get as GetDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Update as UpdateDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\Upsert as UpsertDocument;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Documents\XList as ListDocuments;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Get as GetCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes\Create as CreateIndex;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes\Delete as DeleteIndex;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes\Get as GetIndex;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Indexes\XList as ListIndexes;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Logs\XList as ListCollectionLogs;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Update as UpdateCollection;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\Usage\Get as GetCollectionUsage;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Collections\XList as ListCollections;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Create as CreateVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Delete as DeleteVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Embeddings\Text\Create as CreateTextEmbeddings;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Get as GetVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions\Create as CreateTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions\Delete as DeleteTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions\Get as GetTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions\Operations\Create as CreateOperations;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions\Update as UpdateTransaction;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Transactions\XList as ListTransactions;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Update as UpdateVectorDatabase;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Usage\Get as GetVectorDatabaseUsage;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\Usage\XList as ListVectorDatabaseUsage;
use Appwrite\Platform\Modules\Databases\Http\VectorsDB\XList as ListVectorDatabases;
use Utopia\Platform\Service;
class VectorDB extends Base
class VectorsDB extends Base
{
protected function register(Service $service): void
{
@@ -180,7 +180,8 @@ class Create extends Base
$version = $function->getAttribute('version', 'v2');
$runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []);
$spec = Config::getParam('specifications')[$function->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$spec = Config::getParam('specifications')[$function->getAttribute('runtimeSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$runtime = (isset($runtimes[$function->getAttribute('runtime', '')])) ? $runtimes[$function->getAttribute('runtime', '')] : null;
@@ -420,6 +421,11 @@ class Create extends Base
try {
$version = $function->getAttribute('version', 'v2');
$command = $runtime['startCommand'];
if (!empty($deployment->getAttribute('startCommand', ''))) {
$command = 'cd /usr/local/server/src/function/ && ' . $deployment->getAttribute('startCommand', '');
}
$source = $deployment->getAttribute('buildPath', '');
$extension = str_ends_with($source, '.tar') ? 'tar' : 'tar.gz';
$command = $version === 'v2' ? '' : "cp /tmp/code.$extension /mnt/code/code.$extension && nohup helpers/start.sh \"$command\"";
@@ -93,16 +93,23 @@ class Create extends Base
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the function.', true)
->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.', true)
->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo.', true)
->param('specification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Runtime specification for the function and builds.', true, ['plan'])
), 'Build specification for the function deployments.', true, ['plan'])
->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Runtime specification for the function executions.', true, ['plan'])
->param('templateRepository', '', new Text(128, 0), 'Repository name of the template.', true, deprecated: true)
->param('templateOwner', '', new Text(128, 0), 'The name of the owner of the template.', true, deprecated: true)
->param('templateRootDirectory', '', new Text(128, 0), 'Path to function code in the template repo.', true, deprecated: true)
->param('templateVersion', '', new Text(128, 0), 'Version (tag) for the repo linked to the function template.', true, deprecated: true)
->param('deploymentRetention', 0, new Range(0, APP_COMPUTE_DEPLOYMENT_MAX_RETENTION), 'Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.', true)
->inject('response')
->inject('dbForProject')
->inject('timelimit')
@@ -138,11 +145,13 @@ class Create extends Base
string $providerBranch,
bool $providerSilentMode,
string $providerRootDirectory,
string $specification,
string $buildSpecification,
string $runtimeSpecification,
string $templateRepository,
string $templateOwner,
string $templateRootDirectory,
string $templateVersion,
int $deploymentRetention,
Response $response,
Database $dbForProject,
callable $timelimit,
@@ -215,6 +224,7 @@ class Create extends Base
'logging' => $logging,
'name' => $name,
'runtime' => $runtime,
'deploymentRetention' => $deploymentRetention,
'deploymentInternalId' => '',
'deploymentId' => '',
'events' => $events,
@@ -225,7 +235,6 @@ class Create extends Base
'entrypoint' => $entrypoint,
'commands' => $commands,
'scopes' => $scopes,
'deploymentRetention' => 0,
'startCommand' => '',
'search' => implode(' ', [$functionId, $name, $runtime]),
'version' => 'v5',
@@ -237,9 +246,8 @@ class Create extends Base
'providerBranch' => $providerBranch,
'providerRootDirectory' => $providerRootDirectory,
'providerSilentMode' => $providerSilentMode,
'specification' => $specification,
'buildSpecification' => $specification,
'runtimeSpecification' => $specification,
'buildSpecification' => $buildSpecification,
'runtimeSpecification' => $runtimeSpecification,
]));
} catch (DuplicateException) {
throw new Exception(Exception::FUNCTION_ALREADY_EXISTS);
@@ -87,12 +87,19 @@ class Update extends Base
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the function', true)
->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.', true)
->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo.', true)
->param('specification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Runtime specification for the function and builds.', true, ['plan'])
), 'Build specification for the function deployments.', true, ['plan'])
->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Runtime specification for the function executions.', true, ['plan'])
->param('deploymentRetention', 0, new Range(0, APP_COMPUTE_DEPLOYMENT_MAX_RETENTION), 'Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.', true)
->inject('request')
->inject('response')
->inject('dbForProject')
@@ -124,7 +131,9 @@ class Update extends Base
string $providerBranch,
bool $providerSilentMode,
string $providerRootDirectory,
string $specification,
string $buildSpecification,
string $runtimeSpecification,
int $deploymentRetention,
Request $request,
Response $response,
Database $dbForProject,
@@ -209,7 +218,7 @@ class Update extends Base
'resourceId' => $function->getId(),
'resourceInternalId' => $function->getSequence(),
'resourceType' => 'function',
'providerPullRequestIds' => []
'providerPullRequestIds' => [],
]));
$repositoryId = $repository->getId();
@@ -229,13 +238,22 @@ class Update extends Base
}
// Enforce Cold Start if spec limits change.
if ($function->getAttribute('specification') !== $specification && !empty($function->getAttribute('deploymentId'))) {
try {
$executor->deleteRuntime($project->getId(), $function->getAttribute('deploymentId'));
} catch (\Throwable $th) {
// Don't throw if the deployment doesn't exist
if ($th->getCode() !== 404) {
throw $th;
if (!empty($function->getAttribute('deploymentId'))) {
$specsChanged = false;
if ($function->getAttribute('runtimeSpecification', '') !== $runtimeSpecification) {
$specsChanged = true;
} elseif ($function->getAttribute('buildSpecification', '') !== $buildSpecification) {
$specsChanged = true;
}
if ($specsChanged) {
try {
$executor->deleteRuntime($project->getId(), $function->getAttribute('deploymentId'));
} catch (\Throwable $th) {
// Don't throw if the deployment doesn't exist
if ($th->getCode() !== 404) {
throw $th;
}
}
}
}
@@ -253,8 +271,7 @@ class Update extends Base
'entrypoint' => $entrypoint,
'commands' => $commands,
'scopes' => $scopes,
'deploymentRetention' => 0,
'startCommand' => '',
'deploymentRetention' => $deploymentRetention,
'installationId' => $installation->getId(),
'installationInternalId' => $installation->getSequence(),
'providerRepositoryId' => $providerRepositoryId,
@@ -263,9 +280,8 @@ class Update extends Base
'providerBranch' => $providerBranch,
'providerRootDirectory' => $providerRootDirectory,
'providerSilentMode' => $providerSilentMode,
'specification' => $specification,
'buildSpecification' => $specification,
'runtimeSpecification' => $specification,
'buildSpecification' => $buildSpecification,
'runtimeSpecification' => $runtimeSpecification,
'search' => implode(' ', [$functionId, $name, $runtime]),
])));
@@ -255,7 +255,7 @@ class Builds extends Action
$version = $this->getVersion($resource);
$runtime = $this->getRuntime($resource, $version);
$spec = Config::getParam('specifications')[$resource->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$spec = Config::getParam('specifications')[$resource->getAttribute('buildSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
if ($resource->getCollection() === 'functions' && \is_null($runtime)) {
throw new \Exception('Runtime "' . $resource->getAttribute('runtime', '') . '" is not supported');
@@ -1229,7 +1229,7 @@ class Builds extends Action
protected function sendUsage(Document $resource, Document $deployment, Document $project, StatsUsage $queue): void
{
$spec = Config::getParam('specifications')[$resource->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$spec = Config::getParam('specifications')[$resource->getAttribute('buildSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
switch ($deployment->getAttribute('status')) {
case 'ready':
@@ -2,7 +2,6 @@
namespace Appwrite\Platform\Modules\Health\Http\Health\Storage;
use Appwrite\Extend\Exception;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
@@ -58,33 +57,21 @@ class Get extends Action
$checkStart = \microtime(true);
foreach ($devices as $device) {
$uniqueFileName = \uniqid('health', true);
$filePath = $device->getPath($uniqueFileName);
$path = $device->getPath(\uniqid('health', true));
if (!$device->write($filePath, 'test', 'text/plain')) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed writing test file to ' . $device->getRoot());
}
$readError = null;
try {
if ($device->read($filePath) !== 'test') {
$readError = new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed reading test file from ' . $device->getRoot());
if (!$device->write($path, 'test', 'text/plain')) {
throw new \Exception("Failed writing test file to {$device->getRoot()}");
}
$content = $device->read($path);
if ($content !== 'test') {
throw new \Exception("Failed reading test file from {$device->getRoot()}: content mismatch");
}
} catch (\Throwable $e) {
$readError = $e;
} finally {
// Always attempt to clean up test file
if (!$device->delete($filePath)) {
if ($readError !== null) {
// If read already failed, wrap delete error but preserve original
\error_log('Failed deleting test file from ' . $device->getRoot() . ' during read error recovery');
} else {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed deleting test file from ' . $device->getRoot());
}
}
// Re-throw read error if it occurred
if ($readError !== null) {
throw $readError;
try {
$device->delete($path);
} catch (\Throwable) {
}
}
}
@@ -68,6 +68,7 @@ class Create extends Base
->param('timeout', 30, new Range(1, (int) System::getEnv('_APP_SITES_TIMEOUT', 30)), 'Maximum request time in seconds.', true)
->param('installCommand', '', new Text(8192, 0), 'Install Command.', true)
->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true)
->param('startCommand', '', new Text(8192, 0), 'Custom start command. Leave empty to use default.', true)
->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true)
->param('buildRuntime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Runtime to use during build step.')
->param('adapter', '', new WhiteList(['static', 'ssr']), 'Framework adapter defining rendering strategy. Allowed values are: static, ssr', true)
@@ -77,12 +78,19 @@ class Create extends Base
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the site.', true)
->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.', true)
->param('providerRootDirectory', '', new Text(128, 0), 'Path to site code in the linked repo.', true)
->param('specification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Framework specification for the site and builds.', true, ['plan'])
), 'Build specification for the site deployments.', true, ['plan'])
->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Runtime specification for the SSR executions.', true, ['plan'])
->param('deploymentRetention', 0, new Range(0, APP_COMPUTE_DEPLOYMENT_MAX_RETENTION), 'Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.', true)
->inject('response')
->inject('dbForProject')
->inject('project')
@@ -100,6 +108,7 @@ class Create extends Base
int $timeout,
string $installCommand,
string $buildCommand,
string $startCommand,
string $outputDirectory,
string $buildRuntime,
string $adapter,
@@ -109,7 +118,9 @@ class Create extends Base
string $providerBranch,
bool $providerSilentMode,
string $providerRootDirectory,
string $specification,
string $buildSpecification,
string $runtimeSpecification,
int $deploymentRetention,
Response $response,
Database $dbForProject,
Document $project,
@@ -144,13 +155,13 @@ class Create extends Base
'logging' => $logging,
'name' => $name,
'framework' => $framework,
'deploymentRetention' => $deploymentRetention,
'deploymentInternalId' => '',
'deploymentId' => '',
'timeout' => $timeout,
'installCommand' => $installCommand,
'buildCommand' => $buildCommand,
'deploymentRetention' => 0,
'startCommand' => '',
'startCommand' => $startCommand,
'outputDirectory' => $outputDirectory,
'search' => implode(' ', [$siteId, $name, $framework]),
'fallbackFile' => $fallbackFile,
@@ -162,9 +173,8 @@ class Create extends Base
'providerBranch' => $providerBranch,
'providerRootDirectory' => $providerRootDirectory,
'providerSilentMode' => $providerSilentMode,
'specification' => $specification,
'buildSpecification' => $specification,
'runtimeSpecification' => $specification,
'buildSpecification' => $buildSpecification,
'runtimeSpecification' => $runtimeSpecification,
'buildRuntime' => $buildRuntime,
'adapter' => $adapter,
]);
@@ -71,6 +71,7 @@ class Update extends Base
->param('timeout', 30, new Range(1, (int) System::getEnv('_APP_SITES_TIMEOUT', 30)), 'Maximum request time in seconds.', true)
->param('installCommand', '', new Text(8192, 0), 'Install Command.', true)
->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true)
->param('startCommand', '', new Text(8192, 0), 'Custom start command. Leave empty to use default.', true)
->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true)
->param('buildRuntime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Runtime to use during build step.', true)
->param('adapter', '', new WhiteList(['static', 'ssr']), 'Framework adapter defining rendering strategy. Allowed values are: static, ssr', true)
@@ -80,12 +81,19 @@ class Update extends Base
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the site.', true)
->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.', true)
->param('providerRootDirectory', '', new Text(128, 0), 'Path to site code in the linked repo.', true)
->param('specification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Framework specification for the site and builds.', true, ['plan'])
), 'Build specification for the site deployments.', true, ['plan'])
->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification(
$plan,
Config::getParam('specifications', []),
System::getEnv('_APP_COMPUTE_CPUS', 0),
System::getEnv('_APP_COMPUTE_MEMORY', 0)
), 'Runtime specification for the SSR executions.', true, ['plan'])
->param('deploymentRetention', 0, new Range(0, APP_COMPUTE_DEPLOYMENT_MAX_RETENTION), 'Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.', true)
->inject('request')
->inject('response')
->inject('dbForProject')
@@ -107,6 +115,7 @@ class Update extends Base
int $timeout,
string $installCommand,
string $buildCommand,
string $startCommand,
string $outputDirectory,
string $buildRuntime,
string $adapter,
@@ -116,7 +125,9 @@ class Update extends Base
string $providerBranch,
bool $providerSilentMode,
string $providerRootDirectory,
string $specification,
string $buildSpecification,
string $runtimeSpecification,
int $deploymentRetention,
Request $request,
Response $response,
Database $dbForProject,
@@ -216,6 +227,7 @@ class Update extends Base
$site->getAttribute('name') !== $name ||
$site->getAttribute('buildCommand') !== $buildCommand ||
$site->getAttribute('installCommand') !== $installCommand ||
$site->getAttribute('startCommand') !== $startCommand ||
$site->getAttribute('outputDirectory') !== $outputDirectory ||
$site->getAttribute('providerRootDirectory') !== $providerRootDirectory ||
$site->getAttribute('framework') !== $framework
@@ -223,14 +235,22 @@ class Update extends Base
$live = false;
}
// Enforce Cold Start if spec limits change.
if ($site->getAttribute('specification') !== $specification && !empty($site->getAttribute('deploymentId'))) {
try {
$executor->deleteRuntime($project->getId(), $site->getAttribute('deploymentId'));
} catch (\Throwable $th) {
// Don't throw if the deployment doesn't exist
if ($th->getCode() !== 404) {
throw $th;
if (!empty($site->getAttribute('deploymentId'))) {
$specsChanged = false;
if ($site->getAttribute('runtimeSpecification', '') !== $runtimeSpecification) {
$specsChanged = true;
} elseif ($site->getAttribute('buildSpecification', '') !== $buildSpecification) {
$specsChanged = true;
}
if ($specsChanged) {
try {
$executor->deleteRuntime($project->getId(), $site->getAttribute('deploymentId'));
} catch (\Throwable $th) {
// Don't throw if the deployment doesn't exist
if ($th->getCode() !== 404) {
throw $th;
}
}
}
}
@@ -242,10 +262,10 @@ class Update extends Base
'logging' => $logging,
'live' => $live,
'timeout' => $timeout,
'deploymentRetention' => $deploymentRetention,
'installCommand' => $installCommand,
'buildCommand' => $buildCommand,
'deploymentRetention' => 0,
'startCommand' => '',
'startCommand' => $startCommand,
'outputDirectory' => $outputDirectory,
'installationId' => $installation->getId(),
'installationInternalId' => $installation->getSequence(),
@@ -255,9 +275,8 @@ class Update extends Base
'providerBranch' => $providerBranch,
'providerRootDirectory' => $providerRootDirectory,
'providerSilentMode' => $providerSilentMode,
'specification' => $specification,
'buildSpecification' => $specification,
'runtimeSpecification' => $specification,
'buildSpecification' => $buildSpecification,
'runtimeSpecification' => $runtimeSpecification,
'search' => implode(' ', [$siteId, $name, $framework]),
'buildRuntime' => $buildRuntime,
'adapter' => $adapter,
+2
View File
@@ -16,6 +16,7 @@ use Appwrite\Platform\Tasks\SDKs;
use Appwrite\Platform\Tasks\Specs;
use Appwrite\Platform\Tasks\SSL;
use Appwrite\Platform\Tasks\StatsResources;
use Appwrite\Platform\Tasks\TimeTravel;
use Appwrite\Platform\Tasks\Upgrade;
use Appwrite\Platform\Tasks\Vars;
use Appwrite\Platform\Tasks\Version;
@@ -44,6 +45,7 @@ class Tasks extends Service
->addAction(Vars::getName(), new Vars())
->addAction(Version::getName(), new Version())
->addAction(StatsResources::getName(), new StatsResources())
->addAction(TimeTravel::getName(), new TimeTravel())
;
}
}
+15 -5
View File
@@ -13,6 +13,7 @@ use Utopia\Database\Document;
use Utopia\Database\Query;
use Utopia\Platform\Action;
use Utopia\System\System;
use Utopia\Validator\WhiteList;
class Maintenance extends Action
{
@@ -25,6 +26,7 @@ class Maintenance extends Action
{
$this
->desc('Schedules maintenance tasks and publishes them to our queues')
->param('type', 'loop', new WhiteList(['loop', 'trigger']), 'How to run task. "loop" is meant for container entrypoint, and "trigger" for manual execution.')
->inject('dbForPlatform')
->inject('console')
->inject('queueForCertificates')
@@ -32,7 +34,7 @@ class Maintenance extends Action
->callback($this->action(...));
}
public function action(Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes): void
public function action(string $type, Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes): void
{
Console::title('Maintenance V1');
Console::success(APP_NAME . ' maintenance process v1 has started');
@@ -57,9 +59,7 @@ class Maintenance extends Action
$delay = $next->getTimestamp() - $now->getTimestamp();
}
Console::info('Setting loop start time to ' . $next->format("Y-m-d H:i:s.v") . '. Delaying for ' . $delay . ' seconds.');
Console::loop(function () use ($interval, $cacheRetention, $schedulesDeletionRetention, $usageStatsRetentionHourly, $dbForPlatform, $console, $queueForDeletes, $queueForCertificates) {
$action = function () use ($interval, $cacheRetention, $schedulesDeletionRetention, $usageStatsRetentionHourly, $dbForPlatform, $console, $queueForDeletes, $queueForCertificates) {
$time = DatabaseDateTime::now();
Console::info("[{$time}] Notifying workers with maintenance tasks every {$interval} seconds");
@@ -96,7 +96,17 @@ class Maintenance extends Action
$this->notifyDeleteCache($cacheRetention, $queueForDeletes);
$this->notifyDeleteSchedules($schedulesDeletionRetention, $queueForDeletes);
$this->notifyDeleteCSVExports($queueForDeletes);
}, $interval, $delay);
};
if ($type === 'loop') {
Console::info('Setting loop start time to ' . $next->format("Y-m-d H:i:s.v") . '. Delaying for ' . $delay . ' seconds.');
Console::loop(function () use ($action) {
$action();
}, $interval, $delay);
} elseif ($type === 'trigger') {
$action();
}
}
private function notifyDeleteConnections(Delete $queueForDeletes): void
@@ -0,0 +1,72 @@
<?php
namespace Appwrite\Platform\Tasks;
use Utopia\Console;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Validator\Datetime as DatetimeValidator;
use Utopia\Database\Validator\UID;
use Utopia\Platform\Action;
use Utopia\System\System;
use Utopia\Validator\WhiteList;
class TimeTravel extends Action
{
public static function getName(): string
{
return 'time-travel';
}
public function __construct()
{
$this
->desc('Create a time-travel to change $createdAt')
->param('projectId', '', new UID(), 'Project ID.')
->param('resourceType', '', new WhiteList(['deployment']), 'Type of resource.')
->param('resourceId', '', new UID(), 'ID of resource.')
->param('createdAt', '', new DatetimeValidator(), 'New value for $createdAt')
->inject('getProjectDB')
->inject('dbForPlatform')
->callback($this->action(...));
}
public function action(string $projectId, string $resourceType, string $resourceId, string $createdAt, callable $getProjectDB, Database $dbForPlatform): void
{
$isDevelopment = System::getEnv('_APP_ENV', 'development') === 'development';
if (!$isDevelopment) {
Console::error('This task is only available in development mode.');
return;
}
$project = $dbForPlatform->getDocument('projects', $projectId);
if ($project->isEmpty()) {
Console::error('Project not found.');
return;
}
$collection = match ($resourceType) {
'deployment' => 'deployments',
default => throw new \Exception('Resource type not implemented')
};
/** @var Database $dbForProject */
$dbForProject = $getProjectDB($project);
$resource = $dbForProject->getDocument($collection, $resourceId);
if ($resource->isEmpty()) {
Console::error('Resource not found.');
return;
}
$update = new Document([
'$createdAt' => $createdAt,
]);
$dbForProject->withPreserveDates(fn () => $dbForProject->updateDocument($collection, $resourceId, $update));
Console::success('Time-travel successful. Updated $createdAt for ' . $resourceType . ' ' . $resourceId . ' to ' . $createdAt);
}
}
+60 -1
View File
@@ -5,6 +5,7 @@ namespace Appwrite\Platform\Workers;
use Appwrite\Certificates\Adapter as CertificatesAdapter;
use Appwrite\Deletes\Identities;
use Appwrite\Deletes\Targets;
use Appwrite\Event\Delete as DeleteEvent;
use Appwrite\Extend\Exception;
use Executor\Executor;
use Throwable;
@@ -66,6 +67,7 @@ class Deletes extends Action
->inject('executionsRetentionCount')
->inject('auditRetention')
->inject('log')
->inject('queueForDeletes')
->inject('getAudit')
->callback($this->action(...));
}
@@ -92,6 +94,7 @@ class Deletes extends Action
int $executionsRetentionCount,
string $auditRetention,
Log $log,
DeleteEvent $queueForDeletes,
callable $getAudit,
): void {
$payload = $message->getPayload() ?? [];
@@ -212,6 +215,7 @@ class Deletes extends Action
$this->deleteUsageStats($project, $getProjectDB, $getLogsDB, $hourlyUsageRetentionDatetime);
$this->deleteExpiredSessions($project, $getProjectDB);
$this->deleteExpiredTransactions($project, $getProjectDB);
$this->deleteOldDeployments($queueForDeletes, $project, $getProjectDB);
break;
default:
throw new \Exception('No delete operation for type: ' . \strval($type));
@@ -373,6 +377,61 @@ class Deletes extends Action
Targets::delete($getProjectDB($project), Query::equal('sessionInternalId', [$session->getSequence()]));
}
private function deleteOldDeployments(DeleteEvent $queueForDeletes, Document $project, callable $getProjectDB): void
{
/** @var Database $dbForProject */
$dbForProject = $getProjectDB($project);
$removalCallback = function (Document $resource) use ($dbForProject, $queueForDeletes, $project) {
$retention = $resource->getAttribute('deploymentRetention', 0);
// 0 means unlimited - never delete
if ($retention === 0) {
return;
}
$activeDeploymentId = $resource->getAttribute('deploymentId', '');
$queries = [
Query::createdBefore(DateTime::addSeconds(new \DateTime(), -1 * $retention * 24 * 60 * 60)),
Query::equal('resourceInternalId', [$resource->getSequence()]),
Query::equal('resourceType', [$resource->getCollection()]),
Query::orderDesc('$createdAt'),
];
if (!empty($activeDeploymentId)) {
$queries[] = Query::notEqual('$id', $activeDeploymentId);
}
$this->deleteByGroup(
'deployments',
$queries,
$dbForProject,
function (Document $deployment) use ($queueForDeletes, $project) {
$queueForDeletes
->setType(DELETE_TYPE_DOCUMENT)
->setDocument($deployment)
->setProject($project)
->trigger();
}
);
};
$this->listByGroup(
'functions',
[],
$dbForProject,
$removalCallback
);
$this->listByGroup(
'sites',
[],
$dbForProject,
$removalCallback
);
}
/**
* @param Document $project
* @param callable $getProjectDB
@@ -609,7 +668,7 @@ class Deletes extends Action
'database' => $document->getAttribute('database')
]),
...$dbForProject->find('databases', [
Query::equal('type', [DATABASE_TYPE_DOCUMENTSDB, DATABASE_TYPE_VECTORDB]),
Query::equal('type', [DATABASE_TYPE_DOCUMENTSDB, DATABASE_TYPE_VECTORSDB]),
Query::limit(5000),
]),
];
+6 -1
View File
@@ -357,7 +357,7 @@ class Functions extends Action
$user ??= new Document();
$functionId = $function->getId();
$deploymentId = $function->getAttribute('deploymentId', '');
$spec = Config::getParam('specifications')[$function->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$spec = Config::getParam('specifications')[$function->getAttribute('runtimeSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT)];
$log->addTag('deploymentId', $deploymentId);
@@ -511,6 +511,11 @@ class Functions extends Action
try {
$version = $function->getAttribute('version', 'v2');
$command = $runtime['startCommand'];
if (!empty($deployment->getAttribute('startCommand', ''))) {
$command = 'cd /usr/local/server/src/function/ && ' . $deployment->getAttribute('startCommand', '');
}
$source = $deployment->getAttribute('buildPath', '');
$extension = str_ends_with($source, '.tar') ? 'tar' : 'tar.gz';
$command = $version === 'v2' ? '' : "cp /tmp/code.$extension /mnt/code/code.$extension && nohup helpers/start.sh \"$command\"";
+2 -2
View File
@@ -323,8 +323,8 @@ class Migrations extends Action
METRIC_DATABASES_OPERATIONS_WRITES,
METRIC_DATABASES_OPERATIONS_READS_DOCUMENTSDB,
METRIC_DATABASES_OPERATIONS_WRITES_DOCUMENTSDB,
METRIC_DATABASES_OPERATIONS_READS_VECTORDB,
METRIC_DATABASES_OPERATIONS_WRITES_VECTORDB,
METRIC_DATABASES_OPERATIONS_READS_VECTORSDB,
METRIC_DATABASES_OPERATIONS_WRITES_VECTORSDB,
METRIC_NETWORK_REQUESTS,
METRIC_NETWORK_INBOUND,
METRIC_NETWORK_OUTBOUND,
@@ -112,7 +112,7 @@ class StatsResources extends Action
$databases = $dbForProject->count('databases', [Query::equal('type', [DATABASE_TYPE_LEGACY, DATABASE_TYPE_TABLESDB])]);
$documentsdb = $dbForProject->count('databases', [Query::equal('type', [DATABASE_TYPE_DOCUMENTSDB])]);
$vectordb = $dbForProject->count('databases', [Query::equal('type', [DATABASE_TYPE_VECTORDB])]);
$vectorsdb = $dbForProject->count('databases', [Query::equal('type', [DATABASE_TYPE_VECTORSDB])]);
$buckets = $dbForProject->count('buckets');
$users = $dbForProject->count('users');
@@ -148,7 +148,7 @@ class StatsResources extends Action
$metrics = [
METRIC_DATABASES => $databases,
METRIC_DATABASES_DOCUMENTSDB => $documentsdb,
METRIC_DATABASES_VECTORDB => $vectordb,
METRIC_DATABASES_VECTORSDB => $vectorsdb,
METRIC_BUCKETS => $buckets,
METRIC_USERS => $users,
METRIC_FUNCTIONS => $functions,
@@ -273,7 +273,7 @@ class StatsResources extends Action
$totalDocumentsDocumentsdb = 0;
$totalDatabaseStorageDocumentsdb = 0;
// vectordb
// vectorsdb
$totalCollectionsVectordb = 0;
$totalDocumentsVectordb = 0;
$totalDatabaseStorageVectordb = 0;
@@ -299,7 +299,7 @@ class StatsResources extends Action
$totalDocumentsDocumentsdb += $documents;
$totalCollectionsDocumentsdb += $collections;
break;
case DATABASE_TYPE_VECTORDB:
case DATABASE_TYPE_VECTORSDB:
$totalDatabaseStorageVectordb += $storage;
$totalDocumentsVectordb += $documents;
$totalCollectionsVectordb += $collections;
@@ -319,9 +319,9 @@ class StatsResources extends Action
$this->createStatsDocuments($region, METRIC_DOCUMENTS_DOCUMENTSDB, $totalDocumentsDocumentsdb);
$this->createStatsDocuments($region, METRIC_DATABASES_STORAGE_DOCUMENTSDB, $totalDatabaseStorageDocumentsdb);
$this->createStatsDocuments($region, METRIC_COLLECTIONS_VECTORDB, $totalCollectionsVectordb);
$this->createStatsDocuments($region, METRIC_DOCUMENTS_VECTORDB, $totalDocumentsVectordb);
$this->createStatsDocuments($region, METRIC_DATABASES_STORAGE_VECTORDB, $totalDatabaseStorageVectordb);
$this->createStatsDocuments($region, METRIC_COLLECTIONS_VECTORSDB, $totalCollectionsVectordb);
$this->createStatsDocuments($region, METRIC_DOCUMENTS_VECTORSDB, $totalDocumentsVectordb);
$this->createStatsDocuments($region, METRIC_DATABASES_STORAGE_VECTORSDB, $totalDatabaseStorageVectordb);
}
protected function countForCollections(Database $dbForProject, Database $dbForDatabases, Document $database, string $region): array
{
+4 -4
View File
@@ -48,7 +48,7 @@ class StatsUsage extends Action
protected array $skipBaseMetrics = [
METRIC_DATABASES => true,
METRIC_DATABASES_DOCUMENTSDB => true,
METRIC_DATABASES_VECTORDB => true,
METRIC_DATABASES_VECTORSDB => true,
METRIC_BUCKETS => true,
METRIC_USERS => true,
METRIC_FUNCTIONS => true,
@@ -70,11 +70,11 @@ class StatsUsage extends Action
METRIC_DOCUMENTS => true,
METRIC_COLLECTIONS_DOCUMENTSDB => true,
METRIC_DOCUMENTS_DOCUMENTSDB => true,
METRIC_COLLECTIONS_VECTORDB => true,
METRIC_DOCUMENTS_VECTORDB => true,
METRIC_COLLECTIONS_VECTORSDB => true,
METRIC_DOCUMENTS_VECTORSDB => true,
METRIC_DATABASES_STORAGE => true,
METRIC_DATABASES_STORAGE_DOCUMENTSDB => true,
METRIC_DATABASES_STORAGE_VECTORDB => true,
METRIC_DATABASES_STORAGE_VECTORSDB => true,
];
/**
+3 -3
View File
@@ -367,7 +367,7 @@ abstract class Format
}
}
break;
case 'vectorDB':
case 'vectorsDB':
switch ($method) {
case 'getUsage':
case 'listUsage':
@@ -380,7 +380,7 @@ abstract class Format
case 'createIndex':
switch ($param) {
case 'type':
return 'VectorDBIndexType';
return 'VectorsDBIndexType';
case 'orders':
return 'OrderBy';
}
@@ -669,7 +669,7 @@ abstract class Format
break;
case 'databases':
case 'documentsDB':
case 'vectorDB':
case 'vectorsDB':
switch ($method) {
case 'getUsage':
case 'listUsage':
+18 -1
View File
@@ -6,7 +6,7 @@ use Appwrite\Utopia\Request\Filter;
class V21 extends Filter
{
// Convert 1.8.0 params to 1.8.1
// Convert 1.8.0 params to 1.9.0
public function parse(array $content, string $model): array
{
switch ($model) {
@@ -14,6 +14,12 @@ class V21 extends Filter
case 'sites.createTemplateDeployment':
$content = $this->convertVersionToTypeAndReference($content);
break;
case 'functions.create':
case 'sites.create':
case 'functions.update':
case 'sites.update':
$content = $this->convertSpecs($content);
break;
}
return $content;
}
@@ -31,4 +37,15 @@ class V21 extends Filter
}
return $content;
}
protected function convertSpecs(array $content): array
{
if (!empty($content['specification'])) {
$content['buildSpecification'] = $content['specification'];
$content['runtimeSpecification'] = $content['specification'];
unset($content['specification']);
}
return $content;
}
}
+4 -4
View File
@@ -34,8 +34,8 @@ class Response extends SwooleResponse
public const MODEL_USAGE_DATABASE = 'usageDatabase';
public const MODEL_USAGE_DOCUMENTSDBS = 'usageDocumentsDBs';
public const MODEL_USAGE_DOCUMENTSDB = 'usageDocumentsDB';
public const MODEL_USAGE_VECTORDBS = 'usageVectorDBs';
public const MODEL_USAGE_VECTORDB = 'usageVectorDB';
public const MODEL_USAGE_VECTORSDBS = 'usageVectorsDBs';
public const MODEL_USAGE_VECTORSDB = 'usageVectorsDB';
public const MODEL_USAGE_TABLE = 'usageTable';
public const MODEL_USAGE_COLLECTION = 'usageCollection';
public const MODEL_USAGE_USERS = 'usageUsers';
@@ -52,8 +52,8 @@ class Response extends SwooleResponse
public const MODEL_DATABASE_LIST = 'databaseList';
public const MODEL_COLLECTION = 'collection';
public const MODEL_COLLECTION_LIST = 'collectionList';
public const MODEL_VECTORDB_COLLECTION = 'vectordbCollection';
public const MODEL_VECTORDB_COLLECTION_LIST = 'vectordbCollectionList';
public const MODEL_VECTORSDB_COLLECTION = 'vectorsdbCollection';
public const MODEL_VECTORSDB_COLLECTION_LIST = 'vectorsdbCollectionList';
public const MODEL_EMBEDDING = 'embedding';
public const MODEL_EMBEDDING_LIST = 'embeddingList';
public const MODEL_TABLE = 'table';
@@ -0,0 +1,51 @@
<?php
namespace Appwrite\Utopia\Response\Filters;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Filter;
// Convert 1.9 Data format to 1.8 format
class V21 extends Filter
{
public function parse(array $content, string $model): array
{
$parsedResponse = $content;
return match ($model) {
Response::MODEL_SITE => $this->parseSite($content),
Response::MODEL_SITE_LIST => $this->handleList(
$content,
"sites",
fn ($item) => $this->parseSite($item),
),
Response::MODEL_FUNCTION => $this->parseFunction($content),
Response::MODEL_FUNCTION_LIST => $this->handleList(
$content,
"functions",
fn ($item) => $this->parseFunction($item),
),
default => $parsedResponse,
};
}
protected function parseSite(array $content): array
{
$content = $this->parseSpecs($content);
return $content;
}
protected function parseFunction(array $content): array
{
$content = $this->parseSpecs($content);
return $content;
}
protected function parseSpecs(array $content): array
{
$content['specification'] = $content['buildSpecification'] ?? $content['specification'] ?? null;
unset($content['buildSpecification']);
unset($content['runtimeSpecification']);
return $content;
}
}
+14 -2
View File
@@ -65,6 +65,12 @@ class Func extends Model
'default' => '',
'example' => 'python-3.8',
])
->addRule('deploymentRetention', [
'type' => self::TYPE_INTEGER,
'description' => 'How many days to keep the non-active deployments before they will be automatically deleted.',
'default' => 0,
'example' => 7,
])
->addRule('deploymentId', [
'type' => self::TYPE_STRING,
'description' => 'Function\'s active deployment ID.',
@@ -176,9 +182,15 @@ class Func extends Model
'default' => false,
'example' => false,
])
->addRule('specification', [
->addRule('buildSpecification', [
'type' => self::TYPE_STRING,
'description' => 'Machine specification for builds and executions.',
'description' => 'Machine specification for deployment builds.',
'default' => APP_COMPUTE_SPECIFICATION_DEFAULT,
'example' => APP_COMPUTE_SPECIFICATION_DEFAULT,
])
->addRule('runtimeSpecification', [
'type' => self::TYPE_STRING,
'description' => 'Machine specification for executions.',
'default' => APP_COMPUTE_SPECIFICATION_DEFAULT,
'example' => APP_COMPUTE_SPECIFICATION_DEFAULT,
])
+20 -2
View File
@@ -58,6 +58,12 @@ class Site extends Model
'default' => '',
'example' => 'react',
])
->addRule('deploymentRetention', [
'type' => self::TYPE_INTEGER,
'description' => 'How many days to keep the non-active deployments before they will be automatically deleted.',
'default' => 0,
'example' => 7,
])
->addRule('deploymentId', [
'type' => self::TYPE_STRING,
'description' => 'Site\'s active deployment ID.',
@@ -125,6 +131,12 @@ class Site extends Model
'default' => '',
'example' => 'npm run build',
])
->addRule('startCommand', [
'type' => self::TYPE_STRING,
'description' => 'Custom command to use when starting site runtime.',
'default' => '',
'example' => 'node custom-server.mjs',
])
->addRule('outputDirectory', [
'type' => self::TYPE_STRING,
'description' => 'The directory where the site build output is located.',
@@ -161,9 +173,15 @@ class Site extends Model
'default' => false,
'example' => false,
])
->addRule('specification', [
->addRule('buildSpecification', [
'type' => self::TYPE_STRING,
'description' => 'Machine specification for builds and executions.',
'description' => 'Machine specification for deployment builds.',
'default' => APP_COMPUTE_SPECIFICATION_DEFAULT,
'example' => APP_COMPUTE_SPECIFICATION_DEFAULT,
])
->addRule('runtimeSpecification', [
'type' => self::TYPE_STRING,
'description' => 'Machine specification for SSR executions.',
'default' => APP_COMPUTE_SPECIFICATION_DEFAULT,
'example' => APP_COMPUTE_SPECIFICATION_DEFAULT,
])
@@ -267,81 +267,81 @@ class UsageProject extends Model
'default' => 0,
'example' => 0,
])
// VectorDB aggregates
->addRule('vectordbDatabasesTotal', [
// VectorsDB aggregates
->addRule('vectorsdbDatabasesTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated number of VectorDB databases.',
'description' => 'Total aggregated number of VectorsDB databases.',
'default' => 0,
'example' => 0,
])
->addRule('vectordbCollectionsTotal', [
->addRule('vectorsdbCollectionsTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated number of VectorDB collections.',
'description' => 'Total aggregated number of VectorsDB collections.',
'default' => 0,
'example' => 0,
])
->addRule('vectordbDocumentsTotal', [
->addRule('vectorsdbDocumentsTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated number of VectorDB documents.',
'description' => 'Total aggregated number of VectorsDB documents.',
'default' => 0,
'example' => 0,
])
->addRule('vectordbDatabasesStorageTotal', [
->addRule('vectorsdbDatabasesStorageTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated VectorDB storage (bytes).',
'description' => 'Total aggregated VectorsDB storage (bytes).',
'default' => 0,
'example' => 0,
])
->addRule('vectordbDatabasesReadsTotal', [
->addRule('vectorsdbDatabasesReadsTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated number of VectorDB reads.',
'description' => 'Total aggregated number of VectorsDB reads.',
'default' => 0,
'example' => 0,
])
->addRule('vectordbDatabasesWritesTotal', [
->addRule('vectorsdbDatabasesWritesTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated number of VectorDB writes.',
'description' => 'Total aggregated number of VectorsDB writes.',
'default' => 0,
'example' => 0,
])
->addRule('vectordbDatabases', [
->addRule('vectorsdbDatabases', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated VectorDB databases per period.',
'description' => 'Aggregated VectorsDB databases per period.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('vectordbCollections', [
->addRule('vectorsdbCollections', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated VectorDB collections per period.',
'description' => 'Aggregated VectorsDB collections per period.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('vectordbDocuments', [
->addRule('vectorsdbDocuments', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated VectorDB documents per period.',
'description' => 'Aggregated VectorsDB documents per period.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('vectordbDatabasesStorage', [
->addRule('vectorsdbDatabasesStorage', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated VectorDB storage per period.',
'description' => 'Aggregated VectorsDB storage per period.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('vectordbDatabasesReads', [
->addRule('vectorsdbDatabasesReads', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated VectorDB reads per period.',
'description' => 'Aggregated VectorsDB reads per period.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('vectordbDatabasesWrites', [
->addRule('vectorsdbDatabasesWrites', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated VectorDB writes per period.',
'description' => 'Aggregated VectorsDB writes per period.',
'default' => [],
'example' => [],
'array' => true
@@ -5,7 +5,7 @@ namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class UsageVectorDB extends Model
class UsageVectorsDB extends Model
{
public function __construct()
{
@@ -86,11 +86,11 @@ class UsageVectorDB extends Model
public function getName(): string
{
return 'UsageVectorDB';
return 'UsageVectorsDB';
}
public function getType(): string
{
return Response::MODEL_USAGE_VECTORDB;
return Response::MODEL_USAGE_VECTORSDB;
}
}
@@ -5,7 +5,7 @@ namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class UsageVectorDBs extends Model
class UsageVectorsDBs extends Model
{
public function __construct()
{
@@ -18,7 +18,7 @@ class UsageVectorDBs extends Model
])
->addRule('databasesTotal', [
'type' => self::TYPE_INTEGER,
'description' => 'Total aggregated number of VectorDB databases.',
'description' => 'Total aggregated number of VectorsDB databases.',
'default' => 0,
'example' => 0,
])
@@ -99,11 +99,11 @@ class UsageVectorDBs extends Model
public function getName(): string
{
return 'UsageVectorDBs';
return 'UsageVectorsDBs';
}
public function getType(): string
{
return Response::MODEL_USAGE_VECTORDBS;
return Response::MODEL_USAGE_VECTORSDBS;
}
}
@@ -4,7 +4,7 @@ namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
class VectorDBCollection extends Collection
class VectorsDBCollection extends Collection
{
public function __construct()
{
@@ -31,11 +31,11 @@ class VectorDBCollection extends Collection
public function getName(): string
{
return 'VectorDB Collection';
return 'VectorsDB Collection';
}
public function getType(): string
{
return Response::MODEL_VECTORDB_COLLECTION;
return Response::MODEL_VECTORSDB_COLLECTION;
}
}
+17 -16
View File
@@ -1150,7 +1150,7 @@ class UsageTest extends Scope
}
#[Depends('testDocumentsDBStats')]
public function testPrepareVectorDBStats(array $data): array
public function testPrepareVectorsDBStats(array $data): array
{
$documentsTotal = 0;
$collectionsTotal = 0;
@@ -1159,11 +1159,11 @@ class UsageTest extends Scope
$requestsTotal = $data['requestsTotal'];
for ($i = 0; $i < self::CREATE; $i++) {
$name = uniqid() . ' vectordb';
$name = uniqid() . ' vectorsdb';
$response = $this->client->call(
Client::METHOD_POST,
'/vectordb',
'/vectorsdb',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
@@ -1185,7 +1185,7 @@ class UsageTest extends Scope
if ($i < (self::CREATE / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/vectordb/' . $vectordbId,
'/vectorsdb/' . $vectordbId,
array_merge([
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()),
@@ -1203,7 +1203,7 @@ class UsageTest extends Scope
$response = $this->client->call(
Client::METHOD_POST,
'/vectordb/' . $vectordbId . '/collections',
'/vectorsdb/' . $vectordbId . '/collections',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
@@ -1233,7 +1233,7 @@ class UsageTest extends Scope
if ($i < (self::CREATE / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/vectordb/' . $vectordbId . '/collections/' . $collectionId,
'/vectorsdb/' . $vectordbId . '/collections/' . $collectionId,
array_merge([
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()),
@@ -1249,7 +1249,7 @@ class UsageTest extends Scope
for ($i = 0; $i < self::CREATE; $i++) {
$response = $this->client->call(
Client::METHOD_POST,
'/vectordb/' . $vectordbId . '/collections/' . $collectionId . '/documents',
'/vectorsdb/' . $vectordbId . '/collections/' . $collectionId . '/documents',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id']
@@ -1276,7 +1276,7 @@ class UsageTest extends Scope
if ($i < (self::CREATE / 2)) {
$response = $this->client->call(
Client::METHOD_DELETE,
'/vectordb/' . $vectordbId . '/collections/' . $collectionId . '/documents/' . $documentId,
'/vectorsdb/' . $vectordbId . '/collections/' . $collectionId . '/documents/' . $documentId,
array_merge([
'x-appwrite-project' => $this->getProject()['$id']
], $this->getHeaders()),
@@ -1300,9 +1300,9 @@ class UsageTest extends Scope
]);
}
#[Depends('testPrepareVectorDBStats')]
#[Depends('testPrepareVectorsDBStats')]
#[Retry(count: 1)]
public function testVectorDBStats(array $data): array
public function testVectorsDBStats(array $data): array
{
$vectordbId = $data['vectordbId'];
$collectionId = $data['vectordbCollectionId'];
@@ -1329,7 +1329,7 @@ class UsageTest extends Scope
$this->assertCount(1, $response['body']['network']);
$this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']);
$this->validateDates($response['body']['requests']);
// vectordbTotal should reflect only VectorDB instances, not relational databases.
// vectordbTotal should reflect only VectorsDB instances, not relational databases.
$this->assertEquals($vectordbTotal, $response['body']['vectordbDatabasesTotal']);
$this->assertEquals($documentsTotal, $response['body']['vectordbDocumentsTotal']);
});
@@ -1346,7 +1346,7 @@ class UsageTest extends Scope
$this->assertEventually(function () use ($vectordbId, $collectionsTotal, $documentsTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/vectordb/' . $vectordbId . '/usage?range=30d',
'/vectorsdb/' . $vectordbId . '/usage?range=30d',
$this->getConsoleHeaders()
);
@@ -1360,7 +1360,7 @@ class UsageTest extends Scope
$this->assertEventually(function () use ($vectordbId, $collectionId, $documentsTotal) {
$response = $this->client->call(
Client::METHOD_GET,
'/vectordb/' . $vectordbId . '/collections/' . $collectionId . '/usage?range=30d',
'/vectorsdb/' . $vectordbId . '/collections/' . $collectionId . '/usage?range=30d',
$this->getConsoleHeaders()
);
@@ -1371,7 +1371,7 @@ class UsageTest extends Scope
return $data;
}
#[Depends('testVectorDBStats')]
#[Depends('testVectorsDBStats')]
public function testPrepareFunctionsStats(array $data): array
{
$executionTime = 0;
@@ -1401,7 +1401,8 @@ class UsageTest extends Scope
],
'schedule' => '0 0 1 1 *',
'timeout' => 10,
'specification' => Specification::S_8VCPU_8GB
'buildSpecification' => Specification::S_8VCPU_8GB,
'runtimeSpecification' => Specification::S_4VCPU_4GB,
]
);
@@ -1857,7 +1858,7 @@ class UsageTest extends Scope
for ($i = 0; $i < 3; $i++) {
$response = $this->client->call(
Client::METHOD_POST,
'/vectordb/embeddings/text',
'/vectorsdb/embeddings/text',
array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -3,19 +3,19 @@
namespace Tests\E2E\Scopes;
/**
* API configuration trait for VectorDB database API.
* Uses: /vectordb, collections, documents, indexes
* API configuration trait for VectorsDB database API.
* Uses: /vectorsdb, collections, documents, indexes
*/
trait ApiVectorDB
trait ApiVectorsDB
{
protected function getApiBasePath(): string
{
return '/vectordb';
return '/vectorsdb';
}
protected function getDatabaseType(): string
{
return 'vectordb';
return 'vectorsdb';
}
protected function getContainerResource(): string
@@ -1,19 +1,19 @@
<?php
namespace Tests\E2E\Services\Databases\VectorDB;
namespace Tests\E2E\Services\Databases\VectorsDB;
use PHPUnit\Framework\Attributes\DataProvider;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\SideClient;
use Tests\E2E\Services\Databases\VectorDB\Permissions\DatabasesPermissionsScope;
use Tests\E2E\Services\Databases\VectorsDB\Permissions\DatabasesPermissionsScope;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Database\Validator\Authorization;
class VectorDBPermissionsGuestTest extends Scope
class VectorsDBPermissionsGuestTest extends Scope
{
use ProjectCustom;
use SideClient;
@@ -34,7 +34,7 @@ class VectorDBPermissionsGuestTest extends Scope
public function createCollection(): array
{
$database = $this->client->call(Client::METHOD_POST, '/vectordb', array_merge([
$database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -46,7 +46,7 @@ class VectorDBPermissionsGuestTest extends Scope
$this->assertEquals('VectorGuestDB', $database['body']['name']);
$databaseId = $database['body']['$id'];
$publicMovies = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', $this->getServerHeader(), [
$publicMovies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::unique(),
'name' => 'Movies',
'dimension' => 3,
@@ -57,7 +57,7 @@ class VectorDBPermissionsGuestTest extends Scope
Permission::delete(Role::any()),
],
]);
$privateMovies = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', $this->getServerHeader(), [
$privateMovies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::unique(),
'name' => 'Movies',
'dimension' => 3,
@@ -95,7 +95,7 @@ class VectorDBPermissionsGuestTest extends Scope
$privateCollectionId = $data['privateCollectionId'];
$databaseId = $data['databaseId'];
$publicResponse = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', $this->getServerHeader(), [
$publicResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [1.0, 0.0, 0.0],
@@ -103,7 +103,7 @@ class VectorDBPermissionsGuestTest extends Scope
],
'permissions' => $permissions,
]);
$privateResponse = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [
$privateResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [0.0, 1.0, 0.0],
@@ -118,11 +118,11 @@ class VectorDBPermissionsGuestTest extends Scope
$roles = $this->getAuthorization()->getRoles();
$this->getAuthorization()->cleanRoles();
$publicDocuments = $this->client->call(Client::METHOD_GET, '/vectordb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', [
$publicDocuments = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
]);
$privateDocuments = $this->client->call(Client::METHOD_GET, '/vectordb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', [
$privateDocuments = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
]);
@@ -152,7 +152,7 @@ class VectorDBPermissionsGuestTest extends Scope
$roles = $this->getAuthorization()->getRoles();
$this->getAuthorization()->cleanRoles();
$publicResponse = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', [
$publicResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -166,7 +166,7 @@ class VectorDBPermissionsGuestTest extends Scope
$publicDocumentId = $publicResponse['body']['$id'];
$this->assertEquals(201, $publicResponse['headers']['status-code']);
$privateResponse = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', [
$privateResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -180,7 +180,7 @@ class VectorDBPermissionsGuestTest extends Scope
$this->assertEquals(401, $privateResponse['headers']['status-code']);
// Create a document in private collection with API key so we can test that update and delete are also not allowed
$privateResponse = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [
$privateResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [0.0, 0.0, 1.0],
@@ -191,7 +191,7 @@ class VectorDBPermissionsGuestTest extends Scope
$this->assertEquals(201, $privateResponse['headers']['status-code']);
$privateDocumentId = $privateResponse['body']['$id'];
$publicDocument = $this->client->call(Client::METHOD_PUT, '/vectordb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents/' . $publicDocumentId, [
$publicDocument = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents/' . $publicDocumentId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -204,7 +204,7 @@ class VectorDBPermissionsGuestTest extends Scope
$this->assertEquals(200, $publicDocument['headers']['status-code']);
$this->assertEquals('Thor: Ragnarok', $publicDocument['body']['metadata']['title']);
$privateDocument = $this->client->call(Client::METHOD_PUT, '/vectordb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents/' . $privateDocumentId, [
$privateDocument = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents/' . $privateDocumentId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -216,14 +216,14 @@ class VectorDBPermissionsGuestTest extends Scope
$this->assertEquals(401, $privateDocument['headers']['status-code']);
$publicDocument = $this->client->call(Client::METHOD_DELETE, '/vectordb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents/' . $publicDocumentId, [
$publicDocument = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents/' . $publicDocumentId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
]);
$this->assertEquals(204, $publicDocument['headers']['status-code']);
$privateDocument = $this->client->call(Client::METHOD_DELETE, '/vectordb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents/' . $privateDocumentId, [
$privateDocument = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents/' . $privateDocumentId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
]);
@@ -237,7 +237,7 @@ class VectorDBPermissionsGuestTest extends Scope
public function testWriteDocumentWithPermissions()
{
$database = $this->client->call(Client::METHOD_POST, '/vectordb', array_merge([
$database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -249,7 +249,7 @@ class VectorDBPermissionsGuestTest extends Scope
$this->assertEquals('VectorGuestPermsWrite', $database['body']['name']);
$databaseId = $database['body']['$id'];
$movies = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', $this->getServerHeader(), [
$movies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::unique(),
'name' => 'Movies',
'dimension' => 3,
@@ -261,7 +261,7 @@ class VectorDBPermissionsGuestTest extends Scope
$moviesId = $movies['body']['$id'];
$document = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $moviesId . '/documents', [
$document = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $moviesId . '/documents', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -1,6 +1,6 @@
<?php
namespace Tests\E2E\Services\Databases\VectorDB;
namespace Tests\E2E\Services\Databases\VectorsDB;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Depends;
@@ -8,12 +8,12 @@ use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\SideClient;
use Tests\E2E\Services\Databases\VectorDB\Permissions\DatabasesPermissionsScope;
use Tests\E2E\Services\Databases\VectorsDB\Permissions\DatabasesPermissionsScope;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
class VectorDBPermissionsMemberTest extends Scope
class VectorsDBPermissionsMemberTest extends Scope
{
use ProjectCustom;
use SideClient;
@@ -59,7 +59,7 @@ class VectorDBPermissionsMemberTest extends Scope
{
$this->createUsers();
$db = $this->client->call(Client::METHOD_POST, '/vectordb', $this->getServerHeader(), [
$db = $this->client->call(Client::METHOD_POST, '/vectorsdb', $this->getServerHeader(), [
'databaseId' => ID::unique(),
'name' => 'Test Database',
]);
@@ -67,7 +67,7 @@ class VectorDBPermissionsMemberTest extends Scope
$databaseId = $db['body']['$id'];
$public = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', $this->getServerHeader(), [
$public = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::unique(),
'name' => 'Movies',
'dimension' => 3,
@@ -82,7 +82,7 @@ class VectorDBPermissionsMemberTest extends Scope
$this->assertEquals(201, $public['headers']['status-code']);
$this->collections = ['public' => $public['body']['$id']];
$private = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', $this->getServerHeader(), [
$private = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::unique(),
'name' => 'Private Movies',
'dimension' => 3,
@@ -97,7 +97,7 @@ class VectorDBPermissionsMemberTest extends Scope
$this->assertEquals(201, $private['headers']['status-code']);
$this->collections['private'] = $private['body']['$id'];
$doconly = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', $this->getServerHeader(), [
$doconly = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::unique(),
'name' => 'Document Only Movies',
'dimension' => 3,
@@ -125,7 +125,7 @@ class VectorDBPermissionsMemberTest extends Scope
$collections = $data['collections'];
$databaseId = $data['databaseId'];
$response = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $collections['public'] . '/documents', $this->getServerHeader(), [
$response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $collections['public'] . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [1.0, 0.0, 0.0],
@@ -135,7 +135,7 @@ class VectorDBPermissionsMemberTest extends Scope
]);
$this->assertEquals(201, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $collections['private'] . '/documents', $this->getServerHeader(), [
$response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $collections['private'] . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [0.0, 1.0, 0.0],
@@ -145,7 +145,7 @@ class VectorDBPermissionsMemberTest extends Scope
]);
$this->assertEquals(201, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections/' . $collections['doconly'] . '/documents', $this->getServerHeader(), [
$response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $collections['doconly'] . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [0.0, 0.0, 1.0],
@@ -158,7 +158,7 @@ class VectorDBPermissionsMemberTest extends Scope
/**
* Check "any" permission collection
*/
$documents = $this->client->call(Client::METHOD_GET, '/vectordb/' . $databaseId . '/collections/' . $collections['public'] . '/documents', [
$documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $collections['public'] . '/documents', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -171,7 +171,7 @@ class VectorDBPermissionsMemberTest extends Scope
/**
* Check "users" permission collection
*/
$documents = $this->client->call(Client::METHOD_GET, '/vectordb/' . $databaseId . '/collections/' . $collections['private'] . '/documents', [
$documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $collections['private'] . '/documents', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -184,7 +184,7 @@ class VectorDBPermissionsMemberTest extends Scope
/**
* Check "user:user1" document only permission collection
*/
$documents = $this->client->call(Client::METHOD_GET, '/vectordb/' . $databaseId . '/collections/' . $collections['doconly'] . '/documents', [
$documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $collections['doconly'] . '/documents', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -1,6 +1,6 @@
<?php
namespace Tests\E2E\Services\Databases\VectorDB;
namespace Tests\E2E\Services\Databases\VectorsDB;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Depends;
@@ -8,12 +8,12 @@ use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\SideClient;
use Tests\E2E\Services\Databases\VectorDB\Permissions\DatabasesPermissionsScope;
use Tests\E2E\Services\Databases\VectorsDB\Permissions\DatabasesPermissionsScope;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
class VectorDBPermissionsTeamTest extends Scope
class VectorsDBPermissionsTeamTest extends Scope
{
use ProjectCustom;
use SideClient;
@@ -41,13 +41,13 @@ class VectorDBPermissionsTeamTest extends Scope
public function createCollections($teams)
{
$db = $this->client->call(Client::METHOD_POST, '/vectordb', $this->getServerHeader(), [
$db = $this->client->call(Client::METHOD_POST, '/vectorsdb', $this->getServerHeader(), [
'databaseId' => $this->databaseId,
'name' => 'Test Database',
]);
$this->assertEquals(201, $db['headers']['status-code']);
$collection1 = $this->client->call(Client::METHOD_POST, '/vectordb/' . $this->databaseId . '/collections', $this->getServerHeader(), [
$collection1 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::custom('collection1'),
'name' => 'Collection 1',
'dimension' => 3,
@@ -61,7 +61,7 @@ class VectorDBPermissionsTeamTest extends Scope
$this->collections['collection1'] = $collection1['body']['$id'];
$collection2 = $this->client->call(Client::METHOD_POST, '/vectordb/' . $this->databaseId . '/collections', $this->getServerHeader(), [
$collection2 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections', $this->getServerHeader(), [
'collectionId' => ID::custom('collection2'),
'name' => 'Collection 2',
'dimension' => 3,
@@ -131,7 +131,7 @@ class VectorDBPermissionsTeamTest extends Scope
$this->createCollections($this->teams);
$response = $this->client->call(Client::METHOD_POST, '/vectordb/' . $this->databaseId . '/collections/' . $this->collections['collection1'] . '/documents', $this->getServerHeader(), [
$response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections/' . $this->collections['collection1'] . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [1.0, 0.0, 0.0],
@@ -140,7 +140,7 @@ class VectorDBPermissionsTeamTest extends Scope
]);
$this->assertEquals(201, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_POST, '/vectordb/' . $this->databaseId . '/collections/' . $this->collections['collection2'] . '/documents', $this->getServerHeader(), [
$response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections/' . $this->collections['collection2'] . '/documents', $this->getServerHeader(), [
'documentId' => ID::unique(),
'data' => [
'embeddings' => [0.0, 1.0, 0.0],
@@ -159,7 +159,7 @@ class VectorDBPermissionsTeamTest extends Scope
#[DataProvider('readDocumentsProvider')]
public function testReadDocuments($user, $collection, $success, $users)
{
$documents = $this->client->call(Client::METHOD_GET, '/vectordb/' . $this->databaseId . '/collections/' . $collection . '/documents', [
$documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $this->databaseId . '/collections/' . $collection . '/documents', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -177,7 +177,7 @@ class VectorDBPermissionsTeamTest extends Scope
#[DataProvider('writeDocumentsProvider')]
public function testWriteDocuments($user, $collection, $success, $users)
{
$documents = $this->client->call(Client::METHOD_POST, '/vectordb/' . $this->databaseId . '/collections/' . $collection . '/documents', [
$documents = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections/' . $collection . '/documents', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -10,7 +10,7 @@ use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
class VectorDBACIDTest extends Scope
class VectorsDBACIDTest extends Scope
{
use ProjectCustom;
use SideClient;
@@ -28,7 +28,7 @@ class VectorDBACIDTest extends Scope
public function testAtomicity(): void
{
// Create database
$database = $this->client->call(Client::METHOD_POST, '/vectordb', array_merge([
$database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -41,7 +41,7 @@ class VectorDBACIDTest extends Scope
$databaseId = $database['body']['$id'];
// Create collection for the test
$collection = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', array_merge([
$collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -61,7 +61,7 @@ class VectorDBACIDTest extends Scope
// Create a document outside the transaction
$existingDocumentId = 'existing_doc';
$doc1 = $this->client->call(Client::METHOD_POST, "/vectordb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
$doc1 = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
@@ -75,7 +75,7 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(201, $doc1['headers']['status-code']);
// Create transaction
$transaction = $this->client->call(Client::METHOD_POST, '/vectordb/transactions', array_merge([
$transaction = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -86,7 +86,7 @@ class VectorDBACIDTest extends Scope
$transactionId = $transaction['body']['$id'];
// Add operations - second create reuses an existing documentId and should cause the commit to fail
$response = $this->client->call(Client::METHOD_POST, "/vectordb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
$response = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -114,7 +114,7 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(200, $response['headers']['status-code'], 'Adding documents via normal route should succeed. Response: ' . json_encode($response['body']));
// Attempt to commit - should fail due to duplicate document ID
$response = $this->client->call(Client::METHOD_PATCH, "/vectordb/transactions/{$transactionId}", array_merge([
$response = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId}", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -125,7 +125,7 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(409, $response['headers']['status-code']);
// Verify NO new documents were created (atomicity)
$documents = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
$documents = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
@@ -140,7 +140,7 @@ class VectorDBACIDTest extends Scope
public function testConsistency(): void
{
// Create database
$database = $this->client->call(Client::METHOD_POST, '/vectordb', array_merge([
$database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -153,7 +153,7 @@ class VectorDBACIDTest extends Scope
$databaseId = $database['body']['$id'];
// Create collection
$collection = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', array_merge([
$collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -172,7 +172,7 @@ class VectorDBACIDTest extends Scope
$collectionId = $collection['body']['$id'];
// Create transaction
$transaction = $this->client->call(Client::METHOD_POST, '/vectordb/transactions', array_merge([
$transaction = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -181,7 +181,7 @@ class VectorDBACIDTest extends Scope
$transactionId = $transaction['body']['$id'];
// Stage operations with valid and invalid data (embedding length mismatch)
$response = $this->client->call(Client::METHOD_POST, "/vectordb/transactions/{$transactionId}/operations", array_merge([
$response = $this->client->call(Client::METHOD_POST, "/vectorsdb/transactions/{$transactionId}/operations", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -223,7 +223,7 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(201, $response['headers']['status-code']);
// Attempt to commit - should fail due to invalid embeddings
$response = $this->client->call(Client::METHOD_PATCH, "/vectordb/transactions/{$transactionId}", array_merge([
$response = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId}", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -234,7 +234,7 @@ class VectorDBACIDTest extends Scope
$this->assertContains($response['headers']['status-code'], [400, 409, 500], 'Transaction commit should fail due to validation. Response: ' . json_encode($response['body']));
// Verify no documents were created
$documents = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
$documents = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
@@ -248,7 +248,7 @@ class VectorDBACIDTest extends Scope
public function testIsolation(): void
{
// Create database
$database = $this->client->call(Client::METHOD_POST, '/vectordb', array_merge([
$database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -261,7 +261,7 @@ class VectorDBACIDTest extends Scope
$databaseId = $database['body']['$id'];
// Create collection
$collection = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', array_merge([
$collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -280,7 +280,7 @@ class VectorDBACIDTest extends Scope
$collectionId = $collection['body']['$id'];
// Create initial document with status metadata
$doc = $this->client->call(Client::METHOD_POST, "/vectordb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
$doc = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
@@ -294,7 +294,7 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(201, $doc['headers']['status-code']);
// Create first transaction
$transaction1 = $this->client->call(Client::METHOD_POST, '/vectordb/transactions', array_merge([
$transaction1 = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -305,7 +305,7 @@ class VectorDBACIDTest extends Scope
$transactionId1 = $transaction1['body']['$id'];
// Transaction 1: update status to approved
$this->client->call(Client::METHOD_POST, "/vectordb/transactions/{$transactionId1}/operations", array_merge([
$this->client->call(Client::METHOD_POST, "/vectorsdb/transactions/{$transactionId1}/operations", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -324,7 +324,7 @@ class VectorDBACIDTest extends Scope
]);
// Commit first transaction
$response1 = $this->client->call(Client::METHOD_PATCH, "/vectordb/transactions/{$transactionId1}", array_merge([
$response1 = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId1}", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -334,14 +334,14 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(200, $response1['headers']['status-code']);
// Document should reflect the first transaction's update
$document = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents/shared_doc", array_merge([
$document = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/shared_doc", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals('approved', $document['body']['metadata']['status']);
// Create second transaction after first commit
$transaction2 = $this->client->call(Client::METHOD_POST, '/vectordb/transactions', array_merge([
$transaction2 = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -352,7 +352,7 @@ class VectorDBACIDTest extends Scope
$transactionId2 = $transaction2['body']['$id'];
// Transaction 2: update status to declined
$this->client->call(Client::METHOD_POST, "/vectordb/transactions/{$transactionId2}/operations", array_merge([
$this->client->call(Client::METHOD_POST, "/vectorsdb/transactions/{$transactionId2}/operations", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -371,7 +371,7 @@ class VectorDBACIDTest extends Scope
]);
// Commit second transaction and ensure isolation guarantees
$response2 = $this->client->call(Client::METHOD_PATCH, "/vectordb/transactions/{$transactionId2}", array_merge([
$response2 = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId2}", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -382,7 +382,7 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(200, $response2['headers']['status-code']);
// Final document should reflect the second transaction's update
$document = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents/shared_doc", array_merge([
$document = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/shared_doc", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
@@ -396,7 +396,7 @@ class VectorDBACIDTest extends Scope
public function testDurability(): void
{
// Create database
$database = $this->client->call(Client::METHOD_POST, '/vectordb', array_merge([
$database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -409,7 +409,7 @@ class VectorDBACIDTest extends Scope
$databaseId = $database['body']['$id'];
// Create collection
$collection = $this->client->call(Client::METHOD_POST, '/vectordb/' . $databaseId . '/collections', array_merge([
$collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -430,7 +430,7 @@ class VectorDBACIDTest extends Scope
$collectionId = $collection['body']['$id'];
// Create transaction with multiple operations
$transaction = $this->client->call(Client::METHOD_POST, '/vectordb/transactions', array_merge([
$transaction = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -441,7 +441,7 @@ class VectorDBACIDTest extends Scope
$transactionId = $transaction['body']['$id'];
// Create two documents via normal route inside transaction
$this->client->call(Client::METHOD_POST, "/vectordb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
$this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -462,7 +462,7 @@ class VectorDBACIDTest extends Scope
]);
// Update first document inside the same transaction
$this->client->call(Client::METHOD_PATCH, "/vectordb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
$this->client->call(Client::METHOD_PATCH, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -474,7 +474,7 @@ class VectorDBACIDTest extends Scope
]);
// Commit transaction
$response = $this->client->call(Client::METHOD_PATCH, "/vectordb/transactions/{$transactionId}", array_merge([
$response = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId}", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -486,14 +486,14 @@ class VectorDBACIDTest extends Scope
$this->assertEquals('committed', $response['body']['status']);
// Verify documents exist and have correct data
$document1 = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
$document1 = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals(200, $document1['headers']['status-code']);
$this->assertEquals('Updated important data 1', $document1['body']['metadata']['data']);
$document2 = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_2", array_merge([
$document2 = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_2", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
@@ -501,7 +501,7 @@ class VectorDBACIDTest extends Scope
$this->assertEquals('Important data 2', $document2['body']['metadata']['data']);
// Further update outside transaction to ensure persistence
$update = $this->client->call(Client::METHOD_PATCH, "/vectordb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
$update = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
@@ -512,14 +512,14 @@ class VectorDBACIDTest extends Scope
$this->assertEquals(200, $update['headers']['status-code']);
// Verify the update persisted
$document1 = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
$document1 = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals('Modified outside transaction', $document1['body']['metadata']['data']);
// List all documents to verify total count
$documents = $this->client->call(Client::METHOD_GET, "/vectordb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
$documents = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
@@ -5,9 +5,9 @@ namespace Tests\E2E\Services\Databases\Transactions;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\SideConsole;
use Tests\E2E\Services\Databases\VectorDB\Transactions\TransactionsBase;
use Tests\E2E\Services\Databases\VectorsDB\Transactions\TransactionsBase;
class VectorDBTransactionsConsoleClientTest extends Scope
class VectorsDBTransactionsConsoleClientTest extends Scope
{
use TransactionsBase;
use ProjectCustom;
@@ -5,9 +5,9 @@ namespace Tests\E2E\Services\Databases\Transactions;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\SideClient;
use Tests\E2E\Services\Databases\VectorDB\Transactions\TransactionsBase;
use Tests\E2E\Services\Databases\VectorsDB\Transactions\TransactionsBase;
class VectorDBTransactionsCustomClientTest extends Scope
class VectorsDBTransactionsCustomClientTest extends Scope
{
use TransactionsBase;
use ProjectCustom;

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