Merge remote-tracking branch 'origin/add-policies-migration' into add-smtp-migration

This commit is contained in:
Prem Palanisamy committed 2026-05-28 14:44:43 +01:00
commit cd3fb8773f
16 files changed
+131 -285

No files matched your search

+18 -33
View File
@@ -10,7 +10,6 @@ use Appwrite\Enums\Compression;
use Appwrite\Enums\Framework;
use Appwrite\Enums\PasswordHash;
use Appwrite\Enums\ProjectProtocolId;
use Appwrite\Enums\ProjectServiceId;
use Appwrite\Enums\Runtime;
use Appwrite\Enums\SmtpEncryption;
use Appwrite\InputFile;
@@ -292,13 +291,13 @@ class Appwrite extends Destination
// Integrations
Resource::TYPE_PLATFORM,
Resource::TYPE_API_KEY,
// Settings
Resource::TYPE_PROJECT_VARIABLE,
Resource::TYPE_WEBHOOK,
Resource::TYPE_PROTOCOLS,
Resource::TYPE_LABELS,
Resource::TYPE_SERVICES,
// Project
Resource::TYPE_PROJECT_VARIABLE,
Resource::TYPE_PROJECT_PROTOCOLS,
Resource::TYPE_PROJECT_LABELS,
Resource::TYPE_PROJECT_SERVICES,
Resource::TYPE_SMTP,
// Backups
@@ -461,7 +460,7 @@ class Appwrite extends Destination
Transfer::GROUP_SITES => $this->importSiteResource($resource),
Transfer::GROUP_INTEGRATIONS => $this->importIntegrationsResource($resource),
Transfer::GROUP_BACKUPS => $this->importBackupResource($resource),
Transfer::GROUP_SETTINGS => $this->importSettingsResource($resource),
Transfer::GROUP_PROJECTS => $this->importProjectsResource($resource),
default => throw new \Exception('Invalid resource group', Exception::CODE_VALIDATION),
};
} catch (\Throwable $e) {
@@ -3112,6 +3111,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) {
@@ -3121,26 +3124,22 @@ class Appwrite extends Destination
return $resource;
}
public function importSettingsResource(Resource $resource): Resource
public function importProjectsResource(Resource $resource): Resource
{
switch ($resource->getName()) {
case Resource::TYPE_PROJECT_VARIABLE:
/** @var ProjectVariable $resource */
$this->createProjectVariable($resource);
break;
case Resource::TYPE_WEBHOOK:
/** @var Webhook $resource */
$this->createWebhook($resource);
break;
case Resource::TYPE_PROTOCOLS:
case Resource::TYPE_PROJECT_PROTOCOLS:
/** @var Protocols $resource */
$this->createProtocols($resource);
break;
case Resource::TYPE_LABELS:
case Resource::TYPE_PROJECT_LABELS:
/** @var Labels $resource */
$this->createLabels($resource);
break;
case Resource::TYPE_SERVICES:
case Resource::TYPE_PROJECT_SERVICES:
/** @var ServicesResource $resource */
$this->createServices($resource);
break;
@@ -3236,23 +3235,9 @@ class Appwrite extends Destination
$project = $this->dbForPlatform->getDocument('projects', $this->projectId);
$services = $project->getAttribute('services', []);
$services[(string) ProjectServiceId::ACCOUNT()] = $resource->getAccount();
$services[(string) ProjectServiceId::AVATARS()] = $resource->getAvatars();
$services[(string) ProjectServiceId::DATABASES()] = $resource->getDatabases();
$services[(string) ProjectServiceId::TABLESDB()] = $resource->getTablesdb();
$services[(string) ProjectServiceId::LOCALE()] = $resource->getLocale();
$services[(string) ProjectServiceId::HEALTH()] = $resource->getHealth();
$services[(string) ProjectServiceId::PROJECT()] = $resource->getProject();
$services[(string) ProjectServiceId::STORAGE()] = $resource->getStorage();
$services[(string) ProjectServiceId::TEAMS()] = $resource->getTeams();
$services[(string) ProjectServiceId::USERS()] = $resource->getUsers();
$services[(string) ProjectServiceId::VCS()] = $resource->getVcs();
$services[(string) ProjectServiceId::SITES()] = $resource->getSites();
$services[(string) ProjectServiceId::FUNCTIONS()] = $resource->getFunctions();
$services[(string) ProjectServiceId::PROXY()] = $resource->getProxy();
$services[(string) ProjectServiceId::GRAPHQL()] = $resource->getGraphql();
$services[(string) ProjectServiceId::MIGRATIONS()] = $resource->getMigrations();
$services[(string) ProjectServiceId::MESSAGING()] = $resource->getMessaging();
foreach ($resource->getServices() as $serviceId => $enabled) {
$services[$serviceId] = (bool) $enabled;
}
$this->dbForPlatform->getAuthorization()->skip(fn () => $this->dbForPlatform->updateDocument(
'projects',
+10 -10
View File
@@ -78,15 +78,15 @@ abstract class Resource implements \JsonSerializable
// Integrations
public const TYPE_PLATFORM = 'platform';
public const TYPE_API_KEY = 'api-key';
// Settings
public const TYPE_PROJECT_VARIABLE = 'project-variable';
public const TYPE_WEBHOOK = 'webhook';
public const TYPE_PROTOCOLS = 'protocols';
public const TYPE_LABELS = 'labels';
public const TYPE_SERVICES = 'services';
public const TYPE_SMTP = 'smtp';
// Project (per-project singleton/settings resources)
public const TYPE_PROJECT_VARIABLE = 'project-variable';
public const TYPE_PROJECT_PROTOCOLS = 'project-protocols';
public const TYPE_PROJECT_LABELS = 'project-labels';
public const TYPE_PROJECT_SERVICES = 'project-services';
// Messaging
public const TYPE_SUBSCRIBER = 'subscriber';
public const TYPE_MESSAGE = 'message';
@@ -129,12 +129,12 @@ abstract class Resource implements \JsonSerializable
self::TYPE_POLICIES,
self::TYPE_PLATFORM,
self::TYPE_API_KEY,
self::TYPE_PROJECT_VARIABLE,
self::TYPE_WEBHOOK,
self::TYPE_PROTOCOLS,
self::TYPE_LABELS,
self::TYPE_SERVICES,
self::TYPE_SMTP,
self::TYPE_PROJECT_VARIABLE,
self::TYPE_PROJECT_PROTOCOLS,
self::TYPE_PROJECT_LABELS,
self::TYPE_PROJECT_SERVICES,
self::TYPE_PROVIDER,
self::TYPE_TOPIC,
self::TYPE_SUBSCRIBER,
+2 -2
View File
@@ -54,12 +54,12 @@ class Labels extends Resource
public static function getName(): string
{
return Resource::TYPE_LABELS;
return Resource::TYPE_PROJECT_LABELS;
}
public function getGroup(): string
{
return Transfer::GROUP_SETTINGS;
return Transfer::GROUP_PROJECTS;
}
/**
@@ -58,7 +58,7 @@ class ProjectVariable extends Resource
public function getGroup(): string
{
return Transfer::GROUP_SETTINGS;
return Transfer::GROUP_PROJECTS;
}
public function getKey(): string
@@ -57,12 +57,12 @@ class Protocols extends Resource
public static function getName(): string
{
return Resource::TYPE_PROTOCOLS;
return Resource::TYPE_PROJECT_PROTOCOLS;
}
public function getGroup(): string
{
return Transfer::GROUP_SETTINGS;
return Transfer::GROUP_PROJECTS;
}
public function getRest(): bool
+1 -1
View File
@@ -79,7 +79,7 @@ class SMTP extends Resource
public function getGroup(): string
{
return Transfer::GROUP_SETTINGS;
return Transfer::GROUP_PROJECTS;
}
public function getEnabled(): bool
+16 -138
View File
@@ -6,31 +6,18 @@ use Utopia\Migration\Resource;
use Utopia\Migration\Transfer;
/**
* Singleton settings resource carrying the project's 17 per-service
* enable/disable flags. One per project; destination flips each via
* Project::updateService().
* Singleton settings resource carrying the project's per-service enable/disable
* flags, keyed by ServiceId value. One per project; destination merges each
* entry into the project's services map.
*/
class Services extends Resource
{
/**
* @param array<string, bool> $services Map of ServiceId string → enabled flag.
*/
public function __construct(
string $id,
private readonly bool $account = true,
private readonly bool $avatars = true,
private readonly bool $databases = true,
private readonly bool $tablesdb = true,
private readonly bool $locale = true,
private readonly bool $health = true,
private readonly bool $project = true,
private readonly bool $storage = true,
private readonly bool $teams = true,
private readonly bool $users = true,
private readonly bool $vcs = true,
private readonly bool $sites = true,
private readonly bool $functions = true,
private readonly bool $proxy = true,
private readonly bool $graphql = true,
private readonly bool $migrations = true,
private readonly bool $messaging = true,
private readonly array $services = [],
string $createdAt = '',
string $updatedAt = '',
) {
@@ -46,23 +33,7 @@ class Services extends Resource
{
return new self(
$array['id'],
(bool) ($array['account'] ?? true),
(bool) ($array['avatars'] ?? true),
(bool) ($array['databases'] ?? true),
(bool) ($array['tablesdb'] ?? true),
(bool) ($array['locale'] ?? true),
(bool) ($array['health'] ?? true),
(bool) ($array['project'] ?? true),
(bool) ($array['storage'] ?? true),
(bool) ($array['teams'] ?? true),
(bool) ($array['users'] ?? true),
(bool) ($array['vcs'] ?? true),
(bool) ($array['sites'] ?? true),
(bool) ($array['functions'] ?? true),
(bool) ($array['proxy'] ?? true),
(bool) ($array['graphql'] ?? true),
(bool) ($array['migrations'] ?? true),
(bool) ($array['messaging'] ?? true),
(array) ($array['services'] ?? []),
createdAt: $array['createdAt'] ?? '',
updatedAt: $array['updatedAt'] ?? '',
);
@@ -75,23 +46,7 @@ class Services extends Resource
{
return [
'id' => $this->id,
'account' => $this->account,
'avatars' => $this->avatars,
'databases' => $this->databases,
'tablesdb' => $this->tablesdb,
'locale' => $this->locale,
'health' => $this->health,
'project' => $this->project,
'storage' => $this->storage,
'teams' => $this->teams,
'users' => $this->users,
'vcs' => $this->vcs,
'sites' => $this->sites,
'functions' => $this->functions,
'proxy' => $this->proxy,
'graphql' => $this->graphql,
'migrations' => $this->migrations,
'messaging' => $this->messaging,
'services' => $this->services,
'createdAt' => $this->createdAt,
'updatedAt' => $this->updatedAt,
];
@@ -99,96 +54,19 @@ class Services extends Resource
public static function getName(): string
{
return Resource::TYPE_SERVICES;
return Resource::TYPE_PROJECT_SERVICES;
}
public function getGroup(): string
{
return Transfer::GROUP_SETTINGS;
return Transfer::GROUP_PROJECTS;
}
public function getAccount(): bool
/**
* @return array<string, bool>
*/
public function getServices(): array
{
return $this->account;
}
public function getAvatars(): bool
{
return $this->avatars;
}
public function getDatabases(): bool
{
return $this->databases;
}
public function getTablesdb(): bool
{
return $this->tablesdb;
}
public function getLocale(): bool
{
return $this->locale;
}
public function getHealth(): bool
{
return $this->health;
}
public function getProject(): bool
{
return $this->project;
}
public function getStorage(): bool
{
return $this->storage;
}
public function getTeams(): bool
{
return $this->teams;
}
public function getUsers(): bool
{
return $this->users;
}
public function getVcs(): bool
{
return $this->vcs;
}
public function getSites(): bool
{
return $this->sites;
}
public function getFunctions(): bool
{
return $this->functions;
}
public function getProxy(): bool
{
return $this->proxy;
}
public function getGraphql(): bool
{
return $this->graphql;
}
public function getMigrations(): bool
{
return $this->migrations;
}
public function getMessaging(): bool
{
return $this->messaging;
return $this->services;
}
}
+1 -1
View File
@@ -73,7 +73,7 @@ class Webhook extends Resource
public function getGroup(): string
{
return Transfer::GROUP_SETTINGS;
return Transfer::GROUP_INTEGRATIONS;
}
public function getWebhookName(): string
+6 -6
View File
@@ -56,7 +56,7 @@ abstract class Source extends Target
return static::$defaultBatchSize;
}
public function getSettingsBatchSize(): int
public function getProjectsBatchSize(): int
{
return static::$defaultBatchSize;
}
@@ -126,7 +126,7 @@ abstract class Source extends Target
Transfer::GROUP_SITES => Transfer::GROUP_SITES_RESOURCES,
Transfer::GROUP_INTEGRATIONS => Transfer::GROUP_INTEGRATIONS_RESOURCES,
Transfer::GROUP_BACKUPS => Transfer::GROUP_BACKUPS_RESOURCES,
Transfer::GROUP_SETTINGS => Transfer::GROUP_SETTINGS_RESOURCES,
Transfer::GROUP_PROJECTS => Transfer::GROUP_PROJECTS_RESOURCES,
];
foreach ($mapping as $group => $resources) {
@@ -167,8 +167,8 @@ abstract class Source extends Target
case Transfer::GROUP_BACKUPS:
$this->exportGroupBackups($this->getBackupsBatchSize(), $resources);
break;
case Transfer::GROUP_SETTINGS:
$this->exportGroupSettings($this->getSettingsBatchSize(), $resources);
case Transfer::GROUP_PROJECTS:
$this->exportGroupProjects($this->getProjectsBatchSize(), $resources);
break;
}
}
@@ -239,10 +239,10 @@ abstract class Source extends Target
abstract protected function exportGroupBackups(int $batchSize, array $resources): void;
/**
* Export Settings Group
* Export Projects Group
*
* @param int $batchSize
* @param array<string> $resources Resources to export
*/
abstract protected function exportGroupSettings(int $batchSize, array $resources): void;
abstract protected function exportGroupProjects(int $batchSize, array $resources): void;
}
+54 -71
View File
@@ -7,7 +7,6 @@ use Appwrite\Client;
use Appwrite\Enums\ProjectAuthMethodId;
use Appwrite\Enums\ProjectPolicyId;
use Appwrite\Enums\ProjectProtocolId;
use Appwrite\Enums\ProjectServiceId;
use Appwrite\Query;
use Appwrite\Services\Functions;
use Appwrite\Services\Messaging;
@@ -227,16 +226,16 @@ class Appwrite extends Source
// Integrations
Resource::TYPE_PLATFORM,
Resource::TYPE_API_KEY,
Resource::TYPE_WEBHOOK,
// Backups
Resource::TYPE_BACKUP_POLICY,
// Settings
// Project
Resource::TYPE_PROJECT_VARIABLE,
Resource::TYPE_WEBHOOK,
Resource::TYPE_PROTOCOLS,
Resource::TYPE_LABELS,
Resource::TYPE_SERVICES,
Resource::TYPE_PROJECT_PROTOCOLS,
Resource::TYPE_PROJECT_LABELS,
Resource::TYPE_PROJECT_SERVICES,
Resource::TYPE_SMTP,
];
}
@@ -278,7 +277,7 @@ class Appwrite extends Source
$this->reportSites($resources, $report, $resourceIds);
$this->reportIntegrations($resources, $report, $resourceIds);
$this->reportBackups($resources, $report, $resourceIds);
$this->reportSettings($resources, $report, $resourceIds);
$this->reportProjects($resources, $report, $resourceIds);
$report['version'] = $this->call(
'GET',
@@ -1569,7 +1568,7 @@ class Appwrite extends Source
}
}
private function reportSettings(array $resources, array &$report, array $resourceIds = []): void
private function reportProjects(array $resources, array &$report, array $resourceIds = []): void
{
if (\in_array(Resource::TYPE_PROJECT_VARIABLE, $resources)) {
$variableQueries = $this->buildQueries(
@@ -1584,32 +1583,19 @@ 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)) {
if (\in_array(Resource::TYPE_PROJECT_PROTOCOLS, $resources)) {
// Singleton — there is exactly one protocols config per project.
$report[Resource::TYPE_PROTOCOLS] = 1;
$report[Resource::TYPE_PROJECT_PROTOCOLS] = 1;
}
if (\in_array(Resource::TYPE_LABELS, $resources)) {
if (\in_array(Resource::TYPE_PROJECT_LABELS, $resources)) {
// Singleton — one labels array per project.
$report[Resource::TYPE_LABELS] = 1;
$report[Resource::TYPE_PROJECT_LABELS] = 1;
}
if (\in_array(Resource::TYPE_SERVICES, $resources)) {
if (\in_array(Resource::TYPE_PROJECT_SERVICES, $resources)) {
// Singleton — one services config per project.
$report[Resource::TYPE_SERVICES] = 1;
$report[Resource::TYPE_PROJECT_SERVICES] = 1;
}
if (\in_array(Resource::TYPE_SMTP, $resources)) {
@@ -1622,7 +1608,7 @@ class Appwrite extends Source
* @param int $batchSize
* @param array<string> $resources
*/
protected function exportGroupSettings(int $batchSize, array $resources): void
protected function exportGroupProjects(int $batchSize, array $resources): void
{
if (\in_array(Resource::TYPE_PROJECT_VARIABLE, $resources)) {
try {
@@ -1630,21 +1616,7 @@ class Appwrite extends Source
} catch (\Throwable $e) {
$this->addError(new Exception(
Resource::TYPE_PROJECT_VARIABLE,
Transfer::GROUP_SETTINGS,
message: $e->getMessage(),
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
previous: $e
));
}
}
if (\in_array(Resource::TYPE_WEBHOOK, $resources)) {
try {
$this->exportWebhooks($batchSize);
} catch (\Throwable $e) {
$this->addError(new Exception(
Resource::TYPE_WEBHOOK,
Transfer::GROUP_SETTINGS,
Transfer::GROUP_PROJECTS,
message: $e->getMessage(),
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
previous: $e
@@ -1653,13 +1625,13 @@ class Appwrite extends Source
}
try {
if (\in_array(Resource::TYPE_PROTOCOLS, $resources)) {
if (\in_array(Resource::TYPE_PROJECT_PROTOCOLS, $resources)) {
$this->exportProtocols();
}
} catch (\Throwable $e) {
$this->addError(new Exception(
Resource::TYPE_PROTOCOLS,
Transfer::GROUP_SETTINGS,
Resource::TYPE_PROJECT_PROTOCOLS,
Transfer::GROUP_PROJECTS,
message: $e->getMessage(),
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
previous: $e
@@ -1667,13 +1639,13 @@ class Appwrite extends Source
}
try {
if (\in_array(Resource::TYPE_LABELS, $resources)) {
if (\in_array(Resource::TYPE_PROJECT_LABELS, $resources)) {
$this->exportLabels();
}
} catch (\Throwable $e) {
$this->addError(new Exception(
Resource::TYPE_LABELS,
Transfer::GROUP_SETTINGS,
Resource::TYPE_PROJECT_LABELS,
Transfer::GROUP_PROJECTS,
message: $e->getMessage(),
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
previous: $e
@@ -1681,13 +1653,13 @@ class Appwrite extends Source
}
try {
if (\in_array(Resource::TYPE_SERVICES, $resources)) {
if (\in_array(Resource::TYPE_PROJECT_SERVICES, $resources)) {
$this->exportServices();
}
} catch (\Throwable $e) {
$this->addError(new Exception(
Resource::TYPE_SERVICES,
Transfer::GROUP_SETTINGS,
Resource::TYPE_PROJECT_SERVICES,
Transfer::GROUP_PROJECTS,
message: $e->getMessage(),
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
previous: $e
@@ -1701,7 +1673,7 @@ class Appwrite extends Source
} catch (\Throwable $e) {
$this->addError(new Exception(
Resource::TYPE_SMTP,
Transfer::GROUP_SETTINGS,
Transfer::GROUP_PROJECTS,
message: $e->getMessage(),
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
previous: $e
@@ -1715,28 +1687,12 @@ class Appwrite extends Source
$byId = [];
foreach ($project->services as $service) {
$byId[(string) $service->id] = $service->enabled;
$byId[(string) $service->id] = (bool) $service->enabled;
}
$services = new ServicesResource(
$this->projectId,
$byId[(string) ProjectServiceId::ACCOUNT()] ?? true,
$byId[(string) ProjectServiceId::AVATARS()] ?? true,
$byId[(string) ProjectServiceId::DATABASES()] ?? true,
$byId[(string) ProjectServiceId::TABLESDB()] ?? true,
$byId[(string) ProjectServiceId::LOCALE()] ?? true,
$byId[(string) ProjectServiceId::HEALTH()] ?? true,
$byId[(string) ProjectServiceId::PROJECT()] ?? true,
$byId[(string) ProjectServiceId::STORAGE()] ?? true,
$byId[(string) ProjectServiceId::TEAMS()] ?? true,
$byId[(string) ProjectServiceId::USERS()] ?? true,
$byId[(string) ProjectServiceId::VCS()] ?? true,
$byId[(string) ProjectServiceId::SITES()] ?? true,
$byId[(string) ProjectServiceId::FUNCTIONS()] ?? true,
$byId[(string) ProjectServiceId::PROXY()] ?? true,
$byId[(string) ProjectServiceId::GRAPHQL()] ?? true,
$byId[(string) ProjectServiceId::MIGRATIONS()] ?? true,
$byId[(string) ProjectServiceId::MESSAGING()] ?? true,
$byId,
createdAt: $project->createdAt,
updatedAt: $project->updatedAt,
);
@@ -2704,6 +2660,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;
}
}
}
/**
@@ -2763,6 +2732,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
));
}
}
}
/**
+1 -1
View File
@@ -440,7 +440,7 @@ class CSV extends Source
throw new \Exception('Not Implemented');
}
protected function exportGroupSettings(int $batchSize, array $resources): void
protected function exportGroupProjects(int $batchSize, array $resources): void
{
throw new \Exception('Not Implemented');
}
+1 -1
View File
@@ -828,7 +828,7 @@ class Firebase extends Source
throw new \Exception('Not implemented');
}
protected function exportGroupSettings(int $batchSize, array $resources): void
protected function exportGroupProjects(int $batchSize, array $resources): void
{
throw new \Exception('Not implemented');
}
+1 -1
View File
@@ -214,7 +214,7 @@ class JSON extends Source
throw new \Exception('Not Implemented');
}
protected function exportGroupSettings(int $batchSize, array $resources): void
protected function exportGroupProjects(int $batchSize, array $resources): void
{
throw new \Exception('Not Implemented');
}
+1 -1
View File
@@ -963,7 +963,7 @@ class NHost extends Source
throw new \Exception('Not Implemented');
}
protected function exportGroupSettings(int $batchSize, array $resources): void
protected function exportGroupProjects(int $batchSize, array $resources): void
{
throw new \Exception('Not Implemented');
}
+13 -13
View File
@@ -28,7 +28,7 @@ class Transfer
public const GROUP_BACKUPS = 'backups';
public const GROUP_SETTINGS = 'settings';
public const GROUP_PROJECTS = 'projects';
public const GROUP_AUTH_RESOURCES = [
Resource::TYPE_USER,
@@ -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,
@@ -96,12 +97,11 @@ class Transfer
Resource::TYPE_ATTRIBUTE
];
public const GROUP_SETTINGS_RESOURCES = [
public const GROUP_PROJECTS_RESOURCES = [
Resource::TYPE_PROJECT_VARIABLE,
Resource::TYPE_WEBHOOK,
Resource::TYPE_PROTOCOLS,
Resource::TYPE_LABELS,
Resource::TYPE_SERVICES,
Resource::TYPE_PROJECT_PROTOCOLS,
Resource::TYPE_PROJECT_LABELS,
Resource::TYPE_PROJECT_SERVICES,
Resource::TYPE_SMTP,
];
@@ -144,13 +144,13 @@ class Transfer
// Integrations
Resource::TYPE_PLATFORM,
Resource::TYPE_API_KEY,
// Settings
Resource::TYPE_PROJECT_VARIABLE,
Resource::TYPE_WEBHOOK,
Resource::TYPE_PROTOCOLS,
Resource::TYPE_LABELS,
Resource::TYPE_SERVICES,
// Project
Resource::TYPE_PROJECT_VARIABLE,
Resource::TYPE_PROJECT_PROTOCOLS,
Resource::TYPE_PROJECT_LABELS,
Resource::TYPE_PROJECT_SERVICES,
Resource::TYPE_SMTP,
// legacy
@@ -438,7 +438,7 @@ class Transfer
self::GROUP_DATABASES_VECTOR_DB => array_merge($resources, self::GROUP_VECTORSDB_RESOURCES),
self::GROUP_MESSAGING => array_merge($resources, self::GROUP_MESSAGING_RESOURCES),
self::GROUP_BACKUPS => array_merge($resources, self::GROUP_BACKUPS_RESOURCES),
self::GROUP_SETTINGS => array_merge($resources, self::GROUP_SETTINGS_RESOURCES),
self::GROUP_PROJECTS => array_merge($resources, self::GROUP_PROJECTS_RESOURCES),
default => throw new \Exception('No service group found'),
};
}
+3 -3
View File
@@ -230,14 +230,14 @@ class MockSource extends Source
}
}
protected function exportGroupSettings(int $batchSize, array $resources): void
protected function exportGroupProjects(int $batchSize, array $resources): void
{
foreach (Transfer::GROUP_SETTINGS_RESOURCES as $resource) {
foreach (Transfer::GROUP_PROJECTS_RESOURCES as $resource) {
if (!\in_array($resource, $resources)) {
continue;
}
$this->handleResourceTransfer(Transfer::GROUP_SETTINGS, $resource);
$this->handleResourceTransfer(Transfer::GROUP_PROJECTS, $resource);
}
}
}