From 45f1ed706b58a93174e6a287f4f0f4dd23996c91 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 28 May 2026 08:46:28 +0100 Subject: [PATCH] Move webhook into integrations group --- src/Migration/Destinations/Appwrite.php | 10 ++--- src/Migration/Sources/Appwrite.php | 56 ++++++++++++------------- src/Migration/Transfer.php | 4 +- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index 90f596eed8..c8330e520e 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -279,10 +279,10 @@ class Appwrite extends Destination // Integrations Resource::TYPE_PLATFORM, Resource::TYPE_API_KEY, + Resource::TYPE_WEBHOOK, // Settings Resource::TYPE_PROJECT_VARIABLE, - Resource::TYPE_WEBHOOK, // Backups Resource::TYPE_BACKUP_POLICY, @@ -3087,6 +3087,10 @@ class Appwrite extends Destination /** @var ApiKey $resource */ $this->createApiKey($resource); break; + case Resource::TYPE_WEBHOOK: + /** @var Webhook $resource */ + $this->createWebhook($resource); + break; } if ($resource->getStatus() !== Resource::STATUS_SKIPPED) { @@ -3103,10 +3107,6 @@ class Appwrite extends Destination /** @var ProjectVariable $resource */ $this->createProjectVariable($resource); break; - case Resource::TYPE_WEBHOOK: - /** @var Webhook $resource */ - $this->createWebhook($resource); - break; } if ($resource->getStatus() !== Resource::STATUS_SKIPPED) { diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index fd03b7d044..4114bb2e1c 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -215,13 +215,13 @@ class Appwrite extends Source // Integrations Resource::TYPE_PLATFORM, Resource::TYPE_API_KEY, + Resource::TYPE_WEBHOOK, // Backups Resource::TYPE_BACKUP_POLICY, // Settings Resource::TYPE_PROJECT_VARIABLE, - Resource::TYPE_WEBHOOK, ]; } @@ -1472,19 +1472,6 @@ class Appwrite extends Source $report[Resource::TYPE_PROJECT_VARIABLE] = 0; } } - - if (\in_array(Resource::TYPE_WEBHOOK, $resources)) { - $webhookQueries = $this->buildQueries( - resourceType: Resource::TYPE_WEBHOOK, - resourceIds: $resourceIds, - limit: 1 - ); - try { - $report[Resource::TYPE_WEBHOOK] = $this->webhooks->list($webhookQueries)->total; - } catch (\Throwable) { - $report[Resource::TYPE_WEBHOOK] = 0; - } - } } /** @@ -1506,20 +1493,6 @@ class Appwrite extends Source )); } } - - if (\in_array(Resource::TYPE_WEBHOOK, $resources)) { - try { - $this->exportWebhooks($batchSize); - } catch (\Throwable $e) { - $this->addError(new Exception( - Resource::TYPE_WEBHOOK, - Transfer::GROUP_SETTINGS, - message: $e->getMessage(), - code: $e->getCode(), - previous: $e - )); - } - } } /** @@ -2425,6 +2398,19 @@ class Appwrite extends Source $report[Resource::TYPE_API_KEY] = 0; } } + + if (\in_array(Resource::TYPE_WEBHOOK, $resources)) { + $webhookQueries = $this->buildQueries( + resourceType: Resource::TYPE_WEBHOOK, + resourceIds: $resourceIds, + limit: 1 + ); + try { + $report[Resource::TYPE_WEBHOOK] = $this->webhooks->list($webhookQueries)->total; + } catch (\Throwable) { + $report[Resource::TYPE_WEBHOOK] = 0; + } + } } /** @@ -2484,6 +2470,20 @@ class Appwrite extends Source )); } } + + if (\in_array(Resource::TYPE_WEBHOOK, $resources)) { + try { + $this->exportWebhooks($batchSize); + } catch (\Throwable $e) { + $this->addError(new Exception( + Resource::TYPE_WEBHOOK, + Transfer::GROUP_INTEGRATIONS, + message: $e->getMessage(), + code: $e->getCode(), + previous: $e + )); + } + } } /** diff --git a/src/Migration/Transfer.php b/src/Migration/Transfer.php index 319e57febd..f7a4a1b25f 100644 --- a/src/Migration/Transfer.php +++ b/src/Migration/Transfer.php @@ -65,6 +65,7 @@ class Transfer public const GROUP_INTEGRATIONS_RESOURCES = [ Resource::TYPE_PLATFORM, Resource::TYPE_API_KEY, + Resource::TYPE_WEBHOOK, ]; public const GROUP_DOCUMENTSDB_RESOURCES = [ Resource::TYPE_DATABASE_DOCUMENTSDB, @@ -96,7 +97,6 @@ class Transfer public const GROUP_SETTINGS_RESOURCES = [ Resource::TYPE_PROJECT_VARIABLE, - Resource::TYPE_WEBHOOK, ]; public const GROUP_BACKUPS_RESOURCES = [ @@ -136,10 +136,10 @@ class Transfer // Integrations Resource::TYPE_PLATFORM, Resource::TYPE_API_KEY, + Resource::TYPE_WEBHOOK, // Settings Resource::TYPE_PROJECT_VARIABLE, - Resource::TYPE_WEBHOOK, // legacy Resource::TYPE_DOCUMENT,