Add Services migration wizard support

This commit is contained in:
Prem Palanisamy
2026-05-18 16:18:39 +01:00
parent 4e12f92728
commit 12a87bb4fd
3 changed files with 29 additions and 5 deletions
+18 -5
View File
@@ -18,13 +18,14 @@ export type MigrationResource =
| 'webhook'
| 'auth-methods'
| 'protocols'
| 'labels';
| 'labels'
| 'services';
// Appwrite enum is the superset of all provider resources — used as a
// provider-agnostic reference. The addResource guard filters by provider.
// Project-level singleton resources (Platform, ApiKey, ProjectVariable,
// Webhook, AuthMethods, Protocols, Labels) are augmented locally until
// @appwrite.io/console SDK is regenerated.
// Webhook, AuthMethods, Protocols, Labels, Services) are augmented locally
// until @appwrite.io/console SDK is regenerated.
export const MigrationResources = {
...AppwriteMigrationResource,
Platform: 'platform',
@@ -33,7 +34,8 @@ export const MigrationResources = {
Webhook: 'webhook',
AuthMethods: 'auth-methods',
Protocols: 'protocols',
Labels: 'labels'
Labels: 'labels',
Services: 'services'
} as const;
type ProviderResourceMap = {
@@ -79,6 +81,9 @@ const initialFormData = {
labels: {
root: false
},
services: {
root: false
},
integrations: {
root: false,
apiKeys: false
@@ -131,7 +136,8 @@ export const ResourcesFriendly = {
webhook: { singular: 'Webhook', plural: 'Webhooks' },
'auth-methods': { singular: 'Auth method config', plural: 'Auth method config' },
protocols: { singular: 'Protocol config', plural: 'Protocol config' },
labels: { singular: 'Project labels', plural: 'Project labels' }
labels: { singular: 'Project labels', plural: 'Project labels' },
services: { singular: 'Services config', plural: 'Services config' }
};
export const providerResources: ProviderResourceMap = {
@@ -140,6 +146,7 @@ export const providerResources: ProviderResourceMap = {
MigrationResources.AuthMethods as AppwriteMigrationResource,
MigrationResources.Protocols as AppwriteMigrationResource,
MigrationResources.Labels as AppwriteMigrationResource,
MigrationResources.Services as AppwriteMigrationResource,
MigrationResources.Platform as AppwriteMigrationResource,
MigrationResources.ApiKey as AppwriteMigrationResource,
MigrationResources.ProjectVariable as AppwriteMigrationResource,
@@ -216,6 +223,9 @@ export const migrationFormToResources = <P extends Provider>(
if (formData.labels.root) {
addResource(MigrationResources.Labels);
}
if (formData.services.root) {
addResource(MigrationResources.Services);
}
if (formData.integrations.root) {
addResource(MigrationResources.Platform);
if (formData.integrations.apiKeys) {
@@ -316,6 +326,9 @@ export const resourcesToMigrationForm = (resources: MigrationResource[]): Migrat
if (resources.includes(MigrationResources.Labels)) {
formData.labels.root = true;
}
if (resources.includes(MigrationResources.Services)) {
formData.services.root = true;
}
if (resources.includes(MigrationResources.Platform)) {
formData.integrations.root = true;
}
@@ -131,6 +131,10 @@
return resources.includes(MigrationResources.Labels);
}
if (groupKey === 'services') {
return resources.includes(MigrationResources.Services);
}
if (groupKey === 'integrations') {
return (
resources.includes(MigrationResources.Platform) ||
@@ -170,6 +174,7 @@
authMethods: 'auth-methods',
protocols: 'protocols',
labels: 'labels',
services: 'services',
integrations: 'platform',
settings: 'project-variable'
};
@@ -46,6 +46,9 @@
labels: {
root: 'Project labels'
},
services: {
root: 'Services'
},
integrations: {
root: 'Platforms',
apiKeys: 'Include API keys'
@@ -89,6 +92,9 @@
labels: {
root: 'Import the project-level RBAC label array'
},
services: {
root: 'Import the project service enable/disable flags (Account, Databases, Functions, GraphQL, etc.)'
},
integrations: {
root: 'Import all platforms (web, Flutter, iOS, Android, etc.)',
apiKeys: 'Import all API keys with their scopes and expiration'