From 6797986574fd0a17749cbd339a73fd7eca41c121 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 2 Jun 2026 17:31:58 +0400 Subject: [PATCH 01/24] Update default site build specification --- app/config/collections/projects.php | 2 +- app/init/constants.php | 1 + .../Platform/Modules/Compute/Base.php | 15 ++++++++----- .../Compute/Validator/Specification.php | 9 +++++--- .../Modules/Sites/Http/Sites/Create.php | 5 +++-- .../Modules/Sites/Http/Sites/Update.php | 5 +++-- .../Services/Sites/SitesCustomServerTest.php | 1 + .../Compute/Validator/SpecificationTest.php | 22 +++++++++++++++++++ 8 files changed, 47 insertions(+), 13 deletions(-) diff --git a/app/config/collections/projects.php b/app/config/collections/projects.php index 9ac5c562e3..95f78bcb12 100644 --- a/app/config/collections/projects.php +++ b/app/config/collections/projects.php @@ -1306,7 +1306,7 @@ return [ 'size' => 128, 'signed' => false, 'required' => false, - 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'default' => APP_SITES_BUILD_SPECIFICATION_DEFAULT, 'filters' => [], ], [ diff --git a/app/init/constants.php b/app/init/constants.php index d426e51fb6..545f3acafa 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -98,6 +98,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_SITES_BUILD_SPECIFICATION_DEFAULT = Specification::S_2VCPU_2GB; const APP_COMPUTE_DEPLOYMENT_MAX_RETENTION = 100 * 365; // 100 years const APP_SDK_PLATFORM_SERVER = 'server'; const APP_SDK_PLATFORM_CLIENT = 'client'; diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index b0efac3829..f7bc954bd7 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -33,29 +33,34 @@ class Base extends Action * @param array $plan The billing plan configuration * @return string The appropriate default specification */ - protected function getDefaultSpecification(array $plan): string + protected function getDefaultSpecification(array $plan, string $planKey = 'runtimeSpecifications', string $fallback = APP_COMPUTE_SPECIFICATION_DEFAULT, bool $preferFallback = false): string { $specifications = Config::getParam('specifications', []); if (empty($specifications)) { - return APP_COMPUTE_SPECIFICATION_DEFAULT; + return $fallback; } $specificationValidator = new SpecificationValidator( $plan, $specifications, System::getEnv('_APP_COMPUTE_CPUS', 0), - System::getEnv('_APP_COMPUTE_MEMORY', 0) + System::getEnv('_APP_COMPUTE_MEMORY', 0), + $planKey ); $allowedSpecifications = $specificationValidator->getAllowedSpecifications(); + if ($preferFallback && !array_key_exists($planKey, $plan) && \in_array($fallback, $allowedSpecifications)) { + return $fallback; + } + // If there is no plan use the highest specification if (empty($plan)) { - return end($allowedSpecifications) ?? APP_COMPUTE_SPECIFICATION_DEFAULT; + return end($allowedSpecifications) ?? $fallback; } // Otherwise, use the lowest specification available in the plan - return $allowedSpecifications[0] ?? APP_COMPUTE_SPECIFICATION_DEFAULT; + return $allowedSpecifications[0] ?? $fallback; } public function redeployVcsFunction(Request $request, Document $function, Document $project, Document $installation, Database $dbForProject, BuildPublisher $publisherForBuilds, Document $template, GitHub $github, bool $activate, array $platform = [], string $referenceType = 'branch', string $reference = ''): Document diff --git a/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php index 5c6cf9ce1f..5f1337c97f 100644 --- a/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php +++ b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php @@ -14,12 +14,15 @@ class Specification extends Validator private int $maxMemory; - public function __construct(array $plan, array $specifications, float $maxCpus, int $maxMemory) + private string $planKey; + + public function __construct(array $plan, array $specifications, float $maxCpus, int $maxMemory, string $planKey = 'runtimeSpecifications') { $this->plan = $plan; $this->specifications = $specifications; $this->maxCpus = $maxCpus; $this->maxMemory = $maxMemory; + $this->planKey = $planKey; } /** @@ -35,8 +38,8 @@ class Specification extends Validator foreach ($this->specifications as $size => $values) { if ((empty($this->maxCpus) || $values['cpus'] <= $this->maxCpus) && (empty($this->maxMemory) || $values['memory'] <= $this->maxMemory)) { - if (!empty($this->plan) && array_key_exists('runtimeSpecifications', $this->plan)) { - if (!\in_array($size, $this->plan['runtimeSpecifications'])) { + if (!empty($this->plan) && array_key_exists($this->planKey, $this->plan)) { + if (!\in_array($size, $this->plan[$this->planKey])) { continue; } } diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php index e167c88af2..3662bb4d35 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -82,11 +82,12 @@ class Create extends Base ->param('providerRootDirectory', '', new Text(128, 0), 'Path to site code in the linked repo.', true) ->param('providerBranches', [], new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches.', true) ->param('providerPaths', [], new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes.', true) - ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( + ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan, 'buildSpecifications', APP_SITES_BUILD_SPECIFICATION_DEFAULT, true), fn (array $plan) => new Specification( $plan, Config::getParam('specifications', []), System::getEnv('_APP_COMPUTE_CPUS', 0), - System::getEnv('_APP_COMPUTE_MEMORY', 0) + System::getEnv('_APP_COMPUTE_MEMORY', 0), + 'buildSpecifications' ), 'Build specification for the site deployments.', true, ['plan']) ->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( $plan, diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 6cb1905550..0a2f5cdd71 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -86,11 +86,12 @@ class Update extends Base ->param('providerRootDirectory', '', new Text(128, 0), 'Path to site code in the linked repo.', true) ->param('providerBranches', null, new Nullable(new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches.', true) ->param('providerPaths', null, new Nullable(new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes.', true) - ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( + ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan, 'buildSpecifications', APP_SITES_BUILD_SPECIFICATION_DEFAULT, true), fn (array $plan) => new Specification( $plan, Config::getParam('specifications', []), System::getEnv('_APP_COMPUTE_CPUS', 0), - System::getEnv('_APP_COMPUTE_MEMORY', 0) + System::getEnv('_APP_COMPUTE_MEMORY', 0), + 'buildSpecifications' ), 'Build specification for the site deployments.', true, ['plan']) ->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( $plan, diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 9cca689780..914390c354 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -100,6 +100,7 @@ class SitesCustomServerTest extends Scope $this->assertEquals(true, $dateValidator->isValid($site['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($site['body']['$updatedAt'])); $this->assertEquals('node-22', $site['body']['buildRuntime']); + $this->assertEquals(Specification::S_2VCPU_2GB, $site['body']['buildSpecification']); $this->assertEquals(null, $site['body']['fallbackFile']); $this->assertEquals('./', $site['body']['outputDirectory']); diff --git a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php index 0505494e17..7977212885 100644 --- a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php +++ b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php @@ -72,4 +72,26 @@ class SpecificationTest extends TestCase $this->assertContains(SpecificationConstants::S_05VCPU_512MB, $allowed); $this->assertContains(SpecificationConstants::S_1VCPU_512MB, $allowed); } + + public function testGetAllowedSpecificationsWithBuildPlanLimits(): void + { + $plan = [ + 'buildSpecifications' => [ + SpecificationConstants::S_1VCPU_1GB, + SpecificationConstants::S_2VCPU_2GB, + ] + ]; + $validator = new Specification( + plan: $plan, + specifications: $this->specifications, + maxCpus: 0, + maxMemory: 0, + planKey: 'buildSpecifications' + ); + + $allowed = $validator->getAllowedSpecifications(); + $this->assertCount(2, $allowed); + $this->assertContains(SpecificationConstants::S_1VCPU_1GB, $allowed); + $this->assertContains(SpecificationConstants::S_2VCPU_2GB, $allowed); + } } From aae23cf5a1a74084ccb34849b8ff7a2605112bb3 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 22 Jun 2026 18:35:02 +0400 Subject: [PATCH 02/24] Fix site build specification defaults --- src/Appwrite/Platform/Modules/Compute/Base.php | 4 ++-- src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php | 5 +++++ tests/e2e/Services/Sites/SitesCustomServerTest.php | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 5e1aba372c..8efa6d8843 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -56,11 +56,11 @@ class Base extends Action // If there is no plan use the highest specification if (empty($plan)) { - return end($allowedSpecifications) ?? $fallback; + return end($allowedSpecifications) ?: ''; } // Otherwise, use the lowest specification available in the plan - return $allowedSpecifications[0] ?? $fallback; + return $allowedSpecifications[0] ?? ''; } public function redeployVcsFunction(Request $request, Document $function, Document $project, Document $installation, Database $dbForProject, BuildPublisher $publisherForBuilds, Document $template, GitHub $github, bool $activate, array $platform = [], string $referenceType = 'branch', string $reference = ''): Document diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 474024fc76..1f6d7cd215 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -178,6 +178,11 @@ class Update extends Base $framework = $site->getAttribute('framework'); } + $missingParam = new \stdClass(); + if ($request->getPayload('buildSpecification', $missingParam) === $missingParam) { + $buildSpecification = $site->getAttribute('buildSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT); + } + $repositoryId = $site->getAttribute('repositoryId', ''); $repositoryInternalId = $site->getAttribute('repositoryInternalId', ''); diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index c2d69f8cc6..1eee0ecbc8 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -1680,6 +1680,7 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(200, $site['headers']['status-code']); $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals(Specification::S_2VCPU_2GB, $site['body']['buildSpecification']); $this->assertEquals(Specification::S_1VCPU_1GB, $site['body']['runtimeSpecification']); // Change the specs to 1vcpu 512mb @@ -1697,6 +1698,7 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(200, $site['headers']['status-code']); $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals(Specification::S_2VCPU_2GB, $site['body']['buildSpecification']); $this->assertEquals(Specification::S_1VCPU_512MB, $site['body']['runtimeSpecification']); /** From 419cd2e35638d1d2561343939d613d106a277cf6 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 22 Jun 2026 19:10:28 +0400 Subject: [PATCH 03/24] Expose build enabled specifications --- .../Modules/Functions/Http/Specifications/XList.php | 4 ++++ .../Platform/Modules/Sites/Http/Specifications/XList.php | 4 ++++ src/Appwrite/Utopia/Response/Model/Specification.php | 8 +++++++- .../e2e/Services/Functions/FunctionsCustomServerTest.php | 2 ++ tests/e2e/Services/Sites/SitesCustomServerTest.php | 2 ++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php index d76584534d..498a274280 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -58,10 +58,14 @@ class XList extends Base $specs = []; foreach ($allSpecs as $spec) { $spec['enabled'] = true; + $spec['buildEnabled'] = true; if (array_key_exists('runtimeSpecifications', $plan)) { $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); } + if (array_key_exists('buildSpecifications', $plan)) { + $spec['buildEnabled'] = in_array($spec['slug'], $plan['buildSpecifications']); + } $maxCpus = System::getEnv('_APP_COMPUTE_CPUS', 0); $maxMemory = System::getEnv('_APP_COMPUTE_MEMORY', 0); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php index 4bda37df73..d5b6515de7 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -58,10 +58,14 @@ class XList extends Base $specs = []; foreach ($allSpecs as $spec) { $spec['enabled'] = true; + $spec['buildEnabled'] = true; if (array_key_exists('runtimeSpecifications', $plan)) { $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); } + if (array_key_exists('buildSpecifications', $plan)) { + $spec['buildEnabled'] = in_array($spec['slug'], $plan['buildSpecifications']); + } $maxCpus = System::getEnv('_APP_COMPUTE_CPUS', 0); $maxMemory = System::getEnv('_APP_COMPUTE_MEMORY', 0); diff --git a/src/Appwrite/Utopia/Response/Model/Specification.php b/src/Appwrite/Utopia/Response/Model/Specification.php index 4fa7fb9bc7..034d399a75 100644 --- a/src/Appwrite/Utopia/Response/Model/Specification.php +++ b/src/Appwrite/Utopia/Response/Model/Specification.php @@ -24,7 +24,13 @@ class Specification extends Model ]); $this->addRule('enabled', [ 'type' => self::TYPE_BOOLEAN, - 'description' => 'Is size enabled.', + 'description' => 'Is size enabled for runtime.', + 'default' => false, + 'example' => true + ]); + $this->addRule('buildEnabled', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Is size enabled for builds.', 'default' => false, 'example' => true ]); diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 1aba466944..86aa67df32 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -208,10 +208,12 @@ final class FunctionsCustomServerTest extends Scope $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('memory', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][1]); + $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][1]); $function = $this->createFunction([ diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 1eee0ecbc8..8a326d1023 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -34,10 +34,12 @@ final class SitesCustomServerTest extends Scope $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('memory', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][1]); + $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][1]); $site = $this->createSite([ From 7f536750b4ea92799515cd3ae368a1baed06eba6 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 22 Jun 2026 19:18:53 +0400 Subject: [PATCH 04/24] Rename build specification availability field --- .../Platform/Modules/Functions/Http/Specifications/XList.php | 4 ++-- .../Platform/Modules/Sites/Http/Specifications/XList.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Specification.php | 2 +- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 4 ++-- tests/e2e/Services/Sites/SitesCustomServerTest.php | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php index 498a274280..53d52cccb5 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -58,13 +58,13 @@ class XList extends Base $specs = []; foreach ($allSpecs as $spec) { $spec['enabled'] = true; - $spec['buildEnabled'] = true; + $spec['enabledForBuilds'] = true; if (array_key_exists('runtimeSpecifications', $plan)) { $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); } if (array_key_exists('buildSpecifications', $plan)) { - $spec['buildEnabled'] = in_array($spec['slug'], $plan['buildSpecifications']); + $spec['enabledForBuilds'] = in_array($spec['slug'], $plan['buildSpecifications']); } $maxCpus = System::getEnv('_APP_COMPUTE_CPUS', 0); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php index d5b6515de7..86904e8f67 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -58,13 +58,13 @@ class XList extends Base $specs = []; foreach ($allSpecs as $spec) { $spec['enabled'] = true; - $spec['buildEnabled'] = true; + $spec['enabledForBuilds'] = true; if (array_key_exists('runtimeSpecifications', $plan)) { $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); } if (array_key_exists('buildSpecifications', $plan)) { - $spec['buildEnabled'] = in_array($spec['slug'], $plan['buildSpecifications']); + $spec['enabledForBuilds'] = in_array($spec['slug'], $plan['buildSpecifications']); } $maxCpus = System::getEnv('_APP_COMPUTE_CPUS', 0); diff --git a/src/Appwrite/Utopia/Response/Model/Specification.php b/src/Appwrite/Utopia/Response/Model/Specification.php index 034d399a75..74188a533a 100644 --- a/src/Appwrite/Utopia/Response/Model/Specification.php +++ b/src/Appwrite/Utopia/Response/Model/Specification.php @@ -28,7 +28,7 @@ class Specification extends Model 'default' => false, 'example' => true ]); - $this->addRule('buildEnabled', [ + $this->addRule('enabledForBuilds', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Is size enabled for builds.', 'default' => false, diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 86aa67df32..aba9ec2104 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -208,12 +208,12 @@ final class FunctionsCustomServerTest extends Scope $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); - $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('memory', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][1]); - $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][1]); + $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][1]); $function = $this->createFunction([ diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 8a326d1023..c5e27cd324 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -34,12 +34,12 @@ final class SitesCustomServerTest extends Scope $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); - $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('memory', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][1]); - $this->assertArrayHasKey('buildEnabled', $specifications['body']['specifications'][1]); + $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][1]); $site = $this->createSite([ From 23be75a87fd4679d83a0a35d5dd7bff5ac597f93 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 22 Jun 2026 19:51:26 +0400 Subject: [PATCH 05/24] Add specification type parameter --- .../Modules/Functions/Http/Specifications/XList.php | 13 ++++++------- .../Modules/Sites/Http/Specifications/XList.php | 13 ++++++------- .../Utopia/Response/Model/Specification.php | 8 +------- tests/e2e/Services/Functions/FunctionsBase.php | 4 ++-- .../Functions/FunctionsCustomServerTest.php | 12 +++++++----- tests/e2e/Services/Sites/SitesBase.php | 4 ++-- tests/e2e/Services/Sites/SitesCustomServerTest.php | 12 +++++++----- 7 files changed, 31 insertions(+), 35 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php index 53d52cccb5..8cbff906fa 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -12,6 +12,7 @@ use Utopia\Database\Document; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; +use Utopia\Validator\WhiteList; class XList extends Base { @@ -46,25 +47,23 @@ class XList extends Base ) ] )) + ->param('type', 'runtimes', new WhiteList(['runtimes', 'builds']), 'Specification type to list. Can be one of: runtimes, builds.', true) ->inject('response') ->inject('plan') ->callback($this->action(...)); } - public function action(Response $response, array $plan) + public function action(string $type, Response $response, array $plan) { $allSpecs = Config::getParam('specifications', []); + $planKey = $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'; $specs = []; foreach ($allSpecs as $spec) { $spec['enabled'] = true; - $spec['enabledForBuilds'] = true; - if (array_key_exists('runtimeSpecifications', $plan)) { - $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); - } - if (array_key_exists('buildSpecifications', $plan)) { - $spec['enabledForBuilds'] = in_array($spec['slug'], $plan['buildSpecifications']); + if (array_key_exists($planKey, $plan)) { + $spec['enabled'] = in_array($spec['slug'], $plan[$planKey]); } $maxCpus = System::getEnv('_APP_COMPUTE_CPUS', 0); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php index 86904e8f67..a4f865d859 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -12,6 +12,7 @@ use Utopia\Database\Document; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; +use Utopia\Validator\WhiteList; class XList extends Base { @@ -46,25 +47,23 @@ class XList extends Base ) ] )) + ->param('type', 'runtimes', new WhiteList(['runtimes', 'builds']), 'Specification type to list. Can be one of: runtimes, builds.', true) ->inject('response') ->inject('plan') ->callback($this->action(...)); } - public function action(Response $response, array $plan) + public function action(string $type, Response $response, array $plan) { $allSpecs = Config::getParam('specifications', []); + $planKey = $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'; $specs = []; foreach ($allSpecs as $spec) { $spec['enabled'] = true; - $spec['enabledForBuilds'] = true; - if (array_key_exists('runtimeSpecifications', $plan)) { - $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); - } - if (array_key_exists('buildSpecifications', $plan)) { - $spec['enabledForBuilds'] = in_array($spec['slug'], $plan['buildSpecifications']); + if (array_key_exists($planKey, $plan)) { + $spec['enabled'] = in_array($spec['slug'], $plan[$planKey]); } $maxCpus = System::getEnv('_APP_COMPUTE_CPUS', 0); diff --git a/src/Appwrite/Utopia/Response/Model/Specification.php b/src/Appwrite/Utopia/Response/Model/Specification.php index 74188a533a..4fa7fb9bc7 100644 --- a/src/Appwrite/Utopia/Response/Model/Specification.php +++ b/src/Appwrite/Utopia/Response/Model/Specification.php @@ -24,13 +24,7 @@ class Specification extends Model ]); $this->addRule('enabled', [ 'type' => self::TYPE_BOOLEAN, - 'description' => 'Is size enabled for runtime.', - 'default' => false, - 'example' => true - ]); - $this->addRule('enabledForBuilds', [ - 'type' => self::TYPE_BOOLEAN, - 'description' => 'Is size enabled for builds.', + 'description' => 'Is size enabled.', 'default' => false, 'example' => true ]); diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index 458359bbe9..05f2e52c1a 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -494,11 +494,11 @@ trait FunctionsBase return $deployment; } - protected function listSpecifications(): mixed + protected function listSpecifications(array $params = []): mixed { $specifications = $this->client->call(Client::METHOD_GET, '/functions/specifications', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), $params); return $specifications; } diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index aba9ec2104..80578d443b 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -208,28 +208,30 @@ final class FunctionsCustomServerTest extends Scope $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); - $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('memory', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][1]); - $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][1]); + $buildSpecifications = $this->listSpecifications(['type' => 'builds']); + $this->assertEquals(200, $buildSpecifications['headers']['status-code']); + $this->assertEquals($specifications['body']['total'], $buildSpecifications['body']['total']); + $function = $this->createFunction([ 'functionId' => ID::unique(), 'name' => 'Specs function', 'runtime' => 'node-22', - 'buildSpecification' => $specifications['body']['specifications'][0]['slug'], + 'buildSpecification' => $buildSpecifications['body']['specifications'][0]['slug'], 'runtimeSpecification' => $specifications['body']['specifications'][1]['slug'], ]); $this->assertEquals(201, $function['headers']['status-code']); - $this->assertEquals($specifications['body']['specifications'][0]['slug'], $function['body']['buildSpecification']); + $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $function['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $function['body']['runtimeSpecification']); $function = $this->getFunction($function['body']['$id']); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($specifications['body']['specifications'][0]['slug'], $function['body']['buildSpecification']); + $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $function['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $function['body']['runtimeSpecification']); $this->cleanupFunction($function['body']['$id']); diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 54344f649a..f6a29f82ab 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -489,11 +489,11 @@ trait SitesBase return $deployment; } - protected function listSpecifications(): mixed + protected function listSpecifications(array $params = []): mixed { $specifications = $this->client->call(Client::METHOD_GET, '/sites/specifications', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), $params); return $specifications; } diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index c5e27cd324..102f828441 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -34,29 +34,31 @@ final class SitesCustomServerTest extends Scope $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); - $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); $this->assertArrayHasKey('memory', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][1]); - $this->assertArrayHasKey('enabledForBuilds', $specifications['body']['specifications'][1]); $this->assertArrayHasKey('slug', $specifications['body']['specifications'][1]); + $buildSpecifications = $this->listSpecifications(['type' => 'builds']); + $this->assertEquals(200, $buildSpecifications['headers']['status-code']); + $this->assertEquals($specifications['body']['total'], $buildSpecifications['body']['total']); + $site = $this->createSite([ 'buildRuntime' => 'node-22', 'framework' => 'other', 'name' => 'Specs site', 'siteId' => ID::unique(), - 'buildSpecification' => $specifications['body']['specifications'][0]['slug'], + 'buildSpecification' => $buildSpecifications['body']['specifications'][0]['slug'], 'runtimeSpecification' => $specifications['body']['specifications'][1]['slug'], ]); $this->assertEquals(201, $site['headers']['status-code']); - $this->assertEquals($specifications['body']['specifications'][0]['slug'], $site['body']['buildSpecification']); + $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $site['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $site['body']['runtimeSpecification']); $site = $this->getSite($site['body']['$id']); $this->assertEquals(200, $site['headers']['status-code']); - $this->assertEquals($specifications['body']['specifications'][0]['slug'], $site['body']['buildSpecification']); + $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $site['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $site['body']['runtimeSpecification']); $this->cleanupSite($site['body']['$id']); From bd9855587628b4c53bf5efec57b4086227e00547 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 22 Jun 2026 22:06:56 +0400 Subject: [PATCH 06/24] Make specification tests explicit --- src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php | 5 ----- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 2 +- tests/e2e/Services/Sites/SitesCustomServerTest.php | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 1f6d7cd215..474024fc76 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -178,11 +178,6 @@ class Update extends Base $framework = $site->getAttribute('framework'); } - $missingParam = new \stdClass(); - if ($request->getPayload('buildSpecification', $missingParam) === $missingParam) { - $buildSpecification = $site->getAttribute('buildSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT); - } - $repositoryId = $site->getAttribute('repositoryId', ''); $repositoryInternalId = $site->getAttribute('repositoryInternalId', ''); diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 80578d443b..87635d55c3 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -200,7 +200,7 @@ final class FunctionsCustomServerTest extends Scope public function testListSpecs(): void { - $specifications = $this->listSpecifications(); + $specifications = $this->listSpecifications(['type' => 'runtimes']); $this->assertEquals(200, $specifications['headers']['status-code']); $this->assertGreaterThanOrEqual(2, $specifications['body']['total']); $this->assertArrayHasKey(0, $specifications['body']['specifications']); diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 102f828441..5b09b4b45c 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -26,7 +26,7 @@ final class SitesCustomServerTest extends Scope public function testListSpecs(): void { - $specifications = $this->listSpecifications(); + $specifications = $this->listSpecifications(['type' => 'runtimes']); $this->assertEquals(200, $specifications['headers']['status-code']); $this->assertGreaterThanOrEqual(2, $specifications['body']['total']); $this->assertArrayHasKey(0, $specifications['body']['specifications']); From a7fc66ef3e47dc1214973acfa6e2963dab39b647 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 22 Jun 2026 22:34:04 +0400 Subject: [PATCH 07/24] Use listed build specs in tests --- .../Functions/FunctionsCustomServerTest.php | 7 ++--- .../Services/Sites/SitesCustomServerTest.php | 27 ++++++++++++++----- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 87635d55c3..0e98be1d25 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -217,21 +217,22 @@ final class FunctionsCustomServerTest extends Scope $buildSpecifications = $this->listSpecifications(['type' => 'builds']); $this->assertEquals(200, $buildSpecifications['headers']['status-code']); $this->assertEquals($specifications['body']['total'], $buildSpecifications['body']['total']); + $buildSpecification = $buildSpecifications['body']['specifications'][0]['slug']; $function = $this->createFunction([ 'functionId' => ID::unique(), 'name' => 'Specs function', 'runtime' => 'node-22', - 'buildSpecification' => $buildSpecifications['body']['specifications'][0]['slug'], + 'buildSpecification' => $buildSpecification, 'runtimeSpecification' => $specifications['body']['specifications'][1]['slug'], ]); $this->assertEquals(201, $function['headers']['status-code']); - $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $function['body']['buildSpecification']); + $this->assertEquals($buildSpecification, $function['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $function['body']['runtimeSpecification']); $function = $this->getFunction($function['body']['$id']); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $function['body']['buildSpecification']); + $this->assertEquals($buildSpecification, $function['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $function['body']['runtimeSpecification']); $this->cleanupFunction($function['body']['$id']); diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 5b09b4b45c..a2bf0771ca 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -43,22 +43,23 @@ final class SitesCustomServerTest extends Scope $buildSpecifications = $this->listSpecifications(['type' => 'builds']); $this->assertEquals(200, $buildSpecifications['headers']['status-code']); $this->assertEquals($specifications['body']['total'], $buildSpecifications['body']['total']); + $buildSpecification = $buildSpecifications['body']['specifications'][0]['slug']; $site = $this->createSite([ 'buildRuntime' => 'node-22', 'framework' => 'other', 'name' => 'Specs site', 'siteId' => ID::unique(), - 'buildSpecification' => $buildSpecifications['body']['specifications'][0]['slug'], + 'buildSpecification' => $buildSpecification, 'runtimeSpecification' => $specifications['body']['specifications'][1]['slug'], ]); $this->assertEquals(201, $site['headers']['status-code']); - $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $site['body']['buildSpecification']); + $this->assertEquals($buildSpecification, $site['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $site['body']['runtimeSpecification']); $site = $this->getSite($site['body']['$id']); $this->assertEquals(200, $site['headers']['status-code']); - $this->assertEquals($buildSpecifications['body']['specifications'][0]['slug'], $site['body']['buildSpecification']); + $this->assertEquals($buildSpecification, $site['body']['buildSpecification']); $this->assertEquals($specifications['body']['specifications'][1]['slug'], $site['body']['runtimeSpecification']); $this->cleanupSite($site['body']['$id']); @@ -84,11 +85,15 @@ final class SitesCustomServerTest extends Scope public function testCreateSite(): void { + $buildSpecifications = $this->listSpecifications(['type' => 'builds']); + $buildSpecification = $buildSpecifications['body']['specifications'][0]['slug']; + /** * Test for SUCCESS */ $site = $this->createSite([ 'buildRuntime' => 'node-22', + 'buildSpecification' => $buildSpecification, 'fallbackFile' => '', 'framework' => 'other', 'name' => 'Test Site', @@ -106,7 +111,7 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(true, $dateValidator->isValid($site['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($site['body']['$updatedAt'])); $this->assertEquals('node-22', $site['body']['buildRuntime']); - $this->assertEquals(Specification::S_2VCPU_2GB, $site['body']['buildSpecification']); + $this->assertEquals($buildSpecification, $site['body']['buildSpecification']); $this->assertEquals(null, $site['body']['fallbackFile']); $this->assertEquals('./', $site['body']['outputDirectory']); @@ -721,11 +726,14 @@ final class SitesCustomServerTest extends Scope public function testListSites(): void { + $buildSpecifications = $this->listSpecifications(['type' => 'builds']); + /** * Test for SUCCESS */ $siteId = $this->setupSite([ 'buildRuntime' => 'node-22', + 'buildSpecification' => $buildSpecifications['body']['specifications'][0]['slug'], 'fallbackFile' => '', 'framework' => 'analog', 'name' => 'Test List Sites', @@ -867,8 +875,11 @@ final class SitesCustomServerTest extends Scope public function testGetSite(): void { + $buildSpecifications = $this->listSpecifications(['type' => 'builds']); + $siteId = $this->setupSite([ 'buildRuntime' => 'node-22', + 'buildSpecification' => $buildSpecifications['body']['specifications'][0]['slug'], 'fallbackFile' => '', 'framework' => 'other', 'name' => 'Test Site', @@ -1655,8 +1666,12 @@ final class SitesCustomServerTest extends Scope public function testUpdateSpecs(): void { + $buildSpecifications = $this->listSpecifications(['type' => 'builds']); + $buildSpecification = $buildSpecifications['body']['specifications'][0]['slug']; + $siteId = $this->setupSite([ 'buildRuntime' => 'node-22', + 'buildSpecification' => $buildSpecification, 'fallbackFile' => '', 'framework' => 'other', 'name' => 'Test Site', @@ -1684,7 +1699,7 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(200, $site['headers']['status-code']); $this->assertNotEmpty($site['body']['$id']); - $this->assertEquals(Specification::S_2VCPU_2GB, $site['body']['buildSpecification']); + $this->assertEquals($buildSpecification, $site['body']['buildSpecification']); $this->assertEquals(Specification::S_1VCPU_1GB, $site['body']['runtimeSpecification']); // Change the specs to 1vcpu 512mb @@ -1702,7 +1717,7 @@ final class SitesCustomServerTest extends Scope $this->assertEquals(200, $site['headers']['status-code']); $this->assertNotEmpty($site['body']['$id']); - $this->assertEquals(Specification::S_2VCPU_2GB, $site['body']['buildSpecification']); + $this->assertEquals($buildSpecification, $site['body']['buildSpecification']); $this->assertEquals(Specification::S_1VCPU_512MB, $site['body']['runtimeSpecification']); /** From ea574f9909380b049a7bfe2b48330cc150197e99 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 22 Jun 2026 22:44:22 +0400 Subject: [PATCH 08/24] Pass build spec explicitly in site update test --- tests/e2e/Services/Sites/SitesCustomServerTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index a2bf0771ca..436afea1bd 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -1687,6 +1687,7 @@ final class SitesCustomServerTest extends Scope // Change the function specs $site = $this->updateSite([ 'buildRuntime' => 'node-22', + 'buildSpecification' => $buildSpecification, 'fallbackFile' => '', 'framework' => 'other', 'name' => 'Test Site', @@ -1705,6 +1706,7 @@ final class SitesCustomServerTest extends Scope // Change the specs to 1vcpu 512mb $site = $this->updateSite([ 'buildRuntime' => 'node-22', + 'buildSpecification' => $buildSpecification, 'fallbackFile' => '', 'framework' => 'other', 'name' => 'Test Site', From 7b88334981eae3eb9911282d504966db89852d78 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 18 Jun 2026 04:18:02 +0000 Subject: [PATCH 09/24] fix(storage): return 404 instead of 500 on concurrent file deletion When two requests delete the same file concurrently, both pass the existence check and remove the device file. The first request's deleteDocument() succeeds; the second sees the document already gone (Database::deleteDocument() returns false when the document is empty) and threw GENERAL_SERVER_ERROR ("Failed to remove file from DB"), surfacing a 500 for a file that no longer exists. When deleteDocument() returns false, re-check the document. If it is gone, throw STORAGE_FILE_NOT_FOUND (404), consistent with the not-found check at the start of the request. Only throw the server error when the document genuinely still exists (real DB failure). --- .../Platform/Modules/Storage/Http/Buckets/Files/Delete.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php index c16b374c78..51a175b4c0 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php @@ -145,7 +145,11 @@ class Delete extends Action } if (!$deleted) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove file from DB'); + $exists = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); + if (!$exists->isEmpty()) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove file from DB'); + } + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); } } else { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to delete file from device'); From dc50f940bf1436860d96d3ea5f5e262fe1c3fe02 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 23 Jun 2026 14:47:06 +0400 Subject: [PATCH 10/24] Fix compute build specification defaults --- src/Appwrite/Platform/Modules/Compute/Base.php | 8 ++++++-- .../Modules/Functions/Http/Functions/Create.php | 5 +++-- .../Modules/Functions/Http/Functions/Update.php | 11 +++++++---- .../Modules/Sites/Http/Sites/Update.php | 8 +++++--- .../Services/Sites/SitesCustomServerTest.php | 17 +++++++++++++++++ 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 8efa6d8843..b3740787b3 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -50,17 +50,21 @@ class Base extends Action ); $allowedSpecifications = $specificationValidator->getAllowedSpecifications(); + if (empty($allowedSpecifications)) { + return $fallback; + } + if ($preferFallback && !array_key_exists($planKey, $plan) && \in_array($fallback, $allowedSpecifications)) { return $fallback; } // If there is no plan use the highest specification if (empty($plan)) { - return end($allowedSpecifications) ?: ''; + return end($allowedSpecifications); } // Otherwise, use the lowest specification available in the plan - return $allowedSpecifications[0] ?? ''; + return $allowedSpecifications[0]; } public function redeployVcsFunction(Request $request, Document $function, Document $project, Document $installation, Database $dbForProject, BuildPublisher $publisherForBuilds, Document $template, GitHub $github, bool $activate, array $platform = [], string $referenceType = 'branch', string $reference = ''): Document diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 2692eaf630..48818dd3ec 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -98,11 +98,12 @@ class Create extends Base ->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo.', true) ->param('providerBranches', [], new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches.', true) ->param('providerPaths', [], new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes.', true) - ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( + ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan, 'buildSpecifications'), fn (array $plan) => new Specification( $plan, Config::getParam('specifications', []), System::getEnv('_APP_COMPUTE_CPUS', 0), - System::getEnv('_APP_COMPUTE_MEMORY', 0) + System::getEnv('_APP_COMPUTE_MEMORY', 0), + 'buildSpecifications' ), 'Build specification for the function deployments.', true, ['plan']) ->param('runtimeSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( $plan, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index e9e14a6e22..f23f4bd678 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -90,12 +90,13 @@ class Update extends Base ->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo.', true) ->param('providerBranches', null, new Nullable(new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches.', true) ->param('providerPaths', null, new Nullable(new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes.', true) - ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan), fn (array $plan) => new Specification( + ->param('buildSpecification', null, fn (array $plan) => new Nullable(new Specification( $plan, Config::getParam('specifications', []), System::getEnv('_APP_COMPUTE_CPUS', 0), - System::getEnv('_APP_COMPUTE_MEMORY', 0) - ), 'Build specification for the function deployments.', true, ['plan']) + System::getEnv('_APP_COMPUTE_MEMORY', 0), + 'buildSpecifications' + )), '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', []), @@ -137,7 +138,7 @@ class Update extends Base string $providerRootDirectory, ?array $providerBranches, ?array $providerPaths, - string $buildSpecification, + ?string $buildSpecification, string $runtimeSpecification, int $deploymentRetention, Request $request, @@ -173,6 +174,8 @@ class Update extends Base $runtime = $function->getAttribute('runtime'); } + $buildSpecification ??= $function->getAttribute('buildSpecification', APP_COMPUTE_SPECIFICATION_DEFAULT); + $repositoryId = $function->getAttribute('repositoryId', ''); $repositoryInternalId = $function->getAttribute('repositoryInternalId', ''); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 474024fc76..18b38d45af 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -86,13 +86,13 @@ class Update extends Base ->param('providerRootDirectory', '', new Text(128, 0), 'Path to site code in the linked repo.', true) ->param('providerBranches', null, new Nullable(new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches.', true) ->param('providerPaths', null, new Nullable(new ArrayList(new Text(128), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes.', true) - ->param('buildSpecification', fn (array $plan) => $this->getDefaultSpecification($plan, 'buildSpecifications', APP_SITES_BUILD_SPECIFICATION_DEFAULT, true), fn (array $plan) => new Specification( + ->param('buildSpecification', null, fn (array $plan) => new Nullable(new Specification( $plan, Config::getParam('specifications', []), System::getEnv('_APP_COMPUTE_CPUS', 0), System::getEnv('_APP_COMPUTE_MEMORY', 0), 'buildSpecifications' - ), 'Build specification for the site deployments.', 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', []), @@ -134,7 +134,7 @@ class Update extends Base string $providerRootDirectory, ?array $providerBranches, ?array $providerPaths, - string $buildSpecification, + ?string $buildSpecification, string $runtimeSpecification, int $deploymentRetention, Request $request, @@ -178,6 +178,8 @@ class Update extends Base $framework = $site->getAttribute('framework'); } + $buildSpecification ??= $site->getAttribute('buildSpecification', APP_SITES_BUILD_SPECIFICATION_DEFAULT); + $repositoryId = $site->getAttribute('repositoryId', ''); $repositoryInternalId = $site->getAttribute('repositoryInternalId', ''); diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 436afea1bd..7a5f578492 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -1703,6 +1703,23 @@ final class SitesCustomServerTest extends Scope $this->assertEquals($buildSpecification, $site['body']['buildSpecification']); $this->assertEquals(Specification::S_1VCPU_1GB, $site['body']['runtimeSpecification']); + $site = $this->updateSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + '$id' => $siteId, + 'runtimeSpecification' => Specification::S_1VCPU_1GB, + ]); + + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals($buildSpecification, $site['body']['buildSpecification']); + $this->assertEquals(Specification::S_1VCPU_1GB, $site['body']['runtimeSpecification']); + // Change the specs to 1vcpu 512mb $site = $this->updateSite([ 'buildRuntime' => 'node-22', From bcb0cb014fe1165faa6f71e0ecce49693d324f22 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 23 Jun 2026 15:04:59 +0400 Subject: [PATCH 11/24] Preserve legacy build specification limits --- .../Platform/Modules/Compute/Base.php | 1 + .../Compute/Validator/Specification.php | 14 +++++++++-- .../Functions/Http/Specifications/XList.php | 3 ++- .../Sites/Http/Specifications/XList.php | 3 ++- .../Compute/Validator/SpecificationTest.php | 23 +++++++++++++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index b3740787b3..07e09a3b89 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -49,6 +49,7 @@ class Base extends Action $planKey ); $allowedSpecifications = $specificationValidator->getAllowedSpecifications(); + $planKey = $specificationValidator->getPlanKey(); if (empty($allowedSpecifications)) { return $fallback; diff --git a/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php index 5f1337c97f..8a77afef24 100644 --- a/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php +++ b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php @@ -25,6 +25,15 @@ class Specification extends Validator $this->planKey = $planKey; } + public function getPlanKey(): string + { + if ($this->planKey === 'buildSpecifications' && !array_key_exists('buildSpecifications', $this->plan) && array_key_exists('runtimeSpecifications', $this->plan)) { + return 'runtimeSpecifications'; + } + + return $this->planKey; + } + /** * Get Allowed Specifications. * @@ -35,11 +44,12 @@ class Specification extends Validator public function getAllowedSpecifications(): array { $allowedSpecifications = []; + $planKey = $this->getPlanKey(); foreach ($this->specifications as $size => $values) { if ((empty($this->maxCpus) || $values['cpus'] <= $this->maxCpus) && (empty($this->maxMemory) || $values['memory'] <= $this->maxMemory)) { - if (!empty($this->plan) && array_key_exists($this->planKey, $this->plan)) { - if (!\in_array($size, $this->plan[$this->planKey])) { + if (!empty($this->plan) && array_key_exists($planKey, $this->plan)) { + if (!\in_array($size, $this->plan[$planKey])) { continue; } } diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php index 8cbff906fa..e8177abdbd 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Specifications; use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -56,7 +57,7 @@ class XList extends Base public function action(string $type, Response $response, array $plan) { $allSpecs = Config::getParam('specifications', []); - $planKey = $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'; + $planKey = (new Specification($plan, [], 0, 0, $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'))->getPlanKey(); $specs = []; foreach ($allSpecs as $spec) { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php index a4f865d859..735e45bcdc 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Specifications; use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -56,7 +57,7 @@ class XList extends Base public function action(string $type, Response $response, array $plan) { $allSpecs = Config::getParam('specifications', []); - $planKey = $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'; + $planKey = (new Specification($plan, [], 0, 0, $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'))->getPlanKey(); $specs = []; foreach ($allSpecs as $spec) { diff --git a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php index abc6296d0a..15d9961aa8 100644 --- a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php +++ b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php @@ -96,4 +96,27 @@ final class SpecificationTest extends TestCase $this->assertContains(SpecificationConstants::S_1VCPU_1GB, $allowed); $this->assertContains(SpecificationConstants::S_2VCPU_2GB, $allowed); } + + public function testGetAllowedSpecificationsWithLegacyBuildPlanLimits(): void + { + $plan = [ + 'runtimeSpecifications' => [ + SpecificationConstants::S_05VCPU_512MB, + SpecificationConstants::S_1VCPU_512MB, + ] + ]; + $validator = new Specification( + plan: $plan, + specifications: $this->specifications, + maxCpus: 0, + maxMemory: 0, + planKey: 'buildSpecifications' + ); + + $allowed = $validator->getAllowedSpecifications(); + $this->assertEquals('runtimeSpecifications', $validator->getPlanKey()); + $this->assertCount(2, $allowed); + $this->assertContains(SpecificationConstants::S_05VCPU_512MB, $allowed); + $this->assertContains(SpecificationConstants::S_1VCPU_512MB, $allowed); + } } From c44c5e6733792b6988c663d32340fdb6ad65a87c Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 23 Jun 2026 15:18:32 +0400 Subject: [PATCH 12/24] Apply specification test rector fix --- .../Platform/Modules/Compute/Validator/SpecificationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php index 15d9961aa8..5b9c8b4310 100644 --- a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php +++ b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php @@ -114,7 +114,7 @@ final class SpecificationTest extends TestCase ); $allowed = $validator->getAllowedSpecifications(); - $this->assertEquals('runtimeSpecifications', $validator->getPlanKey()); + $this->assertSame('runtimeSpecifications', $validator->getPlanKey()); $this->assertCount(2, $allowed); $this->assertContains(SpecificationConstants::S_05VCPU_512MB, $allowed); $this->assertContains(SpecificationConstants::S_1VCPU_512MB, $allowed); From 38467157db2c175cfbc2b00de587736f18b3d0c9 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 23 Jun 2026 15:26:58 +0400 Subject: [PATCH 13/24] Revert "Apply specification test rector fix" This reverts commit c44c5e6733792b6988c663d32340fdb6ad65a87c. --- .../Platform/Modules/Compute/Validator/SpecificationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php index 5b9c8b4310..15d9961aa8 100644 --- a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php +++ b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php @@ -114,7 +114,7 @@ final class SpecificationTest extends TestCase ); $allowed = $validator->getAllowedSpecifications(); - $this->assertSame('runtimeSpecifications', $validator->getPlanKey()); + $this->assertEquals('runtimeSpecifications', $validator->getPlanKey()); $this->assertCount(2, $allowed); $this->assertContains(SpecificationConstants::S_05VCPU_512MB, $allowed); $this->assertContains(SpecificationConstants::S_1VCPU_512MB, $allowed); From e9baaddfaddedda7072c9651d12f3f2f49d2c5b7 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 23 Jun 2026 15:26:58 +0400 Subject: [PATCH 14/24] Revert "Preserve legacy build specification limits" This reverts commit bcb0cb014fe1165faa6f71e0ecce49693d324f22. --- .../Platform/Modules/Compute/Base.php | 1 - .../Compute/Validator/Specification.php | 14 ++--------- .../Functions/Http/Specifications/XList.php | 3 +-- .../Sites/Http/Specifications/XList.php | 3 +-- .../Compute/Validator/SpecificationTest.php | 23 ------------------- 5 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 07e09a3b89..b3740787b3 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -49,7 +49,6 @@ class Base extends Action $planKey ); $allowedSpecifications = $specificationValidator->getAllowedSpecifications(); - $planKey = $specificationValidator->getPlanKey(); if (empty($allowedSpecifications)) { return $fallback; diff --git a/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php index 8a77afef24..5f1337c97f 100644 --- a/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php +++ b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php @@ -25,15 +25,6 @@ class Specification extends Validator $this->planKey = $planKey; } - public function getPlanKey(): string - { - if ($this->planKey === 'buildSpecifications' && !array_key_exists('buildSpecifications', $this->plan) && array_key_exists('runtimeSpecifications', $this->plan)) { - return 'runtimeSpecifications'; - } - - return $this->planKey; - } - /** * Get Allowed Specifications. * @@ -44,12 +35,11 @@ class Specification extends Validator public function getAllowedSpecifications(): array { $allowedSpecifications = []; - $planKey = $this->getPlanKey(); foreach ($this->specifications as $size => $values) { if ((empty($this->maxCpus) || $values['cpus'] <= $this->maxCpus) && (empty($this->maxMemory) || $values['memory'] <= $this->maxMemory)) { - if (!empty($this->plan) && array_key_exists($planKey, $this->plan)) { - if (!\in_array($size, $this->plan[$planKey])) { + if (!empty($this->plan) && array_key_exists($this->planKey, $this->plan)) { + if (!\in_array($size, $this->plan[$this->planKey])) { continue; } } diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php index e8177abdbd..8cbff906fa 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -3,7 +3,6 @@ namespace Appwrite\Platform\Modules\Functions\Http\Specifications; use Appwrite\Platform\Modules\Compute\Base; -use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -57,7 +56,7 @@ class XList extends Base public function action(string $type, Response $response, array $plan) { $allSpecs = Config::getParam('specifications', []); - $planKey = (new Specification($plan, [], 0, 0, $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'))->getPlanKey(); + $planKey = $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'; $specs = []; foreach ($allSpecs as $spec) { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php index 735e45bcdc..a4f865d859 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -3,7 +3,6 @@ namespace Appwrite\Platform\Modules\Sites\Http\Specifications; use Appwrite\Platform\Modules\Compute\Base; -use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -57,7 +56,7 @@ class XList extends Base public function action(string $type, Response $response, array $plan) { $allSpecs = Config::getParam('specifications', []); - $planKey = (new Specification($plan, [], 0, 0, $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'))->getPlanKey(); + $planKey = $type === 'builds' ? 'buildSpecifications' : 'runtimeSpecifications'; $specs = []; foreach ($allSpecs as $spec) { diff --git a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php index 15d9961aa8..abc6296d0a 100644 --- a/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php +++ b/tests/unit/Platform/Modules/Compute/Validator/SpecificationTest.php @@ -96,27 +96,4 @@ final class SpecificationTest extends TestCase $this->assertContains(SpecificationConstants::S_1VCPU_1GB, $allowed); $this->assertContains(SpecificationConstants::S_2VCPU_2GB, $allowed); } - - public function testGetAllowedSpecificationsWithLegacyBuildPlanLimits(): void - { - $plan = [ - 'runtimeSpecifications' => [ - SpecificationConstants::S_05VCPU_512MB, - SpecificationConstants::S_1VCPU_512MB, - ] - ]; - $validator = new Specification( - plan: $plan, - specifications: $this->specifications, - maxCpus: 0, - maxMemory: 0, - planKey: 'buildSpecifications' - ); - - $allowed = $validator->getAllowedSpecifications(); - $this->assertEquals('runtimeSpecifications', $validator->getPlanKey()); - $this->assertCount(2, $allowed); - $this->assertContains(SpecificationConstants::S_05VCPU_512MB, $allowed); - $this->assertContains(SpecificationConstants::S_1VCPU_512MB, $allowed); - } } From d77ccbe47417f1f02494dfcc50d8d576cda2e645 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 24 Jun 2026 00:15:33 +1200 Subject: [PATCH 15/24] chore(deps): loosen cache/database constraints to caret ranges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The exact-minor pins (database 6.0.*, cache ^3.0) feature-locked the server to a minor line and blocked database 6.1.0 / cache 3.1.0 — the releases that carry the lease primitive fixing the cache-aside read-after-write race behind recurring CI flakiness. Use caret ranges (^6.0.0, ^3.0.0) so backward-compatible minors flow through, and refresh the lock to 6.1.0 / 3.1.0. Co-Authored-By: Claude Opus 4.8 --- composer.json | 4 ++-- composer.lock | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 2a1499f1a8..aca0e41e97 100644 --- a/composer.json +++ b/composer.json @@ -58,12 +58,12 @@ "utopia-php/analytics": "0.15.*", "utopia-php/audit": "2.6.*", "utopia-php/auth": "^0.7", - "utopia-php/cache": "^3.0", + "utopia-php/cache": "^3.0.0", "utopia-php/cli": "^0.24", "utopia-php/compression": "0.1.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", - "utopia-php/database": "6.0.*", + "utopia-php/database": "^6.0.0", "utopia-php/detector": "0.2.*", "utopia-php/domains": "^2.2", "utopia-php/emails": "0.7.*", diff --git a/composer.lock b/composer.lock index 652b26e041..b1fa6bf2d1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "508b3e633843d61eb24f864fd8832db0", + "content-hash": "17128527d9ef62968ea12eb43a81fdfb", "packages": [ { "name": "adhocore/jwt", @@ -3369,16 +3369,16 @@ }, { "name": "utopia-php/cache", - "version": "3.0.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/cache.git", - "reference": "086687d7ae23dd1dae67b943161e8cef143539e1" + "reference": "d5048409cf3a8db668b00cd2e6c46a627b16d76a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cache/zipball/086687d7ae23dd1dae67b943161e8cef143539e1", - "reference": "086687d7ae23dd1dae67b943161e8cef143539e1", + "url": "https://api.github.com/repos/utopia-php/cache/zipball/d5048409cf3a8db668b00cd2e6c46a627b16d76a", + "reference": "d5048409cf3a8db668b00cd2e6c46a627b16d76a", "shasum": "" }, "require": { @@ -3417,9 +3417,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cache/issues", - "source": "https://github.com/utopia-php/cache/tree/3.0.2" + "source": "https://github.com/utopia-php/cache/tree/3.1.0" }, - "time": "2026-05-19T22:38:16+00:00" + "time": "2026-06-23T10:59:08+00:00" }, { "name": "utopia-php/circuit-breaker", @@ -3676,16 +3676,16 @@ }, { "name": "utopia-php/database", - "version": "6.0.0", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "fff9f0effbd40359ff925741ff9424856d8b4fde" + "reference": "18120ddf0bc656fc448e6c9407d2f16371d6f0a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/fff9f0effbd40359ff925741ff9424856d8b4fde", - "reference": "fff9f0effbd40359ff925741ff9424856d8b4fde", + "url": "https://api.github.com/repos/utopia-php/database/zipball/18120ddf0bc656fc448e6c9407d2f16371d6f0a6", + "reference": "18120ddf0bc656fc448e6c9407d2f16371d6f0a6", "shasum": "" }, "require": { @@ -3694,7 +3694,7 @@ "ext-pdo": "*", "ext-redis": "*", "php": ">=8.4", - "utopia-php/cache": "^3.0", + "utopia-php/cache": "3.1.*", "utopia-php/console": "0.1.*", "utopia-php/mongo": "1.*", "utopia-php/pools": "1.*", @@ -3730,9 +3730,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/6.0.0" + "source": "https://github.com/utopia-php/database/tree/6.1.0" }, - "time": "2026-06-18T10:37:40+00:00" + "time": "2026-06-23T11:28:30+00:00" }, { "name": "utopia-php/detector", From 2d1d290c9bd58bf61a88e3e5c698f7fd758f641b Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 23 Jun 2026 17:58:25 +0530 Subject: [PATCH 16/24] fix: prevent VCS webhook 500s on inaccessible commits and failed comment updates - Wrap getCommit() in try/catch so force-pushed/deleted commits fall back to empty author/message instead of throwing a 500 - Catch updateComment() failures at all 3 call sites so a cosmetic PR comment update failure no longer fails the entire deployment --- .../Platform/Modules/VCS/Http/GitHub/Deployment.php | 6 ++++++ .../Platform/Modules/VCS/Http/GitHub/Events/Create.php | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php index d172fdc688..d312cc3a56 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php @@ -237,6 +237,8 @@ trait Deployment $comment->addBuild($project, $resource, $resourceType, $commentStatus, $deploymentId, $action, $commentPreviewUrl); $latestCommentId = \strval($github->updateComment($owner, $repositoryName, $latestCommentId, $comment->generateComment())); + } catch (\Throwable $e) { + Console::warning("Failed to update PR comment '{$latestCommentId}': " . $e->getMessage()); } finally { $authorization->skip(fn () => $dbForPlatform->deleteDocument('vcsCommentLocks', $latestCommentId)); } @@ -308,6 +310,8 @@ trait Deployment $comment->addBuild($project, $resource, $resourceType, $commentStatus, $deploymentId, $action, ''); $latestCommentId = \strval($github->updateComment($owner, $repositoryName, $latestCommentId, $comment->generateComment())); + } catch (\Throwable $e) { + Console::warning("Failed to update PR comment '{$latestCommentId}': " . $e->getMessage()); } finally { $authorization->skip(fn () => $dbForPlatform->deleteDocument('vcsCommentLocks', $latestCommentId)); } @@ -526,6 +530,8 @@ trait Deployment $comment->addBuild($project, $resource, $resourceType, $commentStatus, $deploymentId, $action, $previewUrl); $github->updateComment($owner, $repositoryName, $latestCommentId, $comment->generateComment()); } + } catch (\Throwable $e) { + Console::warning("Failed to update PR comment '{$latestCommentId}': " . $e->getMessage()); } finally { $authorization->skip(fn () => $dbForPlatform->deleteDocument('vcsCommentLocks', $latestCommentId)); } diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php index 420715ddc6..5ace6d72df 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php @@ -12,6 +12,7 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; +use Utopia\Console; use Utopia\Platform\Scope\HTTP; use Utopia\Span\Span; use Utopia\System\System; @@ -207,7 +208,12 @@ class Create extends Action $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); - $commitDetails = $github->getCommit($providerRepositoryOwner, $providerRepositoryName, $providerCommitHash); + try { + $commitDetails = $github->getCommit($providerRepositoryOwner, $providerRepositoryName, $providerCommitHash); + } catch (\Throwable $e) { + Console::warning("Failed to fetch commit '{$providerCommitHash}': " . $e->getMessage()); + $commitDetails = []; + } $providerCommitAuthor = $commitDetails["commitAuthor"] ?? ''; $providerCommitMessage = $commitDetails["commitMessage"] ?? ''; From de1951996e84bfe9bf1a876b0a2d432699953ca6 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 23 Jun 2026 18:43:05 +0530 Subject: [PATCH 17/24] fix: order use imports --- src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php index 5ace6d72df..e40e447ed5 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php @@ -8,11 +8,11 @@ use Appwrite\Platform\Action; use Appwrite\Platform\Modules\VCS\Http\GitHub\Deployment; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; -use Utopia\Console; use Utopia\Platform\Scope\HTTP; use Utopia\Span\Span; use Utopia\System\System; From 82df418820da32f070ae23056ec8572435994c2f Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 17 Jun 2026 18:01:16 +0100 Subject: [PATCH 18/24] fix(builds): mask internal errors from user-visible build logs The builds worker wrote the message of any caught throwable straight into the user-visible buildLogs, leaking internal errors (e.g. database or executor failures) to users. Introduce a BuildException (a typed Appwrite\Extend\Exception defaulting to BUILD_FAILED) for every build error we raise intentionally, and only surface its message in the failure handler. Any other throwable is masked behind a generic message; the real error is still recorded on the span. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Functions/Workers/BuildException.php | 23 ++++++++++++++ .../Modules/Functions/Workers/Builds.php | 31 ++++++++++--------- 2 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 src/Appwrite/Platform/Modules/Functions/Workers/BuildException.php diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/BuildException.php b/src/Appwrite/Platform/Modules/Functions/Workers/BuildException.php new file mode 100644 index 0000000000..1496fd7b72 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Workers/BuildException.php @@ -0,0 +1,23 @@ +getCollection() === 'functions' ? RESOURCE_TYPE_FUNCTIONS : RESOURCE_TYPE_SITES, $resource->getId())) { - throw new \Exception('Resource is blocked'); + throw new BuildException('Resource is blocked'); } $log->addTag('deploymentId', $deployment->getId()); @@ -226,7 +226,7 @@ class Builds extends Action } if ($resource->getCollection() === 'functions' && empty($deployment->getAttribute('entrypoint', ''))) { - throw new \Exception('Entrypoint for your Appwrite Function is missing. Please specify it when making deployment or update the entrypoint under your function\'s "Settings" > "Configuration" > "Entrypoint".'); + throw new BuildException('Entrypoint for your Appwrite Function is missing. Please specify it when making deployment or update the entrypoint under your function\'s "Settings" > "Configuration" > "Entrypoint".'); } $version = $this->getVersion($resource); @@ -406,7 +406,7 @@ class Builds extends Action $exit = Console::execute($gitCloneCommand, '', $stdout, $stderr); if ($exit !== 0) { - throw new \Exception('Unable to clone code repository: ' . $stderr); + throw new BuildException('Unable to clone code repository: ' . $stderr); } // Local refactoring for function folder with spaces @@ -501,7 +501,7 @@ class Builds extends Action } if ($directorySize > $sizeLimit && $sizeLimit !== 0) { - throw new \Exception('Repository directory size should be less than ' . number_format($sizeLimit / (1000 * 1000), 2) . ' MBs.'); + throw new BuildException('Repository directory size should be less than ' . number_format($sizeLimit / (1000 * 1000), 2) . ' MBs.'); } Console::execute('find ' . \escapeshellarg($tmpDirectory) . ' -type d -name ".git" -exec rm -rf {} +', '', $stdout, $stderr); @@ -739,7 +739,7 @@ class Builds extends Action $span?->set('build.runtime.timed_out', true); $span?->set('build.runtime.error_type', $error::class); $span?->set('build.runtime.error_message', $error->getMessage()); - $err = new AppwriteException(AppwriteException::BUILD_TIMEOUT, previous: $error); + $err = new BuildException(type: AppwriteException::BUILD_TIMEOUT, previous: $error); } catch (\Throwable $error) { $span?->set('build.runtime.error_type', $error::class); $span?->set('build.runtime.error_message', $error->getMessage()); @@ -865,7 +865,7 @@ class Builds extends Action $buildSizeLimit = $plan['buildSize'] * 1000 * 1000; } if ($response['size'] > $buildSizeLimit && $buildSizeLimit !== 0) { - throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / (1000 * 1000), 2) . ' MBs.'); + throw new BuildException('Build size should be less than ' . number_format($buildSizeLimit / (1000 * 1000), 2) . ' MBs.'); } $deployment->setAttribute('buildPath', $response['path']); @@ -896,7 +896,7 @@ class Builds extends Action Span::add('build.adapter', $deployment->getAttribute('adapter')); Span::add('build.fallback_file', $deployment->getAttribute('fallbackFile')); } elseif ($adapter === 'ssr' && $detection->getName() === 'static') { - throw new \Exception('Adapter mismatch. Detected: ' . $detection->getName() . ' does not match with the set adapter: ' . $adapter); + throw new BuildException('Adapter mismatch. Detected: ' . $detection->getName() . ' does not match with the set adapter: ' . $adapter); } } @@ -1134,14 +1134,12 @@ class Builds extends Action return; } - Span::add('build.error.stage', 'deployment'); - Span::add('build.error.type', $th::class); - Span::add('build.error.message', $th->getMessage()); - Span::add('build.error.file', $th->getFile()); - Span::add('build.error.line', $th->getLine()); + $isUserFacing = $th instanceof BuildException; + $message = $isUserFacing + ? $th->getMessage() + : 'An internal error occurred while building. Please try again, and contact support if the problem persists.'; // Color message red - $message = $th->getMessage(); if (! \str_contains($message, '')) { $message = '' . $message; } @@ -1181,6 +1179,11 @@ class Builds extends Action if ($isVcsEnabled) { $this->runGitAction('failed', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform, $queueForRealtime, $platform, true); } + + // Let the worker harness record internal errors via the span and logger. + if (! $isUserFacing) { + throw $th; + } } finally { $queueForRealtime ->setPayload($deployment->getArrayCopy()) @@ -1277,7 +1280,7 @@ class Builds extends Action default => null }; if (\is_null($runtime)) { - throw new \Exception('Runtime "' . $resource->getAttribute('runtime', '') . '" is not supported'); + throw new BuildException('Runtime "' . $resource->getAttribute('runtime', '') . '" is not supported'); } return $runtime; From b881a4ed641a175e39b4e836fea85ed96c2dda53 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 23 Jun 2026 14:38:24 +0100 Subject: [PATCH 19/24] feat(builds): record per-phase timings on the build span Emit timings.{setup,source,build,finalize} so each distinct phase of a build (preparation, source packaging, executor build, finalization) can be profiled independently of the overall build.duration. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Platform/Modules/Functions/Workers/Builds.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 392f37bc02..e1e7375cb5 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -195,6 +195,7 @@ class Builds extends Action $startTime = DateTime::now(); $durationStart = \microtime(true); + $phaseStart = $durationStart; $resourceKey = match ($resource->getCollection()) { 'functions' => 'functionId', @@ -297,6 +298,9 @@ class Builds extends Action $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); } + Span::add('timings.setup', \round(\microtime(true) - $phaseStart, 3)); + $phaseStart = \microtime(true); + try { if (! $isVcsEnabled) { // Non-VCS + Template @@ -539,6 +543,9 @@ class Builds extends Action $this->runGitAction('processing', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform, $queueForRealtime, $platform); } + Span::add('timings.source', \round(\microtime(true) - $phaseStart, 3)); + $phaseStart = \microtime(true); + /** Request the executor to build the code... */ $updated = $dbForProject->updateDocuments('deployments', new Document([ 'status' => 'building', @@ -849,6 +856,9 @@ class Builds extends Action }), ]); + Span::add('timings.build', \round(\microtime(true) - $phaseStart, 3)); + $phaseStart = \microtime(true); + $latestDeployment = $dbForProject->getDocument('deployments', $deploymentId); if ($latestDeployment->getAttribute('status') === 'canceled') { $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); @@ -1127,6 +1137,8 @@ class Builds extends Action Span::add('build.screenshot_queued', true); } + + Span::add('timings.finalize', \round(\microtime(true) - $phaseStart, 3)); } catch (\Throwable $th) { if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); From 65b863b44345d09adca5f2971c9590c179d51327 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 23 Jun 2026 14:55:24 +0100 Subject: [PATCH 20/24] fix(builds): record user-facing build failures on the span A swallowed BuildException is never re-raised to the worker harness, so without this its failure reason was absent from the trace. Record build.error.type/message on the span for user-facing failures; internal errors still get full detail via the harness setError on rethrow. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index e1e7375cb5..c2b8837c13 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1151,6 +1151,13 @@ class Builds extends Action ? $th->getMessage() : 'An internal error occurred while building. Please try again, and contact support if the problem persists.'; + // Record user-facing failures on the span here, since they're not + // re-raised to the harness (which records internal errors via setError). + if ($isUserFacing) { + Span::add('build.exception.type', $th->getType()); + Span::add('build.exception.message', $th->getMessage()); + } + // Color message red if (! \str_contains($message, '')) { $message = '' . $message; From 4bbc28f419f99d5a2eb76a5d39f3437ee80dc2ed Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 24 Jun 2026 03:06:41 +0000 Subject: [PATCH 21/24] feat: introduce dedicated usage.resource label for usage tag derivation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cloud's request lifecycle (`app/controllers/general.php`) reads each route's resource label to derive `service` / `resource` / `resourceId` tags on every usage event row (incl. network metrics emitted by `Bus/Listeners/Usage` on every HTTP request). Until now it read `audits.resource`, which is also what the CE audit publisher uses to decide whether to write an audit log entry (`app/controllers/shared/api.php:909-960` enqueues whenever `audits.resource` is set and a user is present — no separate `audits.event` gate). Two consequences of the conflation: * Reads that emit usage metrics (e.g. `databases.operations.reads` from `Documents/{XList,Get}`) can't tag correctly without accidentally enabling audit logging on every list/get. The shutdown fallback then tags those reads with `resource='project'`, `resourceId=` — wrong for a database-scoped metric. * The two labels can legitimately want different shapes — an audit row may want the full hierarchical path down to a document id; usage tagging only consumes the first two slash-segments. Sharing one label couples the consumers together. Introduce a dedicated `usage.resource` label with the same shape as `audits.resource` (`/[/...]`). The first two segments drive the usage Context's `resource` and `resourceId`. Applied to: * Every route that already carries `audits.resource` — verbatim mirror of the value. No audit-log or usage-tag behavior change today; the two labels are allowed to diverge tomorrow. This is the bulk of the diff. The reason this is the full audited surface, not just metric-emitters: `Bus/Listeners/Usage` adds `METRIC_NETWORK_REQUESTS` / `INBOUND` / `OUTBOUND` on every HTTP request via the same Context, so any audited route's network metrics also benefit from the tag. * Two read endpoints (`Documents/XList`, `Documents/Get`) that emit usage metrics but never had a resource label. Gain it for the first time, fixing `databases.operations.reads` tagging. * `Functions/Executions/Create` — emits execution metrics, had no resource label of any kind. Gains `function/{request.functionId}`. Skipped on purpose: * `Avatars/Screenshots/Get` — project-scoped metric; cloud's project-fallback already tags it correctly. * `Databases/Transactions/Update` — emits per-database metrics but only carries `transactionId` in the URL; resolving the underlying `databaseId` needs a per-request document lookup that the label syntax can't express. Tracked separately. * Routes with no `audits.resource` and no usage metric emission (Health checks, console, etc.) — project-fallback is correct for network metrics on those routes. * Workers + listeners — not HTTP endpoints; tag metrics via their own contexts. No `audits.resource` is touched. Audit log behavior is unchanged on every endpoint. Cloud's `app/controllers/general.php` will switch to `usage.resource` (with `audits.resource` fallback during the rollout window) in a follow-up. --- .../Modules/Account/Http/Account/MFA/Authenticators/Create.php | 1 + .../Modules/Account/Http/Account/MFA/Authenticators/Delete.php | 1 + .../Modules/Account/Http/Account/MFA/Authenticators/Update.php | 1 + .../Modules/Account/Http/Account/MFA/Challenges/Create.php | 1 + .../Modules/Account/Http/Account/MFA/Challenges/Update.php | 1 + .../Modules/Account/Http/Account/MFA/RecoveryCodes/Create.php | 1 + .../Modules/Account/Http/Account/MFA/RecoveryCodes/Update.php | 1 + .../Platform/Modules/Account/Http/Account/MFA/Update.php | 1 + src/Appwrite/Platform/Modules/Advisor/Http/Reports/Delete.php | 1 + .../Http/Databases/Collections/Attributes/BigInt/Create.php | 1 + .../Http/Databases/Collections/Attributes/BigInt/Update.php | 1 + .../Http/Databases/Collections/Attributes/Boolean/Create.php | 1 + .../Http/Databases/Collections/Attributes/Boolean/Update.php | 1 + .../Http/Databases/Collections/Attributes/Datetime/Create.php | 1 + .../Http/Databases/Collections/Attributes/Datetime/Update.php | 1 + .../Databases/Http/Databases/Collections/Attributes/Delete.php | 1 + .../Http/Databases/Collections/Attributes/Email/Create.php | 1 + .../Http/Databases/Collections/Attributes/Email/Update.php | 1 + .../Http/Databases/Collections/Attributes/Enum/Create.php | 1 + .../Http/Databases/Collections/Attributes/Enum/Update.php | 1 + .../Http/Databases/Collections/Attributes/Float/Create.php | 1 + .../Http/Databases/Collections/Attributes/Float/Update.php | 1 + .../Http/Databases/Collections/Attributes/IP/Create.php | 1 + .../Http/Databases/Collections/Attributes/IP/Update.php | 1 + .../Http/Databases/Collections/Attributes/Integer/Create.php | 1 + .../Http/Databases/Collections/Attributes/Integer/Update.php | 1 + .../Http/Databases/Collections/Attributes/Line/Create.php | 1 + .../Http/Databases/Collections/Attributes/Line/Update.php | 1 + .../Http/Databases/Collections/Attributes/Longtext/Create.php | 1 + .../Http/Databases/Collections/Attributes/Longtext/Update.php | 1 + .../Http/Databases/Collections/Attributes/Mediumtext/Create.php | 1 + .../Http/Databases/Collections/Attributes/Mediumtext/Update.php | 1 + .../Http/Databases/Collections/Attributes/Point/Create.php | 1 + .../Http/Databases/Collections/Attributes/Point/Update.php | 1 + .../Http/Databases/Collections/Attributes/Polygon/Create.php | 1 + .../Http/Databases/Collections/Attributes/Polygon/Update.php | 1 + .../Databases/Collections/Attributes/Relationship/Create.php | 1 + .../Databases/Collections/Attributes/Relationship/Update.php | 1 + .../Http/Databases/Collections/Attributes/String/Create.php | 1 + .../Http/Databases/Collections/Attributes/String/Update.php | 1 + .../Http/Databases/Collections/Attributes/Text/Create.php | 1 + .../Http/Databases/Collections/Attributes/Text/Update.php | 1 + .../Http/Databases/Collections/Attributes/URL/Create.php | 1 + .../Http/Databases/Collections/Attributes/URL/Update.php | 1 + .../Http/Databases/Collections/Attributes/Varchar/Create.php | 1 + .../Http/Databases/Collections/Attributes/Varchar/Update.php | 1 + .../Modules/Databases/Http/Databases/Collections/Create.php | 1 + .../Modules/Databases/Http/Databases/Collections/Delete.php | 1 + .../Http/Databases/Collections/Documents/Attribute/Decrement.php | 1 + .../Http/Databases/Collections/Documents/Attribute/Increment.php | 1 + .../Http/Databases/Collections/Documents/Bulk/Delete.php | 1 + .../Http/Databases/Collections/Documents/Bulk/Update.php | 1 + .../Http/Databases/Collections/Documents/Bulk/Upsert.php | 1 + .../Databases/Http/Databases/Collections/Documents/Create.php | 1 + .../Databases/Http/Databases/Collections/Documents/Delete.php | 1 + .../Databases/Http/Databases/Collections/Documents/Get.php | 1 + .../Databases/Http/Databases/Collections/Documents/Update.php | 1 + .../Databases/Http/Databases/Collections/Documents/Upsert.php | 1 + .../Databases/Http/Databases/Collections/Documents/XList.php | 1 + .../Databases/Http/Databases/Collections/Indexes/Create.php | 1 + .../Databases/Http/Databases/Collections/Indexes/Delete.php | 1 + .../Modules/Databases/Http/Databases/Collections/Update.php | 1 + .../Platform/Modules/Databases/Http/Databases/Create.php | 1 + .../Platform/Modules/Databases/Http/Databases/Delete.php | 1 + .../Platform/Modules/Databases/Http/Databases/Update.php | 1 + .../Modules/Databases/Http/DocumentsDB/Collections/Create.php | 1 + .../Modules/Databases/Http/DocumentsDB/Collections/Delete.php | 1 + .../DocumentsDB/Collections/Documents/Attribute/Decrement.php | 1 + .../DocumentsDB/Collections/Documents/Attribute/Increment.php | 1 + .../Http/DocumentsDB/Collections/Documents/Bulk/Delete.php | 1 + .../Http/DocumentsDB/Collections/Documents/Bulk/Update.php | 1 + .../Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php | 1 + .../Databases/Http/DocumentsDB/Collections/Documents/Create.php | 1 + .../Databases/Http/DocumentsDB/Collections/Documents/Delete.php | 1 + .../Databases/Http/DocumentsDB/Collections/Documents/Update.php | 1 + .../Databases/Http/DocumentsDB/Collections/Documents/Upsert.php | 1 + .../Databases/Http/DocumentsDB/Collections/Indexes/Create.php | 1 + .../Databases/Http/DocumentsDB/Collections/Indexes/Delete.php | 1 + .../Modules/Databases/Http/DocumentsDB/Collections/Update.php | 1 + .../Platform/Modules/Databases/Http/DocumentsDB/Create.php | 1 + .../Platform/Modules/Databases/Http/DocumentsDB/Delete.php | 1 + .../Platform/Modules/Databases/Http/DocumentsDB/Update.php | 1 + src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php | 1 + src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Email/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Email/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Enum/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Enum/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Float/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Float/Update.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Integer/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Integer/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Line/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Line/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Point/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Point/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php | 1 + .../Http/TablesDB/Tables/Columns/Relationship/Create.php | 1 + .../Http/TablesDB/Tables/Columns/Relationship/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/String/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/String/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Text/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Text/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/URL/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/URL/Update.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php | 1 + .../Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php | 1 + .../Platform/Modules/Databases/Http/TablesDB/Tables/Create.php | 1 + .../Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php | 1 + .../Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php | 1 + .../Databases/Http/TablesDB/Tables/Rows/Column/Increment.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Rows/Create.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Rows/Update.php | 1 + .../Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php | 1 + .../Platform/Modules/Databases/Http/TablesDB/Tables/Update.php | 1 + src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php | 1 + .../Modules/Databases/Http/VectorsDB/Collections/Create.php | 1 + .../Modules/Databases/Http/VectorsDB/Collections/Delete.php | 1 + .../Http/VectorsDB/Collections/Documents/Bulk/Delete.php | 1 + .../Http/VectorsDB/Collections/Documents/Bulk/Update.php | 1 + .../Http/VectorsDB/Collections/Documents/Bulk/Upsert.php | 1 + .../Databases/Http/VectorsDB/Collections/Documents/Create.php | 1 + .../Databases/Http/VectorsDB/Collections/Documents/Delete.php | 1 + .../Databases/Http/VectorsDB/Collections/Documents/Update.php | 1 + .../Databases/Http/VectorsDB/Collections/Documents/Upsert.php | 1 + .../Databases/Http/VectorsDB/Collections/Indexes/Create.php | 1 + .../Databases/Http/VectorsDB/Collections/Indexes/Delete.php | 1 + .../Modules/Databases/Http/VectorsDB/Collections/Update.php | 1 + .../Platform/Modules/Databases/Http/VectorsDB/Create.php | 1 + .../Platform/Modules/Databases/Http/VectorsDB/Delete.php | 1 + .../Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php | 1 + .../Platform/Modules/Databases/Http/VectorsDB/Update.php | 1 + .../Platform/Modules/Functions/Http/Deployments/Create.php | 1 + .../Platform/Modules/Functions/Http/Deployments/Delete.php | 1 + .../Modules/Functions/Http/Deployments/Duplicate/Create.php | 1 + .../Modules/Functions/Http/Deployments/Status/Update.php | 1 + .../Modules/Functions/Http/Deployments/Template/Create.php | 1 + .../Platform/Modules/Functions/Http/Deployments/Vcs/Create.php | 1 + .../Platform/Modules/Functions/Http/Executions/Create.php | 1 + .../Platform/Modules/Functions/Http/Executions/Delete.php | 1 + .../Platform/Modules/Functions/Http/Functions/Create.php | 1 + .../Platform/Modules/Functions/Http/Functions/Delete.php | 1 + .../Modules/Functions/Http/Functions/Deployment/Update.php | 1 + .../Platform/Modules/Functions/Http/Functions/Update.php | 1 + .../Platform/Modules/Functions/Http/Variables/Create.php | 1 + .../Platform/Modules/Functions/Http/Variables/Delete.php | 1 + .../Platform/Modules/Functions/Http/Variables/Update.php | 1 + .../Platform/Modules/Migrations/Http/Migrations/Delete.php | 1 + .../Platform/Modules/Migrations/Http/Migrations/Update.php | 1 + .../Platform/Modules/Organization/Http/Projects/Create.php | 1 + .../Platform/Modules/Organization/Http/Projects/Delete.php | 1 + .../Platform/Modules/Organization/Http/Projects/Update.php | 1 + src/Appwrite/Platform/Modules/Presences/HTTP/Delete.php | 1 + src/Appwrite/Platform/Modules/Presences/HTTP/Update.php | 1 + src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php | 1 + .../Platform/Modules/Project/Http/Project/AuthMethods/Update.php | 1 + src/Appwrite/Platform/Modules/Project/Http/Project/Delete.php | 1 + .../Platform/Modules/Project/Http/Project/Keys/Create.php | 1 + .../Platform/Modules/Project/Http/Project/Keys/Delete.php | 1 + .../Modules/Project/Http/Project/Keys/Ephemeral/Create.php | 1 + .../Platform/Modules/Project/Http/Project/Keys/Update.php | 1 + .../Platform/Modules/Project/Http/Project/Labels/Update.php | 1 + .../Platform/Modules/Project/Http/Project/MockPhone/Create.php | 1 + .../Platform/Modules/Project/Http/Project/MockPhone/Delete.php | 1 + .../Platform/Modules/Project/Http/Project/MockPhone/Update.php | 1 + .../Modules/Project/Http/Project/OAuth2/Apple/Update.php | 1 + .../Modules/Project/Http/Project/OAuth2/Auth0/Update.php | 1 + .../Modules/Project/Http/Project/OAuth2/Authentik/Update.php | 1 + .../Platform/Modules/Project/Http/Project/OAuth2/Base.php | 1 + .../Modules/Project/Http/Project/OAuth2/FusionAuth/Update.php | 1 + .../Modules/Project/Http/Project/OAuth2/Gitlab/Update.php | 1 + .../Modules/Project/Http/Project/OAuth2/Google/Update.php | 1 + .../Modules/Project/Http/Project/OAuth2/Keycloak/Update.php | 1 + .../Modules/Project/Http/Project/OAuth2/Microsoft/Update.php | 1 + .../Platform/Modules/Project/Http/Project/OAuth2/Oidc/Update.php | 1 + .../Platform/Modules/Project/Http/Project/OAuth2/Okta/Update.php | 1 + .../Modules/Project/Http/Project/Platforms/Android/Create.php | 1 + .../Modules/Project/Http/Project/Platforms/Android/Update.php | 1 + .../Modules/Project/Http/Project/Platforms/Apple/Create.php | 1 + .../Modules/Project/Http/Project/Platforms/Apple/Update.php | 1 + .../Platform/Modules/Project/Http/Project/Platforms/Delete.php | 1 + .../Modules/Project/Http/Project/Platforms/Linux/Create.php | 1 + .../Modules/Project/Http/Project/Platforms/Linux/Update.php | 1 + .../Modules/Project/Http/Project/Platforms/Web/Create.php | 1 + .../Modules/Project/Http/Project/Platforms/Web/Update.php | 1 + .../Modules/Project/Http/Project/Platforms/Windows/Create.php | 1 + .../Modules/Project/Http/Project/Platforms/Windows/Update.php | 1 + .../Project/Http/Project/Policies/MembershipPrivacy/Update.php | 1 + .../Project/Http/Project/Policies/PasswordDictionary/Update.php | 1 + .../Project/Http/Project/Policies/PasswordHistory/Update.php | 1 + .../Http/Project/Policies/PasswordPersonalData/Update.php | 1 + .../Project/Http/Project/Policies/PasswordStrength/Update.php | 1 + .../Project/Http/Project/Policies/SessionAlert/Update.php | 1 + .../Project/Http/Project/Policies/SessionDuration/Update.php | 1 + .../Project/Http/Project/Policies/SessionInvalidation/Update.php | 1 + .../Project/Http/Project/Policies/SessionLimit/Update.php | 1 + .../Modules/Project/Http/Project/Policies/UserLimit/Update.php | 1 + .../Platform/Modules/Project/Http/Project/Protocols/Update.php | 1 + .../Platform/Modules/Project/Http/Project/SMTP/Update.php | 1 + .../Platform/Modules/Project/Http/Project/Services/Update.php | 1 + .../Modules/Project/Http/Project/Templates/Email/Update.php | 1 + .../Platform/Modules/Project/Http/Project/Variables/Create.php | 1 + .../Platform/Modules/Project/Http/Project/Variables/Delete.php | 1 + .../Platform/Modules/Project/Http/Project/Variables/Update.php | 1 + src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php | 1 + src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php | 1 + src/Appwrite/Platform/Modules/Projects/Http/Schedules/Create.php | 1 + src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php | 1 + src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php | 1 + .../Platform/Modules/Proxy/Http/Rules/Function/Create.php | 1 + .../Platform/Modules/Proxy/Http/Rules/Redirect/Create.php | 1 + src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php | 1 + src/Appwrite/Platform/Modules/Proxy/Http/Rules/Status/Update.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php | 1 + .../Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php | 1 + .../Platform/Modules/Sites/Http/Deployments/Status/Update.php | 1 + .../Platform/Modules/Sites/Http/Deployments/Template/Create.php | 1 + .../Platform/Modules/Sites/Http/Deployments/Vcs/Create.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php | 1 + .../Platform/Modules/Sites/Http/Sites/Deployment/Update.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php | 1 + src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php | 1 + src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php | 1 + src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php | 1 + .../Platform/Modules/Storage/Http/Buckets/Files/Create.php | 1 + .../Platform/Modules/Storage/Http/Buckets/Files/Delete.php | 1 + .../Platform/Modules/Storage/Http/Buckets/Files/Update.php | 1 + src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php | 1 + src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php | 1 + src/Appwrite/Platform/Modules/Teams/Http/Memberships/Delete.php | 1 + .../Platform/Modules/Teams/Http/Memberships/Status/Update.php | 1 + src/Appwrite/Platform/Modules/Teams/Http/Memberships/Update.php | 1 + src/Appwrite/Platform/Modules/Teams/Http/Preferences/Update.php | 1 + src/Appwrite/Platform/Modules/Teams/Http/Teams/Create.php | 1 + src/Appwrite/Platform/Modules/Teams/Http/Teams/Delete.php | 1 + src/Appwrite/Platform/Modules/Teams/Http/Teams/Name/Update.php | 1 + .../Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php | 1 + src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php | 1 + src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php | 1 + src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php | 1 + src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Delete.php | 1 + .../Platform/Modules/Webhooks/Http/Webhooks/Secret/Update.php | 1 + src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php | 1 + 268 files changed, 268 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Create.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Create.php index 6aa13e4cd0..cdf8828ab3 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Create.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Create.php @@ -42,6 +42,7 @@ class Create extends Action ->label('scope', 'account') ->label('audits.event', 'user.update') ->label('audits.resource', 'user/{response.$id}') + ->label('usage.resource', 'user/{response.$id}') ->label('audits.userId', '{response.$id}') ->label('sdk', [ new Method( diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Delete.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Delete.php index ce0e8d266e..44bbdfd702 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Delete.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Delete.php @@ -39,6 +39,7 @@ class Delete extends Action ->label('scope', 'account') ->label('audits.event', 'user.update') ->label('audits.resource', 'user/{user.$id}') + ->label('usage.resource', 'user/{user.$id}') ->label('audits.userId', '{user.$id}') ->label('sdk', [ new Method( diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Update.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Update.php index 11f044b507..0bcfcfb7ba 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Update.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Authenticators/Update.php @@ -41,6 +41,7 @@ class Update extends Action ->label('scope', 'account') ->label('audits.event', 'user.update') ->label('audits.resource', 'user/{response.$id}') + ->label('usage.resource', 'user/{response.$id}') ->label('audits.userId', '{response.$id}') ->label('sdk', [ new Method( diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php index da6055fffd..aae9bcfcd0 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Create.php @@ -57,6 +57,7 @@ class Create extends Action ->label('event', 'users.[userId].challenges.[challengeId].create') ->label('audits.event', 'challenge.create') ->label('audits.resource', 'user/{response.userId}') + ->label('usage.resource', 'user/{response.userId}') ->label('audits.userId', '{response.userId}') ->label('sdk', [ new Method( diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Update.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Update.php index 5f6b7a1186..3e16aab2ab 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Update.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Challenges/Update.php @@ -40,6 +40,7 @@ class Update extends Action ->label('event', 'users.[userId].sessions.[sessionId].create') ->label('audits.event', 'challenges.update') ->label('audits.resource', 'user/{response.userId}') + ->label('usage.resource', 'user/{response.userId}') ->label('audits.userId', '{response.userId}') ->label('sdk', [ new Method( diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Create.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Create.php index 0d1191aaea..7d7c1d8e75 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Create.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Create.php @@ -36,6 +36,7 @@ class Create extends Action ->label('scope', 'account') ->label('audits.event', 'user.update') ->label('audits.resource', 'user/{response.$id}') + ->label('usage.resource', 'user/{response.$id}') ->label('audits.userId', '{response.$id}') ->label('sdk', [ new Method( diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Update.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Update.php index 40051cfebc..5d7570e61e 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Update.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/RecoveryCodes/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('scope', 'account') ->label('audits.event', 'user.update') ->label('audits.resource', 'user/{response.$id}') + ->label('usage.resource', 'user/{response.$id}') ->label('audits.userId', '{response.$id}') ->label('sdk', [ new Method( diff --git a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Update.php b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Update.php index a578149654..6842e99d4e 100644 --- a/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Update.php +++ b/src/Appwrite/Platform/Modules/Account/Http/Account/MFA/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('scope', 'account') ->label('audits.event', 'user.update') ->label('audits.resource', 'user/{response.$id}') + ->label('usage.resource', 'user/{response.$id}') ->label('audits.userId', '{response.$id}') ->label('sdk', new Method( namespace: 'account', diff --git a/src/Appwrite/Platform/Modules/Advisor/Http/Reports/Delete.php b/src/Appwrite/Platform/Modules/Advisor/Http/Reports/Delete.php index 1efc029c17..baa53aa7ca 100644 --- a/src/Appwrite/Platform/Modules/Advisor/Http/Reports/Delete.php +++ b/src/Appwrite/Platform/Modules/Advisor/Http/Reports/Delete.php @@ -38,6 +38,7 @@ class Delete extends Action ->label('resourceType', RESOURCE_TYPE_REPORTS) ->label('audits.event', 'report.delete') ->label('audits.resource', 'report/{request.reportId}') + ->label('usage.resource', 'report/{request.reportId}') ->label('abuse-key', 'projectId:{projectId},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php index 11d3ada810..56fc280bec 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php index 5d8e8bf3a5..0ee43634aa 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/BigInt/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php index 475b43f569..ab664a529b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php @@ -43,6 +43,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php index f55482c408..2812c65bc8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php @@ -42,6 +42,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php index 7a0776751b..2a702bee44 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php @@ -44,6 +44,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php index f059914a3b..43846d1ad4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php index 2808a14088..bbf3d3288e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php @@ -44,6 +44,7 @@ class Delete extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php index 098083bea6..6d4ece9389 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php @@ -44,6 +44,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php index 0322a69250..0df2a4a4b0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php index 602189e881..f8ac680b57 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php index 260f8acb7d..f72e8c8058 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php @@ -44,6 +44,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php index a715b51b5a..e76127dce5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php index 14723d3ecb..1ac40d9ccc 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php index 9a142b1a86..9eb9863bfe 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php @@ -44,6 +44,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php index c34208c080..11b2baf31d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php index 89aefb87e6..4dccbaa38e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php index 3ac6c5dd4f..78de7d2335 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php index d3f82cd109..34a0f76c20 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php @@ -45,6 +45,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php index 6056504659..f308ec61e2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php @@ -44,6 +44,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php index 6dd7492ce9..de69802a6a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php index 6af0578891..d0e1fedb79 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php index 5e49243481..0d9a66aff5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php index 1672131123..30a89e545a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php index 38082b46da..d4c20ea3a8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php @@ -45,6 +45,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php index be272231e4..c0656c96c1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php @@ -44,6 +44,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php index 3063d1938a..82dc8af472 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php @@ -45,6 +45,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php index a5c3cb862b..7a6ffff1ff 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php @@ -44,6 +44,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php index c62b89a633..574495a7d2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php index f173afd4b2..df15b12a6d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php @@ -45,6 +45,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php index a32a3083ab..b1cd839411 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php @@ -48,6 +48,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php index 317d9ee633..34b95eeecb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php @@ -45,6 +45,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php index 8943c05339..b07a96ad9e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php index f86e47f36d..3908488b64 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php index 7338bdbd1d..6b35d7b3b2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php @@ -44,6 +44,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php index f1f612a94f..700f7c1be1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php index e45b3fed28..c68a04fdaa 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php @@ -48,6 +48,7 @@ class Create extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].create') ->label('audits.event', 'attribute.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php index 1aacd92fd5..3609c4130f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php @@ -45,6 +45,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].attributes.[attributeId].update') ->label('audits.event', 'attribute.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 35a6692b88..682ba22e33 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -56,6 +56,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'collection.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{response.$id}') ->label('sdk', new Method( namespace: 'databases', group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php index 532ad23c67..90fdf85300 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php @@ -41,6 +41,7 @@ class Delete extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].delete') ->label('audits.event', 'collection.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'databases', group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php index 48c1802038..785552ddcb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php @@ -52,6 +52,7 @@ class Decrement extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php index 4d4ecc6777..ecef3fa3c2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php @@ -52,6 +52,7 @@ class Increment extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php index 0959acf27c..4390fd60ce 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php @@ -50,6 +50,7 @@ class Delete extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php index bc09c477d8..f85610b153 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php @@ -53,6 +53,7 @@ class Update extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php index 231a2b3a4d..cf483e7139 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php @@ -50,6 +50,7 @@ class Upsert extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php index 676ff46a91..6d281cd807 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php @@ -67,6 +67,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php index 55be2373a6..17cd5b620b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php @@ -51,6 +51,7 @@ class Delete extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].documents.[documentId].delete') ->label('audits.event', 'document.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{request.documentId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{request.documentId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php index 1c51e38e2e..54fdfc8a5b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php @@ -43,6 +43,7 @@ class Get extends Action ->groups(['api', 'database']) ->label('scope', 'documents.read') ->label('resourceType', RESOURCE_TYPE_DATABASES) + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{request.documentId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php index 7c80a578ff..914a8cc6a9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php @@ -53,6 +53,7 @@ class Update extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php index 73fcf35b7b..a9f4c5eb0a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php @@ -54,6 +54,7 @@ class Upsert extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.upsert') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php index fd1d5b53d4..c7e3c18db6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php @@ -51,6 +51,7 @@ class XList extends Action ->groups(['api', 'database']) ->label('scope', 'documents.read') ->label('resourceType', RESOURCE_TYPE_DATABASES) + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/documents') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index 2a2fffcc07..3ba3a4b0b2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -52,6 +52,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'index.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php index f88f833764..b982cd4c80 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php @@ -47,6 +47,7 @@ class Delete extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].indexes.[indexId].update') ->label('audits.event', 'index.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php index 6ba8b67bd4..5e4bcc1226 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php @@ -44,6 +44,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].collections.[collectionId].update') ->label('audits.event', 'collection.update') ->label('audits.resource', 'database/{request.databaseId}/collections/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collections/{request.collectionId}') ->label('sdk', new Method( namespace: 'databases', group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php index 870ee4116e..09b1c274ec 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php @@ -147,6 +147,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'database.create') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', [ new Method( namespace: 'databases', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php index 6394e2667e..bbdd172e0c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php @@ -35,6 +35,7 @@ class Delete extends Action ->label('event', 'databases.[databaseId].delete') ->label('audits.event', 'database.delete') ->label('audits.resource', 'database/{request.databaseId}') + ->label('usage.resource', 'database/{request.databaseId}') ->label('sdk', [ new Method( namespace: 'databases', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php index c681d0b3f3..c6373757be 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'databases.[databaseId].update') ->label('audits.event', 'database.update') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', [ new Method( namespace: 'databases', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php index d1e91addf7..090a39ef2c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php @@ -43,6 +43,7 @@ class Create extends CollectionCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'collections.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{response.$id}') ->label('sdk', new Method( namespace: 'documentsDB', group: 'collections', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php index 043f74998d..07c14b5bc3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php @@ -35,6 +35,7 @@ class Delete extends CollectionDelete ->label('event', 'databases.[databaseId].collections.[collectionId].delete') ->label('audits.event', 'collection.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'documentsDB', group: 'collections', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php index 6d986fc6b1..44c67e4451 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php @@ -37,6 +37,7 @@ class Decrement extends DecrementDocumentAttribute ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php index 09def76941..81cbeb303f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php @@ -37,6 +37,7 @@ class Increment extends IncrementDocumentAttribute ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php index 6b2910aac4..fcc32ca6f3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php @@ -36,6 +36,7 @@ class Delete extends DocumentsDelete ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php index f395d0b490..a40a3b42fb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php @@ -37,6 +37,7 @@ class Update extends DocumentsUpdate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php index 5acc4626af..b996f8f036 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php @@ -36,6 +36,7 @@ class Upsert extends DocumentsUpsert ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php index 2df96958ad..b4a2816ba3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php @@ -51,6 +51,7 @@ class Create extends DocumentCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php index 0253c287aa..b0aa5eb218 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php @@ -41,6 +41,7 @@ class Delete extends DocumentDelete ->label('event', 'databases.[databaseId].collections.[collectionId].documents.[documentId].delete') ->label('audits.event', 'document.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{request.documentId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{request.documentId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php index 9e79bb5464..e62b62d801 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php @@ -38,6 +38,7 @@ class Update extends DocumentUpdate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php index 448c2d44bc..017935aec1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php @@ -38,6 +38,7 @@ class Upsert extends DocumentUpsert ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.upsert') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php index 65002e2f30..eb5f329734 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php @@ -42,6 +42,7 @@ class Create extends IndexCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'index.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'documentsDB', group: $this->getSdkGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php index 1e3c012b4f..39082c5bb5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Delete.php @@ -40,6 +40,7 @@ class Delete extends IndexDelete ->label('event', 'databases.[databaseId].collections.[collectionId].indexes.[indexId].update') ->label('audits.event', 'index.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'documentsDB', group: $this->getSdkGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php index 3acedc0379..8624cd6d61 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php @@ -38,6 +38,7 @@ class Update extends CollectionUpdate ->label('event', 'databases.[databaseId].collections.[collectionId].update') ->label('audits.event', 'collection.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'documentsDB', group: 'collections', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Create.php index f9b425b3e6..5dadeb738c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Create.php @@ -33,6 +33,7 @@ class Create extends DatabaseCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'database.create') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', new Method( namespace: 'documentsDB', group: 'documentsdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Delete.php index 5e63ab8a7f..d79fa3460a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Delete.php @@ -31,6 +31,7 @@ class Delete extends DatabaseDelete ->label('event', 'databases.[databaseId].delete') ->label('audits.event', 'database.delete') ->label('audits.resource', 'database/{request.databaseId}') + ->label('usage.resource', 'database/{request.databaseId}') ->label('sdk', new Method( namespace: 'documentsDB', group: 'documentsdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Update.php index 4bf5747b54..da8a14ffc7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Update.php @@ -33,6 +33,7 @@ class Update extends DatabaseUpdate ->label('event', 'databases.[databaseId].update') ->label('audits.event', 'database.update') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', new Method( namespace: 'documentsDB', group: 'documentsdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php index eb2293dc28..996351c062 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php @@ -33,6 +33,7 @@ class Create extends DatabaseCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'database.create') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', new Method( namespace: 'tablesDB', group: 'tablesdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php index 70dc8430f2..7d0d8953cd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php @@ -31,6 +31,7 @@ class Delete extends DatabaseDelete ->label('event', 'databases.[databaseId].delete') ->label('audits.event', 'database.delete') ->label('audits.resource', 'database/{request.databaseId}') + ->label('usage.resource', 'database/{request.databaseId}') ->label('sdk', new Method( namespace: 'tablesDB', group: 'tablesdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php index 9d882e09a6..0cabf0db82 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Create.php @@ -39,6 +39,7 @@ class Create extends BigIntCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php index b2754a2b7d..b0e6ff9dbd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/BigInt/Update.php @@ -40,6 +40,7 @@ class Update extends BigIntUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php index 334c8b5124..8319d969f3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php @@ -38,6 +38,7 @@ class Create extends BooleanCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php index 1e0fe04bdc..a0d1106a51 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php @@ -39,6 +39,7 @@ class Update extends BooleanUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php index 922e071f35..912726c60e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php @@ -39,6 +39,7 @@ class Create extends DatetimeCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php index c4ff9055fb..be53844c29 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php @@ -40,6 +40,7 @@ class Update extends DatetimeUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php index 8e0abf211f..8d79304d65 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php @@ -38,6 +38,7 @@ class Delete extends AttributesDelete ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.delete') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php index 072e334b4b..3e7e30a382 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php @@ -39,6 +39,7 @@ class Create extends EmailCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php index c116d8c5b1..579834d1bf 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php @@ -40,6 +40,7 @@ class Update extends EmailUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php index 9d24f310bd..77cf1ff42c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php @@ -40,6 +40,7 @@ class Create extends EnumCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php index 208fa9c8cf..f9a3333b55 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php @@ -41,6 +41,7 @@ class Update extends EnumUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php index d68b3a4921..930d612aa9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php @@ -39,6 +39,7 @@ class Create extends FloatCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php index 9ab61e642b..35d6eee993 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php @@ -40,6 +40,7 @@ class Update extends FloatUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php index ff5828e749..cd3bfe1537 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php @@ -39,6 +39,7 @@ class Create extends IPCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php index dcc4160580..3d5cbe2b23 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php @@ -40,6 +40,7 @@ class Update extends IPUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php index dec399cdb2..bb50426c7a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php @@ -39,6 +39,7 @@ class Create extends IntegerCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php index 58dea7c848..4e8e1db70c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php @@ -40,6 +40,7 @@ class Update extends IntegerUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php index 71548c74da..2277c8ef62 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php @@ -39,6 +39,7 @@ class Create extends LineCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php index e2e8c59121..82dcbb9a56 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php @@ -40,6 +40,7 @@ class Update extends LineUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php index ec0f633400..0418c0fe0f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php @@ -38,6 +38,7 @@ class Create extends LongtextCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php index 9b90b745a2..aecbcea09f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php @@ -39,6 +39,7 @@ class Update extends LongtextUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php index 2728caa58f..baf3c3964f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php @@ -38,6 +38,7 @@ class Create extends MediumtextCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php index 03009da25c..f87aacb2e6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php @@ -39,6 +39,7 @@ class Update extends MediumtextUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php index 601e19299b..c1489b0683 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php @@ -39,6 +39,7 @@ class Create extends PointCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php index 66fb451a1f..81455b32b0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php @@ -40,6 +40,7 @@ class Update extends PointUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php index 36972d5da2..7711e903af 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php @@ -39,6 +39,7 @@ class Create extends PolygonCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php index 7a2fd8a5de..d36bb12555 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php @@ -40,6 +40,7 @@ class Update extends PolygonUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php index db8b17473c..3055a80743 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php @@ -40,6 +40,7 @@ class Create extends RelationshipCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php index 0ec8f4ba07..9619ae01e0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php @@ -40,6 +40,7 @@ class Update extends RelationshipUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php index 8151b3e8da..052c723fb8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php @@ -42,6 +42,7 @@ class Create extends StringCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php index 2ec806d4fe..39fc773fd9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php @@ -42,6 +42,7 @@ class Update extends StringUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php index bffdc96001..aa1a5cdd70 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php @@ -38,6 +38,7 @@ class Create extends TextCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php index 4c1477fb9e..16017b884b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php @@ -39,6 +39,7 @@ class Update extends TextUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php index 2edf4a62f6..d506bac1b7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php @@ -39,6 +39,7 @@ class Create extends URLCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php index d680389d9e..14949135ee 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php @@ -40,6 +40,7 @@ class Update extends URLUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php index 307a1fd5e3..c51b0c7566 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php @@ -40,6 +40,7 @@ class Create extends VarcharCreate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].create') ->label('audits.event', 'column.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php index dd170a0a19..315836880b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php @@ -41,6 +41,7 @@ class Update extends VarcharUpdate ->label('event', 'databases.[databaseId].tables.[tableId].columns.[columnId].update') ->label('audits.event', 'column.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php index 48f1136b09..643ab1909c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php @@ -43,6 +43,7 @@ class Create extends CollectionCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'table.create') ->label('audits.resource', 'database/{request.databaseId}/table/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/table/{response.$id}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: 'tables', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php index 3a6d6666f2..3e380daa13 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php @@ -36,6 +36,7 @@ class Delete extends CollectionDelete ->label('event', 'databases.[databaseId].tables.[tableId].delete') ->label('audits.event', 'table.delete') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: 'tables', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php index d6c2bf29f3..1ebc0664db 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php @@ -42,6 +42,7 @@ class Create extends IndexCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'index.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php index 6cd5cfe78f..fa7ffc9954 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php @@ -41,6 +41,7 @@ class Delete extends IndexDelete ->label('event', 'databases.[databaseId].tables.[tableId].indexes.[indexId].update') ->label('audits.event', 'index.delete') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: $this->getSDKGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php index 8315a8d04b..42e49db646 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php @@ -38,6 +38,7 @@ class Delete extends DocumentsDelete ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'rows.delete') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php index a31ebc15e0..bc15c0e22b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php @@ -39,6 +39,7 @@ class Update extends DocumentsUpdate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'rows.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php index 543de8c4bc..e9edf8deb1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php @@ -38,6 +38,7 @@ class Upsert extends DocumentsUpsert ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'row.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php index ea1bfa163d..f6174ec518 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php @@ -39,6 +39,7 @@ class Decrement extends DecrementDocumentAttribute ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'rows.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php index 2f8be876d7..36761c44a7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php @@ -39,6 +39,7 @@ class Increment extends IncrementDocumentAttribute ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'rows.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php index ea9e3e0b03..36cf0485a6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php @@ -46,6 +46,7 @@ class Create extends DocumentCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'row.create') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php index 06aee2cb30..12b8ba510c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php @@ -43,6 +43,7 @@ class Delete extends DocumentDelete ->label('event', 'databases.[databaseId].tables.[tableId].rows.[rowId].delete') ->label('audits.event', 'row.delete') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}/row/{request.rowId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}/row/{request.rowId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php index 93ec5d3b58..817125b3eb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php @@ -39,6 +39,7 @@ class Update extends DocumentUpdate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'row.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}/row/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}/row/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php index 472a49cf64..52f12a9337 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php @@ -39,6 +39,7 @@ class Upsert extends DocumentUpsert ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'row.upsert') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}/row/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}/row/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php index d10380a0e8..fb60ac19cb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php @@ -40,6 +40,7 @@ class Update extends CollectionUpdate ->label('event', 'databases.[databaseId].tables.[tableId].update') ->label('audits.event', 'table.update') ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSDKNamespace(), group: 'tables', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php index e5e6fa6f34..d72a3326be 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php @@ -33,6 +33,7 @@ class Update extends DatabaseUpdate ->label('event', 'databases.[databaseId].update') ->label('audits.event', 'database.update') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', new Method( namespace: 'tablesDB', group: 'tablesdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php index 49de7f7cc5..ff175e03d9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php @@ -52,6 +52,7 @@ class Create extends CollectionAction ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'collection.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{response.$id}') ->label('sdk', new Method( namespace: 'vectorsDB', group: 'collections', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Delete.php index 6ee83b2530..0b289cadf0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Delete.php @@ -35,6 +35,7 @@ class Delete extends CollectionDelete ->label('event', 'databases.[databaseId].collections.[collectionId].delete') ->label('audits.event', 'collection.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'vectorsDB', group: 'collections', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Delete.php index 4c7d97aa55..d5a9a44f13 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Delete.php @@ -36,6 +36,7 @@ class Delete extends DocumentsDelete ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Update.php index 18e441ede7..2734e5d002 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Update.php @@ -37,6 +37,7 @@ class Update extends DocumentsUpdate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'documents.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Upsert.php index c26e61d716..d0ac2a2ba6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Bulk/Upsert.php @@ -36,6 +36,7 @@ class Upsert extends DocumentsUpsert ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Create.php index dee8d8e85f..c771d61fa3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Create.php @@ -45,6 +45,7 @@ class Create extends DocumentCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Delete.php index e81e34e1e5..653e032a69 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Delete.php @@ -41,6 +41,7 @@ class Delete extends DocumentDelete ->label('event', 'databases.[databaseId].collections.[collectionId].documents.[documentId].delete') ->label('audits.event', 'document.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{request.documentId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{request.documentId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Update.php index 8a8b9d89ae..1e9d6a24e4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Update.php @@ -38,6 +38,7 @@ class Update extends DocumentUpdate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Upsert.php index f8f17d33d9..a7125db2a7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Documents/Upsert.php @@ -39,6 +39,7 @@ class Upsert extends DocumentUpsert ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'document.upsert') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}/document/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT * 2) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php index e7e8c8cb1f..f7b05690dd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Create.php @@ -42,6 +42,7 @@ class Create extends IndexCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'index.create') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.tableId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.tableId}') ->label('sdk', new Method( namespace: 'vectorsDB', group: $this->getSdkGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php index 67e13dd26a..c780fb928e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Indexes/Delete.php @@ -40,6 +40,7 @@ class Delete extends IndexDelete ->label('event', 'databases.[databaseId].collections.[collectionId].indexes.[indexId].update') ->label('audits.event', 'index.delete') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'vectorsDB', group: $this->getSdkGroup(), diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php index 12b680496a..d4f70707d0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Update.php @@ -44,6 +44,7 @@ class Update extends CollectionAction ->label('event', 'databases.[databaseId].collections.[collectionId].update') ->label('audits.event', 'collection.update') ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') + ->label('usage.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'vectorsDB', group: 'collections', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Create.php index cc2914fc10..15a60df913 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Create.php @@ -32,6 +32,7 @@ class Create extends DatabaseCreate ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'database.create') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', new Method( namespace: 'vectorsDB', group: 'vectorsdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Delete.php index a33eedccd5..3da226560f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Delete.php @@ -30,6 +30,7 @@ class Delete extends DatabaseDelete ->label('event', 'databases.[databaseId].delete') ->label('audits.event', 'database.delete') ->label('audits.resource', 'database/{request.databaseId}') + ->label('usage.resource', 'database/{request.databaseId}') ->label('sdk', new Method( namespace: 'vectorsDB', group: 'vectorsdb', diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php index 6cf2f47910..4ab3edeb70 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php @@ -50,6 +50,7 @@ class Create extends CreateDocumentAction ->label('resourceType', RESOURCE_TYPE_EMBEDDINGS_TEXT) ->label('audits.event', 'embedding.create') ->label('audits.resource', 'vectorsdb/embeddings/text') + ->label('usage.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) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Update.php index 0b10d6d98b..f35ffb7139 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Update.php @@ -32,6 +32,7 @@ class Update extends DatabaseUpdate ->label('event', 'databases.[databaseId].update') ->label('audits.event', 'database.update') ->label('audits.resource', 'database/{response.$id}') + ->label('usage.resource', 'database/{response.$id}') ->label('sdk', new Method( namespace: 'vectorsDB', group: 'vectorsdb', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index 0269c3df19..fbc07bb89b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -55,6 +55,7 @@ class Create extends Action ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('audits.event', 'deployment.create') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php index 6862b0d776..0f26d518d3 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php @@ -41,6 +41,7 @@ class Delete extends Action ->label('event', 'functions.[functionId].deployments.[deploymentId].delete') ->label('audits.event', 'deployment.delete') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php index 93f34ebb05..9b344b749f 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -41,6 +41,7 @@ class Create extends Action ->label('event', 'functions.[functionId].deployments.[deploymentId].update') ->label('audits.event', 'deployment.update') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php index 85d93c14c1..e0f60e40cc 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php @@ -38,6 +38,7 @@ class Update extends Action ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('audits.event', 'deployment.update') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php index 136549e9c9..e710da13cc 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -48,6 +48,7 @@ class Create extends Base ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('audits.event', 'deployment.create') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php index 4a9ae4051f..c3d9fbdfae 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php @@ -43,6 +43,7 @@ class Create extends Base ->label('event', 'functions.[functionId].deployments.[deploymentId].create') ->label('audits.event', 'deployment.create') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 2c2b03a204..639b9ae2aa 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -66,6 +66,7 @@ class Create extends Base ->label('scope', ['executions.write', 'execution.write']) ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('event', 'functions.[functionId].executions.[executionId].create') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'executions', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php index 9ecb5c0bf0..227793f264 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php @@ -40,6 +40,7 @@ class Delete extends Base ->label('event', 'functions.[functionId].executions.[executionId].delete') ->label('audits.event', 'executions.delete') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'executions', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 48818dd3ec..5222cba0b0 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -64,6 +64,7 @@ class Create extends Base ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('audits.event', 'function.create') ->label('audits.resource', 'function/{response.$id}') + ->label('usage.resource', 'function/{response.$id}') ->label('sdk', new Method( namespace: 'functions', group: 'functions', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php index 1517ee7793..cf7ce831ae 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php @@ -41,6 +41,7 @@ class Delete extends Base ->label('event', 'functions.[functionId].delete') ->label('audits.event', 'function.delete') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'functions', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index 6b6eda36ab..dd5e576f02 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -40,6 +40,7 @@ class Update extends Base ->label('event', 'functions.[functionId].deployments.[deploymentId].update') ->label('audits.event', 'deployment.update') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'functions', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index f23f4bd678..f45a762708 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -56,6 +56,7 @@ class Update extends Base ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('audits.event', 'function.update') ->label('audits.resource', 'function/{response.$id}') + ->label('usage.resource', 'function/{response.$id}') ->label('sdk', new Method( namespace: 'functions', group: 'functions', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php index de572cd41e..c1852ea377 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php @@ -43,6 +43,7 @@ class Create extends Base ->label('event', 'variables.[variableId].create') ->label('audits.event', 'variable.create') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php index fa9f19ba8f..3605f3089e 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php @@ -39,6 +39,7 @@ class Delete extends Base ->label('event', 'variables.[variableId].delete') ->label('audits.event', 'variable.delete') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php index 6413b29f82..6cf99017b3 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php @@ -42,6 +42,7 @@ class Update extends Base ->label('event', 'variables.[variableId].update') ->label('audits.event', 'variable.update') ->label('audits.resource', 'function/{request.functionId}') + ->label('usage.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Delete.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Delete.php index f9c989b5bf..daad2bf634 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Delete.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Delete.php @@ -34,6 +34,7 @@ class Delete extends Action ->label('event', 'migrations.[migrationId].delete') ->label('audits.event', 'migrationId.delete') ->label('audits.resource', 'migrations/{request.migrationId}') + ->label('usage.resource', 'migrations/{request.migrationId}') ->label('sdk', new Method( namespace: 'migrations', group: null, diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Update.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Update.php index 8ecc53c2a3..b900b6586b 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Update.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'migrations.[migrationId].retry') ->label('audits.event', 'migration.retry') ->label('audits.resource', 'migrations/{request.migrationId}') + ->label('usage.resource', 'migrations/{request.migrationId}') ->label('sdk', new Method( namespace: 'migrations', group: null, diff --git a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php index 90c3781701..191c09e455 100644 --- a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php @@ -46,6 +46,7 @@ class Create extends Action ->groups(['api', 'organization']) ->label('audits.event', 'projects.create') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('scope', 'projects.write') ->label('sdk', new Method( namespace: 'organization', diff --git a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Delete.php b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Delete.php index fc8d5cccfc..56af8a6b8b 100644 --- a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Delete.php +++ b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Delete.php @@ -35,6 +35,7 @@ class Delete extends Action ->label('scope', 'projects.write') ->label('audits.event', 'projects.delete') ->label('audits.resource', 'project/{request.projectId}') + ->label('usage.resource', 'project/{request.projectId}') ->label('sdk', new Method( namespace: 'organization', group: 'projects', diff --git a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Update.php b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Update.php index c364a5d6df..b178a0c549 100644 --- a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Update.php +++ b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Update.php @@ -33,6 +33,7 @@ class Update extends Action ->label('scope', 'projects.write') ->label('audits.event', 'projects.update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'organization', group: 'projects', diff --git a/src/Appwrite/Platform/Modules/Presences/HTTP/Delete.php b/src/Appwrite/Platform/Modules/Presences/HTTP/Delete.php index 66ab00c3a7..7431efd411 100644 --- a/src/Appwrite/Platform/Modules/Presences/HTTP/Delete.php +++ b/src/Appwrite/Platform/Modules/Presences/HTTP/Delete.php @@ -36,6 +36,7 @@ class Delete extends PlatformAction ->label('event', 'presences.[presenceId].delete') ->label('audits.event', 'presence.delete') ->label('audits.resource', 'presence/{request.presenceId}') + ->label('usage.resource', 'presence/{request.presenceId}') ->label('sdk', new Method( namespace: 'presences', group: 'presences', diff --git a/src/Appwrite/Platform/Modules/Presences/HTTP/Update.php b/src/Appwrite/Platform/Modules/Presences/HTTP/Update.php index cd2f0d5636..2d37818830 100644 --- a/src/Appwrite/Platform/Modules/Presences/HTTP/Update.php +++ b/src/Appwrite/Platform/Modules/Presences/HTTP/Update.php @@ -45,6 +45,7 @@ class Update extends PlatformAction ->label('event', 'presences.[presenceId].update') ->label('audits.event', 'presence.update') ->label('audits.resource', 'presence/{response.$id}') + ->label('usage.resource', 'presence/{response.$id}') ->label('sdk', [ // Client-side SDK: `userId` is not accepted (session callers can only update their own presence). new Method( diff --git a/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php b/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php index 9e691e4647..16bf5458f5 100644 --- a/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php +++ b/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php @@ -46,6 +46,7 @@ class Upsert extends PlatformAction ->label('event', 'presences.[presenceId].upsert') ->label('audits.event', 'presence.upsert') ->label('audits.resource', 'presence/{response.$id}') + ->label('usage.resource', 'presence/{response.$id}') ->label('sdk', [ // Client-side SDK: `userId` is not accepted (session callers should just upsert their own presence). new Method( diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php index f5f0ae0a32..c6bf5a3c7c 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php @@ -38,6 +38,7 @@ class Update extends Action ->label('event', 'authMethod.[methodId].update') ->label('audits.event', 'project.authMethods.[methodId].update') ->label('audits.resource', 'project.authMethods/{response.$id}') + ->label('usage.resource', 'project.authMethods/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: null, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Delete.php index 201061dd62..d84af6b995 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Delete.php @@ -36,6 +36,7 @@ class Delete extends Action ->label('scope', 'project.write') ->label('audits.event', 'project.delete') ->label('audits.resource', 'project/{project.$id}') + ->label('usage.resource', 'project/{project.$id}') ->label('sdk', new Method( namespace: 'project', group: null, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php index 992b3532c4..3b23bb9039 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Create.php @@ -46,6 +46,7 @@ class Create extends Base ->label('event', 'keys.[keyId].create') ->label('audits.event', 'project.key.create') ->label('audits.resource', 'project.key/{response.$id}') + ->label('usage.resource', 'project.key/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'keys', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Delete.php index c5da673e22..2c5e3bc2ed 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Delete.php @@ -38,6 +38,7 @@ class Delete extends Base ->label('event', 'keys.[keyId].delete') ->label('audits.event', 'project.key.delete') ->label('audits.resource', 'project.key/{request.keyId}') + ->label('usage.resource', 'project.key/{request.keyId}') ->label('sdk', new Method( namespace: 'project', group: 'keys', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Ephemeral/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Ephemeral/Create.php index aadf76d74f..314188645c 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Ephemeral/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Ephemeral/Create.php @@ -42,6 +42,7 @@ class Create extends Base ->label('event', 'keys.[keyId].create') ->label('audits.event', 'project.key.create') ->label('audits.resource', 'project.key/{response.$id}') + ->label('usage.resource', 'project.key/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'keys', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php index 0d96bcf315..09d3e639d5 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Keys/Update.php @@ -44,6 +44,7 @@ class Update extends Base ->label('event', 'keys.[keyId].update') ->label('audits.event', 'project.key.update') ->label('audits.resource', 'project.key/{response.$id}') + ->label('usage.resource', 'project.key/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'keys', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php index 8a3506eb13..1647f9febe 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Labels/Update.php @@ -35,6 +35,7 @@ class Update extends Action // ->label('event', 'project.labels.update') ->label('audits.event', 'project.labels.update') ->label('audits.resource', 'project.labels/{response.$id}') + ->label('usage.resource', 'project.labels/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: null, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php index f4002c60ef..4300795d01 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Create.php @@ -37,6 +37,7 @@ class Create extends Action ->label('event', 'mock-phones.[number].create') ->label('audits.event', 'project.mock-phone.create') ->label('audits.resource', 'project.mock-phone/{response.number}') + ->label('usage.resource', 'project.mock-phone/{response.number}') ->label('sdk', new Method( namespace: 'project', group: 'mocks', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php index 0fb23e1764..14b5f662c1 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Delete.php @@ -36,6 +36,7 @@ class Delete extends Action ->label('event', 'mock-phones.[number].delete') ->label('audits.event', 'project.mock-phone.delete') ->label('audits.resource', 'project.mock-phone/{request.number}') + ->label('usage.resource', 'project.mock-phone/{request.number}') ->label('sdk', new Method( namespace: 'project', group: 'mocks', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php index 48b90a1b97..99f27a2fc1 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/MockPhone/Update.php @@ -37,6 +37,7 @@ class Update extends Action ->label('event', 'mock-phones.[number].update') ->label('audits.event', 'project.mock-phone.update') ->label('audits.resource', 'project.mock-phone/{response.number}') + ->label('usage.resource', 'project.mock-phone/{response.number}') ->label('sdk', new Method( namespace: 'project', group: 'mocks', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Apple/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Apple/Update.php index dc9eede2b4..25144643b9 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Apple/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Apple/Update.php @@ -116,6 +116,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Auth0/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Auth0/Update.php index aa5f39b213..51cd34a27d 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Auth0/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Auth0/Update.php @@ -90,6 +90,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Authentik/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Authentik/Update.php index af6b12618a..f02dd540e9 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Authentik/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Authentik/Update.php @@ -90,6 +90,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php index b439e7fdf7..8cbb2549d3 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Base.php @@ -242,6 +242,7 @@ abstract class Base extends Action ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/FusionAuth/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/FusionAuth/Update.php index 3cdf0eeb89..be2038d0c9 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/FusionAuth/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/FusionAuth/Update.php @@ -90,6 +90,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Gitlab/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Gitlab/Update.php index 804f6354ae..3ef25071dd 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Gitlab/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Gitlab/Update.php @@ -101,6 +101,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Google/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Google/Update.php index 5623f2bdf9..9839350e54 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Google/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Google/Update.php @@ -94,6 +94,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Keycloak/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Keycloak/Update.php index aa41e8a5e9..c7dd7ae572 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Keycloak/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Keycloak/Update.php @@ -96,6 +96,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Microsoft/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Microsoft/Update.php index 811819a05c..67be3a8be0 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Microsoft/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Microsoft/Update.php @@ -100,6 +100,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Oidc/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Oidc/Update.php index 697b306be8..6cc170c086 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Oidc/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Oidc/Update.php @@ -110,6 +110,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Okta/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Okta/Update.php index 0344b6a14a..f51311ec23 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Okta/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/OAuth2/Okta/Update.php @@ -98,6 +98,7 @@ class Update extends Base ->label('event', 'oauth2.[providerId].update') ->label('audits.event', 'project.oauth2.[providerId].update') ->label('audits.resource', 'project.oauth2/{response.$id}') + ->label('usage.resource', 'project.oauth2/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'oauth2', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Create.php index accc6d5b35..94078072e1 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Create.php @@ -39,6 +39,7 @@ class Create extends Action ->label('event', 'platforms.[platformId].create') ->label('audits.event', 'project.platform.create') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Update.php index 3ff958e814..9b368fd849 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Android/Update.php @@ -37,6 +37,7 @@ class Update extends Action ->label('event', 'platforms.[platformId].update') ->label('audits.event', 'project.platform.update') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Create.php index 0843bf9a0c..b66687bf0c 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Create.php @@ -39,6 +39,7 @@ class Create extends Action ->label('event', 'platforms.[platformId].create') ->label('audits.event', 'project.platform.create') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Update.php index 0295075f19..02c5c226f8 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Apple/Update.php @@ -37,6 +37,7 @@ class Update extends Action ->label('event', 'platforms.[platformId].update') ->label('audits.event', 'project.platform.update') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Delete.php index 24669b02b2..d580aa7c8e 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Delete.php @@ -37,6 +37,7 @@ class Delete extends Action ->label('event', 'platforms.[platformId].delete') ->label('audits.event', 'project.platform.delete') ->label('audits.resource', 'project.platform/{request.platformId}') + ->label('usage.resource', 'project.platform/{request.platformId}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Create.php index 472b41cace..b4edf8bcd7 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Create.php @@ -39,6 +39,7 @@ class Create extends Action ->label('event', 'platforms.[platformId].create') ->label('audits.event', 'project.platform.create') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Update.php index 9c1f715c33..47ff114562 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Linux/Update.php @@ -37,6 +37,7 @@ class Update extends Action ->label('event', 'platforms.[platformId].update') ->label('audits.event', 'project.platform.update') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php index 6c07727150..ce9ff52443 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php @@ -47,6 +47,7 @@ class Create extends Action ->label('event', 'platforms.[platformId].create') ->label('audits.event', 'project.platform.create') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php index 62d209ea25..79dc5e8184 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php @@ -39,6 +39,7 @@ class Update extends Action ->label('event', 'platforms.[platformId].update') ->label('audits.event', 'project.platform.update') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Create.php index 58be45d03b..3530c6ed17 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Create.php @@ -39,6 +39,7 @@ class Create extends Action ->label('event', 'platforms.[platformId].create') ->label('audits.event', 'project.platform.create') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Update.php index 5cfb6ee7ea..4d4a371f5e 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Windows/Update.php @@ -37,6 +37,7 @@ class Update extends Action ->label('event', 'platforms.[platformId].update') ->label('audits.event', 'project.platform.update') ->label('audits.resource', 'project.platform/{response.$id}') + ->label('usage.resource', 'project.platform/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'platforms', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index b167aba794..7ca0586e36 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php index d0f8882e99..bd21431793 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php index be611e299f..e1d040de3a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php index ff7819f192..f522368882 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php index 0f8c566511..f76da811ef 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php index d930fd89e7..e79859e9f8 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php index 10eabb57cd..f32aa82f3b 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php index d4d87edbba..68ecb22057 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php index 93ae339b79..541e18f636 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php index b3f430b779..726ca237d2 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('event', 'projects.[projectId].policies.[policy].update') ->label('audits.event', 'projects.[projectId].policies.[policy].update') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'policies', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php index e0e4477a3c..cc7e9e5c7f 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Update.php @@ -39,6 +39,7 @@ class Update extends Action ->label('event', 'protocols.[protocolId].update') ->label('audits.event', 'project.protocols.[protocolId].update') ->label('audits.resource', 'project.protocols/{response.$id}') + ->label('usage.resource', 'project.protocols/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: null, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index dd8a469d26..8879facae4 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -45,6 +45,7 @@ class Update extends Action // ->label('event', 'project.smtp.update') ->label('audits.event', 'project.smtp.update') ->label('audits.resource', 'project.smtp/{response.$id}') + ->label('usage.resource', 'project.smtp/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'smtp', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php index 86ef67bb01..e1e6efd768 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Services/Update.php @@ -39,6 +39,7 @@ class Update extends Action ->label('event', 'services.[serviceId].update') ->label('audits.event', 'project.services.[serviceId].update') ->label('audits.resource', 'project.services/{response.$id}') + ->label('usage.resource', 'project.services/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: null, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php index c8ec04bc76..8e86d7d1e6 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Templates/Email/Update.php @@ -42,6 +42,7 @@ class Update extends Action ->label('event', 'templates.[templateId].update') ->label('audits.event', 'project.template.update') ->label('audits.resource', 'project.template/{response.templateId}') + ->label('usage.resource', 'project.template/{response.templateId}') ->label('sdk', new Method( namespace: 'project', group: 'templates', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php index 8c76ed2a8e..6a4bd033cf 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Create.php @@ -38,6 +38,7 @@ class Create extends Action ->label('event', 'variables.[variableId].create') ->label('audits.event', 'project.variable.create') ->label('audits.resource', 'project.variable/{response.$id}') + ->label('usage.resource', 'project.variable/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Delete.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Delete.php index 553fb09e54..5183bdc68e 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Delete.php @@ -35,6 +35,7 @@ class Delete extends Action ->label('event', 'variables.[variableId].delete') ->label('audits.event', 'project.variable.delete') ->label('audits.resource', 'project.variable/{request.variableId}') + ->label('usage.resource', 'project.variable/{request.variableId}') ->label('sdk', new Method( namespace: 'project', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Update.php index 6b05e19a78..cad912d97c 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Variables/Update.php @@ -37,6 +37,7 @@ class Update extends Action ->label('event', 'variables.[variableId].update') ->label('audits.event', 'project.variable.update') ->label('audits.resource', 'project.variable/{response.$id}') + ->label('usage.resource', 'project.variable/{response.$id}') ->label('sdk', new Method( namespace: 'project', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php index 28405fe1da..b45d0a0aae 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php @@ -51,6 +51,7 @@ class Create extends Action ->groups(['api', 'projects']) ->label('audits.event', 'projects.create') ->label('audits.resource', 'project/{response.$id}') + ->label('usage.resource', 'project/{response.$id}') ->label('scope', 'projects.write') ->param('projectId', '', new ProjectId(), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can\'t start with a special char. Max length is 36 chars.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.') diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php index f6df843d07..0778c51661 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('scope', 'projects.write') ->label('audits.event', 'projects.update') ->label('audits.resource', 'project/{request.projectId}') + ->label('usage.resource', 'project/{request.projectId}') ->param('projectId', '', new UID(), 'Project unique ID.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.') ->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true) diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Schedules/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/Schedules/Create.php index 7cf13c5ca2..3ef3a6bd24 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Schedules/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Schedules/Create.php @@ -72,6 +72,7 @@ class Create extends Action ->label('event', 'schedules.[scheduleId].create') ->label('audits.event', 'schedule.create') ->label('audits.resource', 'schedule/{response.$id}') + ->label('usage.resource', 'schedule/{response.$id}') ->label('sdk', new Method( namespace: 'projects', group: 'schedules', diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php index 9431d24cde..56e5ad4f7c 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -41,6 +41,7 @@ class Create extends Action ->label('event', 'rules.[ruleId].create') ->label('audits.event', 'rule.create') ->label('audits.resource', 'rule/{response.$id}') + ->label('usage.resource', 'rule/{response.$id}') ->label('sdk', new Method( namespace: 'proxy', group: 'rules', diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php index 991b8eb006..3d7fd02fa8 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php @@ -38,6 +38,7 @@ class Delete extends Action ->label('event', 'rules.[ruleId].delete') ->label('audits.event', 'rules.delete') ->label('audits.resource', 'rule/{request.ruleId}') + ->label('usage.resource', 'rule/{request.ruleId}') ->label('sdk', new Method( namespace: 'proxy', group: 'rules', diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index 7cc8b5e59e..24cf52bc0d 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -43,6 +43,7 @@ class Create extends Action ->label('event', 'rules.[ruleId].create') ->label('audits.event', 'rule.create') ->label('audits.resource', 'rule/{response.$id}') + ->label('usage.resource', 'rule/{response.$id}') ->label('sdk', new Method( namespace: 'proxy', group: 'rules', diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index c15bc3b1d9..cfd165d5bd 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -45,6 +45,7 @@ class Create extends Action ->label('event', 'rules.[ruleId].create') ->label('audits.event', 'rule.create') ->label('audits.resource', 'rule/{response.$id}') + ->label('usage.resource', 'rule/{response.$id}') ->label('sdk', new Method( namespace: 'proxy', group: 'rules', diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php index ca45d73e13..43de6b5699 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -43,6 +43,7 @@ class Create extends Action ->label('event', 'rules.[ruleId].create') ->label('audits.event', 'rule.create') ->label('audits.resource', 'rule/{response.$id}') + ->label('usage.resource', 'rule/{response.$id}') ->label('sdk', new Method( namespace: 'proxy', group: 'rules', diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Status/Update.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Status/Update.php index 1ad6f730b3..711681fc67 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Status/Update.php @@ -41,6 +41,7 @@ class Update extends Action ->label('event', 'rules.[ruleId].update') ->label('audits.event', 'rule.update') ->label('audits.resource', 'rule/{response.$id}') + ->label('usage.resource', 'rule/{response.$id}') ->label('sdk', new Method( namespace: 'proxy', group: 'rules', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 253abbb495..79164c4999 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -55,6 +55,7 @@ class Create extends Action ->label('event', 'sites.[siteId].deployments.[deploymentId].create') ->label('audits.event', 'deployment.create') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php index a1ccf6cad5..f847a2a344 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php @@ -41,6 +41,7 @@ class Delete extends Action ->label('event', 'sites.[siteId].deployments.[deploymentId].delete') ->label('audits.event', 'deployment.delete') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index e575fbbf07..b0eb8d343c 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -41,6 +41,7 @@ class Create extends Action ->label('event', 'sites.[siteId].deployments.[deploymentId].update') ->label('audits.event', 'deployment.update') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php index a28a7465e6..c698a2d5f6 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('scope', 'sites.write') ->label('audits.event', 'deployment.update') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php index 2d6b441616..aebac55154 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -49,6 +49,7 @@ class Create extends Base ->label('event', 'sites.[siteId].deployments.[deploymentId].create') ->label('audits.event', 'deployment.create') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php index d4bf42cffe..04ea985a32 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php @@ -44,6 +44,7 @@ class Create extends Base ->label('event', 'sites.[siteId].deployments.[deploymentId].create') ->label('audits.event', 'deployment.create') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'deployments', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php index f5d7265c88..88927b9fb4 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php @@ -35,6 +35,7 @@ class Delete extends Base ->label('event', 'sites.[siteId].logs.[logId].delete') ->label('audits.event', 'logs.delete') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'logs', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php index c5c7c82706..3c51c57420 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -47,6 +47,7 @@ class Create extends Base ->label('event', 'sites.[siteId].create') ->label('audits.event', 'site.create') ->label('audits.resource', 'site/{response.$id}') + ->label('usage.resource', 'site/{response.$id}') ->label('sdk', new Method( namespace: 'sites', group: 'sites', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php index 50b070d098..9e33965ef3 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php @@ -38,6 +38,7 @@ class Delete extends Base ->label('event', 'sites.[siteId].delete') ->label('audits.event', 'site.delete') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'sites', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php index 18f80ca53f..13620ebcf7 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php @@ -38,6 +38,7 @@ class Update extends Base ->label('event', 'sites.[siteId].deployments.[deploymentId].update') ->label('audits.event', 'deployment.update') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'sites', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 18b38d45af..532c92a428 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -51,6 +51,7 @@ class Update extends Base ->label('event', 'sites.[siteId].update') ->label('audits.event', 'sites.update') ->label('audits.resource', 'site/{response.$id}') + ->label('usage.resource', 'site/{response.$id}') ->label('sdk', new Method( namespace: 'sites', group: 'sites', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php index edd3412b8f..74f0743040 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php @@ -41,6 +41,7 @@ class Create extends Base ->label('event', 'variables.[variableId].create') ->label('audits.event', 'variable.create') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php index 74c638bddc..53e5bffeee 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php @@ -37,6 +37,7 @@ class Delete extends Base ->label('event', 'variables.[variableId].delete') ->label('audits.event', 'variable.delete') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('sdk', new Method( namespace: 'sites', group: 'variables', diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php index 0ed7414b9d..65da54a7df 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php @@ -39,6 +39,7 @@ class Update extends Base ->label('event', 'variables.[variableId].update') ->label('audits.event', 'variable.update') ->label('audits.resource', 'site/{request.siteId}') + ->label('usage.resource', 'site/{request.siteId}') ->label('resourceType', RESOURCE_TYPE_SITES) ->label('sdk', new Method( namespace: 'sites', diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php index 8f288c45d1..e13666ae91 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Create.php @@ -49,6 +49,7 @@ class Create extends Action ->label('event', 'buckets.[bucketId].create') ->label('audits.event', 'bucket.create') ->label('audits.resource', 'bucket/{response.$id}') + ->label('usage.resource', 'bucket/{response.$id}') ->label('sdk', new Method( namespace: 'storage', group: 'buckets', diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php index 2581a2163d..1b33e7d9d1 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Delete.php @@ -37,6 +37,7 @@ class Delete extends Action ->label('audits.event', 'bucket.delete') ->label('event', 'buckets.[bucketId].delete') ->label('audits.resource', 'bucket/{request.bucketId}') + ->label('usage.resource', 'bucket/{request.bucketId}') ->label('sdk', new Method( namespace: 'storage', group: 'buckets', diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php index c5252a299f..680bdcff63 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -62,6 +62,7 @@ class Create extends Action ->label('audits.event', 'file.create') ->label('event', 'buckets.[bucketId].files.[fileId].create') ->label('audits.resource', 'file/{response.$id}') + ->label('usage.resource', 'file/{response.$id}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId},chunkId:{chunkId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php index 51a175b4c0..e2d5122305 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Delete.php @@ -42,6 +42,7 @@ class Delete extends Action ->label('event', 'buckets.[bucketId].files.[fileId].delete') ->label('audits.event', 'file.delete') ->label('audits.resource', 'file/{request.fileId}') + ->label('usage.resource', 'file/{request.fileId}') ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php index fb1245d29c..7758493b7b 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php @@ -43,6 +43,7 @@ class Update extends Action ->label('event', 'buckets.[bucketId].files.[fileId].update') ->label('audits.event', 'file.update') ->label('audits.resource', 'file/{response.$id}') + ->label('usage.resource', 'file/{response.$id}') ->label('sdk', new Method( namespace: 'storage', group: 'files', diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php index 3549c035f1..aae383c79a 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php @@ -46,6 +46,7 @@ class Update extends Action ->label('event', 'buckets.[bucketId].update') ->label('audits.event', 'bucket.update') ->label('audits.resource', 'bucket/{response.$id}') + ->label('usage.resource', 'bucket/{response.$id}') ->label('sdk', new Method( namespace: 'storage', group: 'buckets', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php index 92db118c46..9412db8268 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php @@ -61,6 +61,7 @@ class Create extends Action ->label('auth.type', 'invites') ->label('audits.event', 'membership.create') ->label('audits.resource', 'team/{request.teamId}') + ->label('usage.resource', 'team/{request.teamId}') ->label('audits.userId', '{request.userId}') ->label('sdk', new Method( namespace: 'teams', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Delete.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Delete.php index d055ecb23f..94a7a5a047 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Delete.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Delete.php @@ -38,6 +38,7 @@ class Delete extends Action ->label('scope', 'teams.write') ->label('audits.event', 'membership.delete') ->label('audits.resource', 'team/{request.teamId}') + ->label('usage.resource', 'team/{request.teamId}') ->label('sdk', new Method( namespace: 'teams', group: 'memberships', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Status/Update.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Status/Update.php index 28bfa769ee..67f019e9af 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Status/Update.php @@ -46,6 +46,7 @@ class Update extends Action ->label('scope', 'public') ->label('audits.event', 'membership.update') ->label('audits.resource', 'team/{request.teamId}') + ->label('usage.resource', 'team/{request.teamId}') ->label('audits.userId', '{request.userId}') ->label('sdk', new Method( namespace: 'teams', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Update.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Update.php index 0d2f1e40b4..bb4b50c699 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Update.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Update.php @@ -40,6 +40,7 @@ class Update extends Action ->label('scope', 'teams.write') ->label('audits.event', 'membership.update') ->label('audits.resource', 'team/{request.teamId}') + ->label('usage.resource', 'team/{request.teamId}') ->label('sdk', new Method( namespace: 'teams', group: 'memberships', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Preferences/Update.php b/src/Appwrite/Platform/Modules/Teams/Http/Preferences/Update.php index 2ec5dc9c74..22d9b7d8cf 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Preferences/Update.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Preferences/Update.php @@ -36,6 +36,7 @@ class Update extends Action ->label('scope', 'teams.write') ->label('audits.event', 'team.update') ->label('audits.resource', 'team/{response.$id}') + ->label('usage.resource', 'team/{response.$id}') ->label('audits.userId', '{response.$id}') ->label('sdk', new Method( namespace: 'teams', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Teams/Create.php b/src/Appwrite/Platform/Modules/Teams/Http/Teams/Create.php index 222b0968be..7b335ac48f 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Teams/Create.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Teams/Create.php @@ -44,6 +44,7 @@ class Create extends Action ->label('scope', 'teams.write') ->label('audits.event', 'team.create') ->label('audits.resource', 'team/{response.$id}') + ->label('usage.resource', 'team/{response.$id}') ->label('sdk', new Method( namespace: 'teams', group: 'teams', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Teams/Delete.php b/src/Appwrite/Platform/Modules/Teams/Http/Teams/Delete.php index 3bae031e06..c7c125393e 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Teams/Delete.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Teams/Delete.php @@ -38,6 +38,7 @@ class Delete extends Action ->label('scope', 'teams.write') ->label('audits.event', 'team.delete') ->label('audits.resource', 'team/{request.teamId}') + ->label('usage.resource', 'team/{request.teamId}') ->label('sdk', new Method( namespace: 'teams', group: 'teams', diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Teams/Name/Update.php b/src/Appwrite/Platform/Modules/Teams/Http/Teams/Name/Update.php index ebe751ee1c..cd43f87e4c 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Teams/Name/Update.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Teams/Name/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('scope', 'teams.write') ->label('audits.event', 'team.update') ->label('audits.resource', 'team/{response.$id}') + ->label('usage.resource', 'team/{response.$id}') ->label('sdk', new Method( namespace: 'teams', group: 'teams', diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php index 1c2bd692ef..d0f2c7bcda 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php @@ -40,6 +40,7 @@ class Create extends Action ->label('event', 'tokens.[tokenId].create') ->label('audits.event', 'token.create') ->label('audits.resource', 'token/{response.$id}') + ->label('usage.resource', 'token/{response.$id}') ->label('usage.metric', 'tokens.{scope}.requests.create') ->label('usage.params', ['resourceId:{request.resourceId}', 'resourceType:{request.resourceType}']) ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php index a71f2ec726..4188170367 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php @@ -33,6 +33,7 @@ class Delete extends Action ->label('event', 'tokens.[tokenId].delete') ->label('audits.event', 'tokens.delete') ->label('audits.resource', 'token/{request.tokenId}') + ->label('usage.resource', 'token/{request.tokenId}') ->label('usage.metric', 'tokens.{scope}.requests.delete') ->label('usage.params', ['tokenId:{request.tokenId}']) ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php index 444f49de62..924d73dfe8 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php @@ -35,6 +35,7 @@ class Update extends Action ->label('event', 'tokens.[tokenId].update') ->label('audits.event', 'tokens.update') ->label('audits.resource', 'tokens/{response.$id}') + ->label('usage.resource', 'tokens/{response.$id}') ->label('usage.metric', 'tokens.{scope}.requests.update') ->label('usage.params', ['tokenId:{request.tokenId}']) ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php index 38196420be..5c9520442b 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php @@ -47,6 +47,7 @@ class Create extends Action ->label('event', 'webhooks.[webhookId].create') ->label('audits.event', 'webhook.create') ->label('audits.resource', 'webhook/{response.$id}') + ->label('usage.resource', 'webhook/{response.$id}') ->label('sdk', new Method( namespace: 'webhooks', group: null, diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Delete.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Delete.php index cd05b6210c..1d0ffe9303 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Delete.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Delete.php @@ -38,6 +38,7 @@ class Delete extends Action ->label('event', 'webhooks.[webhookId].delete') ->label('audits.event', 'webhook.delete') ->label('audits.resource', 'webhook/{request.webhookId}') + ->label('usage.resource', 'webhook/{request.webhookId}') ->label('sdk', new Method( namespace: 'webhooks', group: null, diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Secret/Update.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Secret/Update.php index fbff94735e..396c147542 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Secret/Update.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Secret/Update.php @@ -38,6 +38,7 @@ class Update extends Action ->label('event', 'webhooks.[webhookId].update') ->label('audits.event', 'webhooks.update') ->label('audits.resource', 'webhook/{response.$id}') + ->label('usage.resource', 'webhook/{response.$id}') ->label('sdk', new Method( namespace: 'webhooks', group: null, diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php index 17b93812f3..0f89d90d4e 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php @@ -44,6 +44,7 @@ class Update extends Action ->label('event', 'webhooks.[webhookId].update') ->label('audits.event', 'webhooks.update') ->label('audits.resource', 'webhook/{response.$id}') + ->label('usage.resource', 'webhook/{response.$id}') ->label('sdk', new Method( namespace: 'webhooks', group: null, From c1e1c98263f82f0c3105b0a7302eb118ccb9bb76 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 24 Jun 2026 10:18:59 +0530 Subject: [PATCH 22/24] added fallback to read query params for jwt auth --- app/init/realtime/connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index 397d077aa7..571b5dfc77 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -271,7 +271,7 @@ return function (Container $container): void { $user = new User([]); } - $authJWT = $request->getHeaderLine('x-appwrite-jwt', ''); + $authJWT = $request->getHeaderLine('x-appwrite-jwt', (string)($request->getParam('jwt', ''))); if (!empty($authJWT) && !$project->isEmpty()) { if (!$user->isEmpty()) { throw new Exception(Exception::USER_JWT_AND_COOKIE_SET); From cee3857c4eecb21f115f03e7762420838f2a92ee Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 24 Jun 2026 10:19:06 +0530 Subject: [PATCH 23/24] added message tests --- ...altimeCustomClientQueryTestWithMessage.php | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php index 13a7d549dc..2a0d0e132c 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php @@ -13,6 +13,7 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use WebSocket\Client as WebSocketClient; +use WebSocket\ConnectionException; use WebSocket\TimeoutException; final class RealtimeCustomClientQueryTestWithMessage extends Scope @@ -657,6 +658,90 @@ final class RealtimeCustomClientQueryTestWithMessage extends Scope ); } + public function testConnectionJWT(): void + { + $user = $this->getUser(); + $userId = $user['$id'] ?? ''; + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Mint a JWT for the authenticated user. + $response = $this->client->call(Client::METHOD_POST, '/account/jwt', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['jwt']); + $jwt = $response['body']['jwt']; + + /** + * Test for SUCCESS - JWT via x-appwrite-jwt header. + * Connection authenticates at handshake time; the `connected` payload carries the user. + */ + $client = $this->getWebsocketWithCustomQuery([ + 'project' => $projectId, + ], [ + 'origin' => 'http://localhost', + 'x-appwrite-jwt' => $jwt, + ]); + $connected = \json_decode($client->receive(), true); + + $this->assertEquals('connected', $connected['type'] ?? null); + $this->assertNotEmpty($connected['data']['user']); + $this->assertEquals($userId, $connected['data']['user']['$id']); + + // The authenticated user can subscribe to their account channel. + $subscribe = $this->sendSubscribeMessage($client, [[ + 'channels' => ['account'], + ]]); + $this->assertContains('account', $subscribe['data']['subscriptions'][0]['channels']); + + $client->close(); + + /** + * Test for SUCCESS - JWT via ?jwt= query string. + */ + $client = $this->getWebsocketWithCustomQuery([ + 'project' => $projectId, + 'jwt' => $jwt, + ], [ + 'origin' => 'http://localhost', + ]); + $connected = \json_decode($client->receive(), true); + + $this->assertEquals('connected', $connected['type'] ?? null); + $this->assertNotEmpty($connected['data']['user']); + $this->assertEquals($userId, $connected['data']['user']['$id']); + + $subscribe = $this->sendSubscribeMessage($client, [[ + 'channels' => ['account'], + ]]); + $this->assertContains('account', $subscribe['data']['subscriptions'][0]['channels']); + + $client->close(); + + /** + * Test for FAILURE - invalid JWT via query string is rejected at handshake. + */ + $client = $this->getWebsocketWithCustomQuery([ + 'project' => $projectId, + 'jwt' => 'invalid-token', + ], [ + 'origin' => 'http://localhost', + ]); + $error = \json_decode($client->receive(), true); + + $this->assertEquals('error', $error['type'] ?? null); + $this->assertEquals(401, $error['data']['code']); // USER_JWT_INVALID + + \usleep(250000); // 250ms + $this->expectException(ConnectionException::class); // server should disconnect + $client->close(); + } + public function testProjectChannelWithHeaderOnly(): void { $user = $this->getUser(); From 1daa36ffb4f0a65532048d0ae653f227d75ee3e0 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 24 Jun 2026 10:19:14 +0530 Subject: [PATCH 24/24] added query tests --- .../Realtime/RealtimeCustomClientTest.php | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index c623bdfd90..ce241ab91c 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -276,6 +276,89 @@ final class RealtimeCustomClientTest extends Scope $client->close(); } + public function testConnectionJWT() + { + $user = $this->getUser(); + $userId = $user['$id'] ?? ''; + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Mint a JWT for the authenticated user. + $response = $this->client->call(Client::METHOD_POST, '/account/jwt', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['jwt']); + $jwt = $response['body']['jwt']; + + /** + * Test for SUCCESS - JWT via x-appwrite-jwt header + */ + $client = $this->getWebsocket(['account'], [ + 'origin' => 'http://localhost', + 'x-appwrite-jwt' => $jwt, + ]); + $response = json_decode($client->receive(), true); + + $this->assertArrayHasKey('type', $response); + $this->assertArrayHasKey('data', $response); + $this->assertEquals('connected', $response['type']); + $this->assertNotEmpty($response['data']); + $this->assertNotEmpty($response['data']['user']); + $this->assertEquals($userId, $response['data']['user']['$id']); + $this->assertContains('account', $response['data']['channels']); + $this->assertContains('account.' . $userId, $response['data']['channels']); + + $client->close(); + + /** + * Test for SUCCESS - JWT via ?jwt= query string + */ + $client = $this->getWebsocketWithCustomQuery([ + 'project' => $projectId, + 'channels' => ['account'], + 'jwt' => $jwt, + ], [ + 'origin' => 'http://localhost', + ]); + $response = json_decode($client->receive(), true); + + $this->assertArrayHasKey('type', $response); + $this->assertArrayHasKey('data', $response); + $this->assertEquals('connected', $response['type']); + $this->assertNotEmpty($response['data']); + $this->assertNotEmpty($response['data']['user']); + $this->assertEquals($userId, $response['data']['user']['$id']); + $this->assertContains('account', $response['data']['channels']); + $this->assertContains('account.' . $userId, $response['data']['channels']); + + $client->close(); + + /** + * Test for FAILURE - invalid JWT via query string + */ + $client = $this->getWebsocketWithCustomQuery([ + 'project' => $projectId, + 'channels' => ['account'], + 'jwt' => 'invalid-token', + ], [ + 'origin' => 'http://localhost', + ]); + $response = json_decode($client->receive(), true); + + $this->assertArrayHasKey('type', $response); + $this->assertEquals('error', $response['type']); + $this->assertEquals(401, $response['data']['code']); // USER_JWT_INVALID + + \usleep(250000); // 250ms + $this->expectException(ConnectionException::class); // server should disconnect + $client->close(); + } + public function testConnectionPlatform() { /**