mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Merge remote-tracking branch 'origin/add-webhook-migration' into add-policies-migration
This commit is contained in:
commit
2335078191
3 files changed
+35
-35
No files matched your search
@@ -291,10 +291,10 @@ class Appwrite extends Destination
|
||||
// Integrations
|
||||
Resource::TYPE_PLATFORM,
|
||||
Resource::TYPE_API_KEY,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
|
||||
// Settings
|
||||
Resource::TYPE_PROJECT_VARIABLE,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
Resource::TYPE_PROTOCOLS,
|
||||
Resource::TYPE_LABELS,
|
||||
Resource::TYPE_SERVICES,
|
||||
@@ -3110,6 +3110,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) {
|
||||
@@ -3126,10 +3130,6 @@ class Appwrite extends Destination
|
||||
/** @var ProjectVariable $resource */
|
||||
$this->createProjectVariable($resource);
|
||||
break;
|
||||
case Resource::TYPE_WEBHOOK:
|
||||
/** @var Webhook $resource */
|
||||
$this->createWebhook($resource);
|
||||
break;
|
||||
case Resource::TYPE_PROTOCOLS:
|
||||
/** @var Protocols $resource */
|
||||
$this->createProtocols($resource);
|
||||
|
||||
@@ -226,13 +226,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,
|
||||
Resource::TYPE_PROTOCOLS,
|
||||
Resource::TYPE_LABELS,
|
||||
Resource::TYPE_SERVICES,
|
||||
@@ -1582,19 +1582,6 @@ class Appwrite extends Source
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (\in_array(Resource::TYPE_PROTOCOLS, $resources)) {
|
||||
// Singleton — there is exactly one protocols config per project.
|
||||
$report[Resource::TYPE_PROTOCOLS] = 1;
|
||||
@@ -1631,20 +1618,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: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
|
||||
previous: $e
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (\in_array(Resource::TYPE_PROTOCOLS, $resources)) {
|
||||
$this->exportProtocols();
|
||||
@@ -2661,6 +2634,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2720,6 +2706,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
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,6 +67,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,
|
||||
@@ -98,7 +99,6 @@ class Transfer
|
||||
|
||||
public const GROUP_SETTINGS_RESOURCES = [
|
||||
Resource::TYPE_PROJECT_VARIABLE,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
Resource::TYPE_PROTOCOLS,
|
||||
Resource::TYPE_LABELS,
|
||||
Resource::TYPE_SERVICES,
|
||||
@@ -143,10 +143,10 @@ class Transfer
|
||||
// Integrations
|
||||
Resource::TYPE_PLATFORM,
|
||||
Resource::TYPE_API_KEY,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
|
||||
// Settings
|
||||
Resource::TYPE_PROJECT_VARIABLE,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
Resource::TYPE_PROTOCOLS,
|
||||
Resource::TYPE_LABELS,
|
||||
Resource::TYPE_SERVICES,
|
||||
|
||||
Reference in new issue
Block a user