mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #2913 from appwrite/feat-message-migration-console
feat: add messaging migration support
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
"name": "@appwrite/console",
|
||||
"dependencies": {
|
||||
"@ai-sdk/svelte": "^1.1.24",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@297fbee",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@41152f5",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@df765cc",
|
||||
"@appwrite.io/pink-legacy": "^1.0.3",
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
"@analytics/type-utils": ["@analytics/type-utils@0.6.4", "", {}, "sha512-Ou1gQxFakOWLcPnbFVsrPb8g1wLLUZYYJXDPjHkG07+5mustGs5yqACx42UAu4A6NszNN6Z5gGxhyH45zPWRxw=="],
|
||||
|
||||
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@297fbee", { "dependencies": { "json-bigint": "1.0.0" } }],
|
||||
"@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@41152f5", { "dependencies": { "json-bigint": "1.0.0" } }],
|
||||
|
||||
"@appwrite.io/pink-icons": ["@appwrite.io/pink-icons@0.25.0", "", {}, "sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q=="],
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/svelte": "^1.1.24",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@297fbee",
|
||||
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@41152f5",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@df765cc",
|
||||
"@appwrite.io/pink-legacy": "^1.0.3",
|
||||
|
||||
@@ -43,6 +43,10 @@ const initialFormData = {
|
||||
sites: {
|
||||
root: false,
|
||||
deploymentInactive: false
|
||||
},
|
||||
messaging: {
|
||||
root: false,
|
||||
messages: false
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,7 +80,11 @@ export const ResourcesFriendly = {
|
||||
row: { singular: 'Row', plural: 'Rows' },
|
||||
site: { singular: 'Site', plural: 'Sites' },
|
||||
'site-deployment': { singular: 'Site Deployment', plural: 'Site Deployments' },
|
||||
'site-variable': { singular: 'Site Variable', plural: 'Site Variables' }
|
||||
'site-variable': { singular: 'Site Variable', plural: 'Site Variables' },
|
||||
provider: { singular: 'Provider', plural: 'Providers' },
|
||||
topic: { singular: 'Topic', plural: 'Topics' },
|
||||
subscriber: { singular: 'Subscriber', plural: 'Subscribers' },
|
||||
message: { singular: 'Message', plural: 'Messages' }
|
||||
};
|
||||
|
||||
export const providerResources: ProviderResourceMap = {
|
||||
@@ -132,6 +140,14 @@ export const migrationFormToResources = <P extends Provider>(
|
||||
addResource(ResourceType.Sitedeployment);
|
||||
}
|
||||
}
|
||||
if (formData.messaging.root) {
|
||||
addResource(ResourceType.Provider);
|
||||
addResource(ResourceType.Topic);
|
||||
addResource(ResourceType.Subscriber);
|
||||
}
|
||||
if (formData.messaging.messages) {
|
||||
addResource(ResourceType.Message);
|
||||
}
|
||||
|
||||
return resources as ProviderResourceMap[P];
|
||||
};
|
||||
@@ -194,6 +210,12 @@ export const resourcesToMigrationForm = (resources: MigrationResource[]): Migrat
|
||||
if (resources.includes(ResourceType.Sitedeployment)) {
|
||||
formData.sites.deploymentInactive = true;
|
||||
}
|
||||
if (resources.includes(ResourceType.Provider)) {
|
||||
formData.messaging.root = true;
|
||||
}
|
||||
if (resources.includes(ResourceType.Message)) {
|
||||
formData.messaging.messages = true;
|
||||
}
|
||||
|
||||
return formData;
|
||||
};
|
||||
|
||||
@@ -108,6 +108,10 @@
|
||||
return resources.includes(ResourceType.Site);
|
||||
}
|
||||
|
||||
if (groupKey === 'messaging') {
|
||||
return resources.includes(ResourceType.Provider);
|
||||
}
|
||||
|
||||
const groupToResource: Record<string, MigrationResource> = {
|
||||
users: ResourceType.User,
|
||||
databases: ResourceType.Database
|
||||
@@ -127,7 +131,8 @@
|
||||
databases: 'database',
|
||||
functions: 'function',
|
||||
storage: 'bucket',
|
||||
sites: 'site'
|
||||
sites: 'site',
|
||||
messaging: 'provider'
|
||||
};
|
||||
return map[groupKey] || groupKey;
|
||||
};
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@
|
||||
commands: installCommand || undefined,
|
||||
scopes: selectedScopes?.length ? selectedScopes : undefined,
|
||||
providerSilentMode: false,
|
||||
specification: specification || undefined
|
||||
buildSpecification: specification || undefined
|
||||
});
|
||||
|
||||
// Add domain
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@
|
||||
enabled: true,
|
||||
entrypoint,
|
||||
commands: buildCommand,
|
||||
specification: specification || undefined
|
||||
buildSpecification: specification || undefined
|
||||
});
|
||||
|
||||
// Add domain
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@
|
||||
providerBranch: branch,
|
||||
providerSilentMode: silentMode,
|
||||
providerRootDirectory: rootDir,
|
||||
specification: specification || undefined
|
||||
buildSpecification: specification || undefined
|
||||
});
|
||||
|
||||
// Add domain
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@
|
||||
providerBranch: branch,
|
||||
providerSilentMode: silentMode,
|
||||
providerRootDirectory: rootDir,
|
||||
specification: specification || undefined
|
||||
buildSpecification: specification || undefined
|
||||
});
|
||||
|
||||
// Add domain
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
providerBranch: func.providerBranch || undefined,
|
||||
providerSilentMode: func.providerSilentMode || undefined,
|
||||
providerRootDirectory: func.providerRootDirectory || undefined,
|
||||
specification: func.specification || undefined
|
||||
buildSpecification: func.buildSpecification || undefined
|
||||
});
|
||||
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
providerSilentMode: $func.providerSilentMode || undefined,
|
||||
providerRootDirectory: $func.providerRootDirectory || undefined,
|
||||
specification: $func.specification || undefined
|
||||
buildSpecification: $func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
providerBranch: func.providerBranch || undefined,
|
||||
providerSilentMode: func.providerSilentMode || undefined,
|
||||
providerRootDirectory: func.providerRootDirectory || undefined,
|
||||
specification: func.specification || undefined
|
||||
buildSpecification: func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
providerSilentMode: $func.providerSilentMode || undefined,
|
||||
providerRootDirectory: $func.providerRootDirectory || undefined,
|
||||
specification: $func.specification || undefined
|
||||
buildSpecification: $func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
providerSilentMode: $func.providerSilentMode || undefined,
|
||||
providerRootDirectory: $func.providerRootDirectory || undefined,
|
||||
specification: $func.specification || undefined
|
||||
buildSpecification: $func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+4
-4
@@ -18,9 +18,9 @@
|
||||
export let func: Models.Function;
|
||||
export let specs: Models.SpecificationList;
|
||||
|
||||
let specification = func.specification;
|
||||
let originalSpecification = func.specification;
|
||||
$: originalSpecification = func.specification;
|
||||
let specification = func.buildSpecification;
|
||||
let originalSpecification = func.buildSpecification;
|
||||
$: originalSpecification = func.buildSpecification;
|
||||
|
||||
async function updateLogging() {
|
||||
try {
|
||||
@@ -45,7 +45,7 @@
|
||||
providerBranch: func.providerBranch || undefined,
|
||||
providerSilentMode: func.providerSilentMode || undefined,
|
||||
providerRootDirectory: func.providerRootDirectory || undefined,
|
||||
specification: specification || undefined
|
||||
buildSpecification: specification || undefined
|
||||
});
|
||||
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
providerSilentMode: $func.providerSilentMode || undefined,
|
||||
providerRootDirectory: $func.providerRootDirectory || undefined,
|
||||
specification: $func.specification || undefined
|
||||
buildSpecification: $func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
providerSilentMode: $func.providerSilentMode || undefined,
|
||||
providerRootDirectory: $func.providerRootDirectory || undefined,
|
||||
specification: $func.specification || undefined
|
||||
buildSpecification: $func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
providerSilentMode: $func.providerSilentMode || undefined,
|
||||
providerRootDirectory: $func.providerRootDirectory || undefined,
|
||||
specification: $func.specification || undefined
|
||||
buildSpecification: $func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
providerBranch: $func.providerBranch || undefined,
|
||||
providerSilentMode: $func.providerSilentMode || undefined,
|
||||
providerRootDirectory: $func.providerRootDirectory || undefined,
|
||||
specification: $func.specification || undefined
|
||||
buildSpecification: $func.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
addNotification({
|
||||
|
||||
+8
@@ -29,6 +29,10 @@
|
||||
sites: {
|
||||
root: 'Sites',
|
||||
deploymentInactive: 'Include inactive deployments'
|
||||
},
|
||||
messaging: {
|
||||
root: 'Messaging',
|
||||
messages: 'Include messages'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,6 +52,10 @@
|
||||
sites: {
|
||||
root: 'Import all sites and their active deployment',
|
||||
deploymentInactive: 'Import all deployments that are not currently active'
|
||||
},
|
||||
messaging: {
|
||||
root: 'Import all messaging providers, topics and subscribers',
|
||||
messages: 'Import all messages'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -106,6 +106,11 @@
|
||||
Scopes.BucketsRead,
|
||||
Scopes.FunctionsRead,
|
||||
Scopes.ExecutionRead,
|
||||
Scopes.SitesRead,
|
||||
Scopes.ProvidersRead,
|
||||
Scopes.TopicsRead,
|
||||
Scopes.SubscribersRead,
|
||||
Scopes.MessagesRead,
|
||||
Scopes.LocaleRead,
|
||||
Scopes.AvatarsRead,
|
||||
Scopes.HealthRead
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@
|
||||
providerBranch: nextBranch,
|
||||
providerSilentMode: data.site?.providerSilentMode ?? undefined,
|
||||
providerRootDirectory: data.site?.providerRootDirectory ?? undefined,
|
||||
specification: data.site?.specification || undefined
|
||||
buildSpecification: data.site?.buildSpecification || undefined
|
||||
});
|
||||
invalidate(Dependencies.SITE);
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ export const load = async ({ params, depends, parent }) => {
|
||||
});
|
||||
|
||||
const enabledSpecs = specificationsList?.specifications?.filter((s) => s.enabled) ?? [];
|
||||
if (!enabledSpecs.some((s) => s.slug === site.specification)) {
|
||||
site.specification = enabledSpecs[0]?.slug;
|
||||
if (!enabledSpecs.some((s) => s.slug === site.buildSpecification)) {
|
||||
site.buildSpecification = enabledSpecs[0]?.slug;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
+6
-6
@@ -112,8 +112,8 @@
|
||||
site.adapter = adapter;
|
||||
}
|
||||
if (specs && specs.specifications?.length) {
|
||||
if (!specs.specifications.some((s) => s.slug === site.specification)) {
|
||||
site.specification = specs.specifications[0].slug;
|
||||
if (!specs.specifications.some((s) => s.slug === site.buildSpecification)) {
|
||||
site.buildSpecification = specs.specifications[0].slug;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,10 +128,10 @@
|
||||
}
|
||||
// only allow enabled specsification for it
|
||||
const enabledSpecs = specs?.specifications?.filter((s) => s.enabled) ?? [];
|
||||
let specToSend = enabledSpecs.some((s) => s.slug === site.specification)
|
||||
? site.specification
|
||||
let specToSend = enabledSpecs.some((s) => s.slug === site.buildSpecification)
|
||||
? site.buildSpecification
|
||||
: enabledSpecs[0]?.slug;
|
||||
site.specification = specToSend;
|
||||
site.buildSpecification = specToSend;
|
||||
try {
|
||||
await sdk.forProject(page.params.region, page.params.project).sites.update({
|
||||
siteId: site.$id,
|
||||
@@ -151,7 +151,7 @@
|
||||
providerBranch: site.providerBranch || undefined,
|
||||
providerSilentMode: site.providerSilentMode || undefined,
|
||||
providerRootDirectory: site.providerRootDirectory || undefined,
|
||||
specification: specToSend || undefined
|
||||
buildSpecification: specToSend || undefined
|
||||
});
|
||||
await invalidate(Dependencies.SITE);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
providerBranch: site?.providerBranch || undefined,
|
||||
providerSilentMode: site?.providerSilentMode || undefined,
|
||||
providerRootDirectory: site?.providerRootDirectory || undefined,
|
||||
specification: site?.specification || undefined
|
||||
buildSpecification: site?.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.SITE);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
providerBranch: site?.providerBranch || undefined,
|
||||
providerSilentMode: site?.providerSilentMode || undefined,
|
||||
providerRootDirectory: site?.providerRootDirectory || undefined,
|
||||
specification: site?.specification || undefined
|
||||
buildSpecification: site?.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.SITE);
|
||||
addNotification({
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@
|
||||
providerBranch: selectedBranch || undefined,
|
||||
providerSilentMode: silentMode || undefined,
|
||||
providerRootDirectory: selectedDir || undefined,
|
||||
specification: site?.specification || undefined
|
||||
buildSpecification: site?.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.SITE);
|
||||
addNotification({
|
||||
@@ -152,7 +152,7 @@
|
||||
providerBranch: nextBranch,
|
||||
providerSilentMode: site?.providerSilentMode ?? undefined,
|
||||
providerRootDirectory: site?.providerRootDirectory ?? undefined,
|
||||
specification: site?.specification || undefined
|
||||
buildSpecification: site?.buildSpecification || undefined
|
||||
});
|
||||
|
||||
invalidate(Dependencies.SITE);
|
||||
|
||||
+3
-3
@@ -17,8 +17,8 @@
|
||||
export let site: Models.Site;
|
||||
export let specs: Models.SpecificationList;
|
||||
|
||||
let specification = site.specification;
|
||||
let originalSpecification = site.specification;
|
||||
let specification = site.buildSpecification;
|
||||
let originalSpecification = site.buildSpecification;
|
||||
|
||||
async function updateLogging() {
|
||||
try {
|
||||
@@ -40,7 +40,7 @@
|
||||
providerBranch: site?.providerBranch || undefined,
|
||||
providerSilentMode: site?.providerSilentMode || undefined,
|
||||
providerRootDirectory: site?.providerRootDirectory || undefined,
|
||||
specification: specification || undefined
|
||||
buildSpecification: specification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.SITE);
|
||||
originalSpecification = specification;
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
providerBranch: site?.providerBranch || undefined,
|
||||
providerSilentMode: site?.providerSilentMode || undefined,
|
||||
providerRootDirectory: site?.providerRootDirectory || undefined,
|
||||
specification: site?.specification || undefined
|
||||
buildSpecification: site?.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.SITE);
|
||||
addNotification({
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
providerBranch: site?.providerBranch || undefined,
|
||||
providerSilentMode: site?.providerSilentMode || undefined,
|
||||
providerRootDirectory: site?.providerRootDirectory || undefined,
|
||||
specification: site?.specification || undefined
|
||||
buildSpecification: site?.buildSpecification || undefined
|
||||
});
|
||||
await invalidate(Dependencies.SITE);
|
||||
addNotification({
|
||||
|
||||
Reference in New Issue
Block a user