mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Add Protocols migration wizard support
This commit is contained in:
@@ -16,19 +16,21 @@ export type MigrationResource =
|
||||
| 'api-key'
|
||||
| 'project-variable'
|
||||
| 'webhook'
|
||||
| 'auth-methods';
|
||||
| 'auth-methods'
|
||||
| 'protocols';
|
||||
|
||||
// Appwrite enum is the superset of all provider resources — used as a
|
||||
// provider-agnostic reference. The addResource guard filters by provider.
|
||||
// Platform, ApiKey, ProjectVariable, Webhook and AuthMethods are augmented
|
||||
// locally until @appwrite.io/console SDK is regenerated against the new spec.
|
||||
// Platform, ApiKey, ProjectVariable, Webhook, AuthMethods and Protocols are
|
||||
// augmented locally until @appwrite.io/console SDK is regenerated.
|
||||
export const MigrationResources = {
|
||||
...AppwriteMigrationResource,
|
||||
Platform: 'platform',
|
||||
ApiKey: 'api-key',
|
||||
ProjectVariable: 'project-variable',
|
||||
Webhook: 'webhook',
|
||||
AuthMethods: 'auth-methods'
|
||||
AuthMethods: 'auth-methods',
|
||||
Protocols: 'protocols'
|
||||
} as const;
|
||||
|
||||
type ProviderResourceMap = {
|
||||
@@ -68,6 +70,9 @@ const initialFormData = {
|
||||
authMethods: {
|
||||
root: false
|
||||
},
|
||||
protocols: {
|
||||
root: false
|
||||
},
|
||||
integrations: {
|
||||
root: false,
|
||||
apiKeys: false
|
||||
@@ -118,13 +123,15 @@ export const ResourcesFriendly = {
|
||||
'api-key': { singular: 'API Key', plural: 'API Keys' },
|
||||
'project-variable': { singular: 'Project Variable', plural: 'Project Variables' },
|
||||
webhook: { singular: 'Webhook', plural: 'Webhooks' },
|
||||
'auth-methods': { singular: 'Auth method config', plural: 'Auth method config' }
|
||||
'auth-methods': { singular: 'Auth method config', plural: 'Auth method config' },
|
||||
protocols: { singular: 'Protocol config', plural: 'Protocol config' }
|
||||
};
|
||||
|
||||
export const providerResources: ProviderResourceMap = {
|
||||
appwrite: [
|
||||
...Object.values(AppwriteMigrationResource),
|
||||
MigrationResources.AuthMethods as AppwriteMigrationResource,
|
||||
MigrationResources.Protocols as AppwriteMigrationResource,
|
||||
MigrationResources.Platform as AppwriteMigrationResource,
|
||||
MigrationResources.ApiKey as AppwriteMigrationResource,
|
||||
MigrationResources.ProjectVariable as AppwriteMigrationResource,
|
||||
@@ -195,6 +202,9 @@ export const migrationFormToResources = <P extends Provider>(
|
||||
if (formData.authMethods.root) {
|
||||
addResource(MigrationResources.AuthMethods);
|
||||
}
|
||||
if (formData.protocols.root) {
|
||||
addResource(MigrationResources.Protocols);
|
||||
}
|
||||
if (formData.integrations.root) {
|
||||
addResource(MigrationResources.Platform);
|
||||
if (formData.integrations.apiKeys) {
|
||||
@@ -289,6 +299,9 @@ export const resourcesToMigrationForm = (resources: MigrationResource[]): Migrat
|
||||
if (resources.includes(MigrationResources.AuthMethods)) {
|
||||
formData.authMethods.root = true;
|
||||
}
|
||||
if (resources.includes(MigrationResources.Protocols)) {
|
||||
formData.protocols.root = true;
|
||||
}
|
||||
if (resources.includes(MigrationResources.Platform)) {
|
||||
formData.integrations.root = true;
|
||||
}
|
||||
|
||||
@@ -123,6 +123,10 @@
|
||||
return resources.includes(MigrationResources.AuthMethods);
|
||||
}
|
||||
|
||||
if (groupKey === 'protocols') {
|
||||
return resources.includes(MigrationResources.Protocols);
|
||||
}
|
||||
|
||||
if (groupKey === 'integrations') {
|
||||
return (
|
||||
resources.includes(MigrationResources.Platform) ||
|
||||
@@ -160,6 +164,7 @@
|
||||
messaging: 'provider',
|
||||
backups: 'backup-policy',
|
||||
authMethods: 'auth-methods',
|
||||
protocols: 'protocols',
|
||||
integrations: 'platform',
|
||||
settings: 'project-variable'
|
||||
};
|
||||
|
||||
+6
@@ -40,6 +40,9 @@
|
||||
authMethods: {
|
||||
root: 'Auth methods'
|
||||
},
|
||||
protocols: {
|
||||
root: 'Protocols'
|
||||
},
|
||||
integrations: {
|
||||
root: 'Platforms',
|
||||
apiKeys: 'Include API keys'
|
||||
@@ -77,6 +80,9 @@
|
||||
authMethods: {
|
||||
root: 'Import the project auth method flags (email/password, magic URL, JWT, phone, etc.)'
|
||||
},
|
||||
protocols: {
|
||||
root: 'Import the project protocol flags (REST / GraphQL / WebSocket)'
|
||||
},
|
||||
integrations: {
|
||||
root: 'Import all platforms (web, Flutter, iOS, Android, etc.)',
|
||||
apiKeys: 'Import all API keys with their scopes and expiration'
|
||||
|
||||
Reference in New Issue
Block a user