Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 23 additions & 1 deletion src/lib/stores/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const initialFormData = {
sites: {
root: false,
deploymentInactive: false
},
messaging: {
root: false,
messages: false
}
};

Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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];
};
Expand Down Expand Up @@ -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;
};
Expand Down
7 changes: 6 additions & 1 deletion src/routes/(console)/(migration-wizard)/resource-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -127,7 +131,8 @@
databases: 'database',
functions: 'function',
storage: 'bucket',
sites: 'site'
sites: 'site',
messaging: 'provider'
};
return map[groupKey] || groupKey;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
commands: installCommand || undefined,
scopes: selectedScopes?.length ? selectedScopes : undefined,
providerSilentMode: false,
specification: specification || undefined
buildSpecification: specification || undefined
});

// Add domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
enabled: true,
entrypoint,
commands: buildCommand,
specification: specification || undefined
buildSpecification: specification || undefined
});

// Add domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
providerBranch: branch,
providerSilentMode: silentMode,
providerRootDirectory: rootDir,
specification: specification || undefined
buildSpecification: specification || undefined
});

// Add domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
providerBranch: branch,
providerSilentMode: silentMode,
providerRootDirectory: rootDir,
specification: specification || undefined
buildSpecification: specification || undefined
});

// Add domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
sites: {
root: 'Sites',
deploymentInactive: 'Include inactive deployments'
},
messaging: {
root: 'Messaging',
messages: 'Include messages'
}
};

Expand All @@ -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'
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand All @@ -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,
Expand All @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Loading
Loading