diff --git a/bun.lock b/bun.lock index eed9e9aa41..1b91f049eb 100644 --- a/bun.lock +++ b/bun.lock @@ -1,12 +1,11 @@ { "lockfileVersion": 1, - "configVersion": 0, "workspaces": { "": { "name": "@appwrite/console", "dependencies": { "@ai-sdk/svelte": "^1.1.24", - "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@6be9e62", + "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@56957ff", "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3", "@appwrite.io/pink-legacy": "^1.0.3", @@ -130,15 +129,15 @@ "@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@6be9e62", { "dependencies": { "json-bigint": "1.0.0" } }, "sha512-XvEyYAb9HtcySeLgn5ZxVCEBhzxSCXfQurcSVp6Wnj1amBFx5CWsKhfWHelG9DxFG9SkeHmY+bTcZneOAhgBkw=="], + "@appwrite.io/console": ["@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@56957ff", { "dependencies": { "json-bigint": "1.0.0" } }], "@appwrite.io/pink-icons": ["@appwrite.io/pink-icons@0.25.0", "", {}, "sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q=="], - "@appwrite.io/pink-icons-svelte": ["@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3", { "peerDependencies": { "svelte": "^4.0.0" } }, "sha512-2HYl/CC2OlfZIR7LzbLXuSPBn0iNkjbnxpaeGCkZ7UNZ/hFeSeeWjDJqTBMdZ8+X95uuZqHx62XPTiE/svuSXQ=="], + "@appwrite.io/pink-icons-svelte": ["@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3", { "peerDependencies": { "svelte": "^4.0.0" } }], "@appwrite.io/pink-legacy": ["@appwrite.io/pink-legacy@1.0.3", "", { "dependencies": { "@appwrite.io/pink-icons": "1.0.0", "the-new-css-reset": "^1.11.2" } }, "sha512-GGde5fmPhs+s6/3aFeMPc/kKADG/gTFkYQSy6oBN8pK0y0XNCLrZZgBv+EBbdhwdtqVEWXa0X85Mv9w7jcIlwQ=="], - "@appwrite.io/pink-svelte": ["@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@8dcaa17", { "dependencies": { "@appwrite.io/pink-icons-svelte": "2.0.0-RC.1", "@floating-ui/dom": "^1.6.13", "@melt-ui/pp": "^0.3.2", "@melt-ui/svelte": "^0.86.6", "@tanstack/svelte-virtual": "^3.13.10", "ansicolor": "^2.0.3", "d3": "^7.9.0", "fuse.js": "^7.1.0", "pretty-bytes": "^6.1.1", "shiki": "^1.18.0", "svelte-motion": "^0.12.2", "svelte-sonner": "^0.3.28" }, "peerDependencies": { "svelte": "^4.0.0" } }, "sha512-rw3zXN7/cUciCnhj0FR8M0H5Db+LYYMaKtPxvOAIMxNTBmStzU8kTw6grqIvdtFu9vybIsjKtIwm9QLHpNDBjA=="], + "@appwrite.io/pink-svelte": ["@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@8dcaa17", { "dependencies": { "@appwrite.io/pink-icons-svelte": "2.0.0-RC.1", "@floating-ui/dom": "^1.6.13", "@melt-ui/pp": "^0.3.2", "@melt-ui/svelte": "^0.86.6", "@tanstack/svelte-virtual": "^3.13.10", "ansicolor": "^2.0.3", "d3": "^7.9.0", "fuse.js": "^7.1.0", "pretty-bytes": "^6.1.1", "shiki": "^1.18.0", "svelte-motion": "^0.12.2", "svelte-sonner": "^0.3.28" }, "peerDependencies": { "svelte": "^4.0.0" } }], "@asamuzakjp/css-color": ["@asamuzakjp/css-color@3.2.0", "", { "dependencies": { "@csstools/css-calc": "^2.1.3", "@csstools/css-color-parser": "^3.0.9", "@csstools/css-parser-algorithms": "^3.0.4", "@csstools/css-tokenizer": "^3.0.3", "lru-cache": "^10.4.3" } }, "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw=="], @@ -1524,8 +1523,6 @@ "@eslint/eslintrc/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], - "@melt-ui/svelte/nanoid": ["nanoid@5.1.16", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ=="], - "@opentelemetry/core/@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.28.0", "", {}, "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA=="], "@opentelemetry/instrumentation-http/@opentelemetry/instrumentation": ["@opentelemetry/instrumentation@0.57.1", "", { "dependencies": { "@opentelemetry/api-logs": "0.57.1", "@types/shimmer": "^1.2.0", "import-in-the-middle": "^1.8.1", "require-in-the-middle": "^7.1.1", "semver": "^7.5.2", "shimmer": "^1.2.1" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-SgHEKXoVxOjc20ZYusPG3Fh+RLIZTSa4x8QtD3NfgAUDyqdFFS9W1F2ZVbZkqDCdyMcQG02Ok4duUGLHJXHgbA=="], diff --git a/package.json b/package.json index 86727369cc..745d595437 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@ai-sdk/svelte": "^1.1.24", - "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@6be9e62", + "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@56957ff", "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3", "@appwrite.io/pink-legacy": "^1.0.3", diff --git a/src/lib/components/git/IconOrigin.svelte b/src/lib/components/git/IconOrigin.svelte new file mode 100644 index 0000000000..184073d564 --- /dev/null +++ b/src/lib/components/git/IconOrigin.svelte @@ -0,0 +1,13 @@ + + + + diff --git a/src/lib/components/git/connectGit.svelte b/src/lib/components/git/connectGit.svelte index 6473f5f6d1..f9b0abe917 100644 --- a/src/lib/components/git/connectGit.svelte +++ b/src/lib/components/git/connectGit.svelte @@ -1,20 +1,14 @@ @@ -41,23 +35,16 @@ title="No installation was added to the project yet" description="Add an installation to connect repositories"> - - - {#if isGiteaEnabled} + + {#each providers as provider (provider.id)} - {/if} + {/each} diff --git a/src/lib/components/git/connectRepoModal.svelte b/src/lib/components/git/connectRepoModal.svelte index faca63d917..7247151062 100644 --- a/src/lib/components/git/connectRepoModal.svelte +++ b/src/lib/components/git/connectRepoModal.svelte @@ -13,7 +13,9 @@ import { Click, trackEvent } from '$lib/actions/analytics'; import RepositoryBehaviour from '$lib/components/git/repositoryBehaviour.svelte'; import { page } from '$app/state'; - import { connectGitHub } from '$lib/stores/git'; + + import { connectVcsProvider, supportsRepositoryCreation } from '$lib/stores/git'; + import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store'; let { show = $bindable(false), @@ -37,6 +39,11 @@ let selectedInstallationId = $state(''); let selectedRepository = $state(''); let installations = $state({ installations: [], total: 0 }); + const canCreateRepository = $derived( + installations.installations.some((entry) => + supportsRepositoryCreation(entry.provider, $regionalConsoleVariables) + ) + ); let error = $state(''); onMount(async () => { @@ -96,7 +103,7 @@ {#if !!installations?.total} - {#if !onlyExisting} + {#if !onlyExisting && canCreateRepository} {/if} {#if repositoryBehaviour === 'new'} @@ -143,12 +150,26 @@ {#if repositoryBehaviour === 'existing'} - - - Missing a repository? check your permissions - - + {#if $installation?.provider === 'origin'} + + + Missing a repository? check your repository access + + + {:else} + + + Missing a repository? check your permissions + + + {/if} {:else if repositoryBehaviour === 'new'} diff --git a/src/lib/components/git/deploymentSource.svelte b/src/lib/components/git/deploymentSource.svelte index 9b3220aaae..cc223e8b1d 100644 --- a/src/lib/components/git/deploymentSource.svelte +++ b/src/lib/components/git/deploymentSource.svelte @@ -20,6 +20,7 @@ Typography } from '@appwrite.io/pink-svelte'; import Button from '$lib/elements/forms/button.svelte'; + import IconOrigin from './IconOrigin.svelte'; let { deployment, @@ -35,6 +36,12 @@ let repository = $state(null); + // The deployment's server-supplied URLs carry the provider; the model has + // no provider field of its own. + const isOrigin = $derived( + (deployment?.providerRepositoryUrl ?? '').toLowerCase().includes('cursor.com') + ); + async function loadRepository() { if (!resource?.installationId || !resource?.providerRepositoryId || !region || !project) { return; @@ -66,7 +73,11 @@ toggle(e); }}> - GitHub + {#if isOrigin} + Origin + {:else} + GitHub + {/if} {#if repository?.authorized === false} @@ -82,8 +93,10 @@ To enable, add the repository to the installation settings on - GitHub + href={isOrigin + ? 'https://cursor.com/codebase/settings/apps' + : `https://github.com/settings/installations/${repository.providerInstallationId}`}> + {isOrigin ? 'Origin' : 'GitHub'} . @@ -97,7 +110,7 @@ + leadingIcon={isOrigin ? IconOrigin : IconGithub}> {deployment.providerRepositoryOwner}/{deployment.providerRepositoryName} import { InputCheckbox, InputSelect, InputText } from '$lib/elements/forms'; import { installation } from '$lib/stores/vcs'; + import { supportsPublicRepositories, supportsRepositoryCreation } from '$lib/stores/git'; + import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store'; import type { Models } from '@appwrite.io/console'; import { Layout } from '@appwrite.io/pink-svelte'; - export let selectedInstallationId: string; - export let installations: Models.InstallationList; - export let repositoryName: string; - export let repositoryPrivate = true; - export let disableFields = false; + let { + selectedInstallationId = $bindable(), + installations, + repositoryName = $bindable(), + repositoryPrivate = $bindable(true), + disableFields = false + }: { + selectedInstallationId: string; + installations: Models.InstallationList; + repositoryName: string; + repositoryPrivate?: boolean; + disableFields?: boolean; + } = $props(); + + // Only offer organizations whose provider can create repositories. + const creatableInstallations = $derived( + installations.installations.filter((entry) => + supportsRepositoryCreation(entry.provider, $regionalConsoleVariables) + ) + ); + + const supportsPublic = $derived( + supportsPublicRepositories( + creatableInstallations.find((entry) => entry.$id === selectedInstallationId)?.provider, + $regionalConsoleVariables + ) + ); + + $effect(() => { + if ( + creatableInstallations.length && + !creatableInstallations.some((entry) => entry.$id === selectedInstallationId) + ) { + selectedInstallationId = creatableInstallations[0].$id; + $installation = creatableInstallations[0]; + } + }); + + $effect(() => { + // Without public repository support every repository is private. + if (!supportsPublic) { + repositoryPrivate = true; + } + }); @@ -18,14 +59,14 @@ id="installation" label="Git organization" disabled={disableFields} - options={installations.installations.map((entry) => { + options={creatableInstallations.map((entry) => { return { label: entry.organization, value: entry.$id }; })} on:change={() => { - $installation = installations.installations.find( + $installation = creatableInstallations.find( (entry) => entry.$id === selectedInstallationId ); }} @@ -38,9 +79,11 @@ disabled={disableFields} bind:value={repositoryName} /> - + {#if supportsPublic} + + {/if} diff --git a/src/lib/components/git/repositories.svelte b/src/lib/components/git/repositories.svelte index df2c800501..619e9ee953 100644 --- a/src/lib/components/git/repositories.svelte +++ b/src/lib/components/git/repositories.svelte @@ -19,7 +19,8 @@ import SvgIcon from '../svgIcon.svelte'; import { Query, VCSDetectionType, type Models } from '@appwrite.io/console'; import { getFrameworkIcon } from '$lib/stores/sites'; - import { connectGitHub } from '$lib/stores/git'; + import { connectVcsProvider, enabledVcsProviders, getVcsProvider } from '$lib/stores/git'; + import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store'; import { addNotification } from '$lib/stores/notifications'; import { page } from '$app/state'; import Card from '../card.svelte'; @@ -27,6 +28,8 @@ import { onMount, untrack, onDestroy } from 'svelte'; import { debounce } from '$lib/helpers/debounce'; + const vcsProviders = enabledVcsProviders($regionalConsoleVariables?._APP_VCS_PROVIDERS); + let { action = $bindable('select'), selectedRepository = $bindable(undefined), @@ -176,18 +179,27 @@ ...installationsMap.map((entry) => { return { label: entry.organization, + leadingIcon: getVcsProvider(entry.provider).icon, value: entry.$id }; }), - { - label: 'Add installation', - leadingIcon: IconPlus, - value: 'new' - } + ...vcsProviders.map((provider) => { + return { + label: + vcsProviders.length > 1 + ? `Add ${provider.label} installation` + : 'Add installation', + leadingIcon: IconPlus, + value: `new-${provider.id}` + }; + }) ]} on:change={() => { - if (selectedInstallation === 'new') { - window.location.href = connectGitHub(callbackState).toString(); + if (selectedInstallation?.startsWith('new-')) { + window.location.href = connectVcsProvider( + selectedInstallation.slice('new-'.length), + callbackState + ).toString(); } search = ''; installation.set( diff --git a/src/lib/components/git/repositoryCard.svelte b/src/lib/components/git/repositoryCard.svelte index 0c64432c55..e4731c2a19 100644 --- a/src/lib/components/git/repositoryCard.svelte +++ b/src/lib/components/git/repositoryCard.svelte @@ -6,10 +6,16 @@ import { IconGithub } from '@appwrite.io/pink-icons-svelte'; import { Card, Icon, Layout, Typography } from '@appwrite.io/pink-svelte'; import { createEventDispatcher } from 'svelte'; + import { installation } from '$lib/stores/vcs'; + import { getProviderOrganizationUrl } from '$lib/stores/git'; + import IconOrigin from './IconOrigin.svelte'; export let repository: Models.ProviderRepository; const dispatch = createEventDispatcher(); + + // ProviderRepository carries no provider, so read it off the owning installation. + $: provider = $installation?.provider ?? 'github'; @@ -24,7 +30,9 @@ alignItems="flex-start" gap="s" style="min-width: 0; flex: 1 1 16rem;"> - + {repository.name} @@ -42,7 +50,7 @@ size="s" variant="muted" external - href={`https://github.com/${repository.organization}`}> + href={getProviderOrganizationUrl(provider, repository.organization)}> {repository.organization} diff --git a/src/lib/helpers/oauth2-cimd.ts b/src/lib/helpers/oauth2-cimd.ts index 7d631f678e..00b47ebcb2 100644 --- a/src/lib/helpers/oauth2-cimd.ts +++ b/src/lib/helpers/oauth2-cimd.ts @@ -83,7 +83,10 @@ export function cimdDocumentToApp(clientId: string, document: unknown): Models.A deviceFlow: Array.isArray(doc.grant_types) && doc.grant_types.includes(DEVICE_GRANT_TYPE), teamId: '', userId: '', - secrets: [] + secrets: [], + labels: [], + installationScopes: [], + installationRedirectUrl: '' }; } diff --git a/src/lib/stores/git.ts b/src/lib/stores/git.ts index 8181f20cce..30851d99e0 100644 --- a/src/lib/stores/git.ts +++ b/src/lib/stores/git.ts @@ -1,7 +1,104 @@ import { page } from '$app/state'; +import type { Models } from '@appwrite.io/console'; +import type { ComponentType } from 'svelte'; +import { IconGithub } from '@appwrite.io/pink-icons-svelte'; +import IconGitea from '$lib/components/git/IconGitea.svelte'; +import IconOrigin from '$lib/components/git/IconOrigin.svelte'; +import { isSelfHosted } from '$lib/system'; import { getApiEndpoint } from './sdk'; -function connectVcsProvider(provider: string, callbackState: Record = null) { +export type VcsProviderId = 'github' | 'origin' | 'gitea'; + +export interface VcsProviderMeta { + id: VcsProviderId; + label: string; + icon: ComponentType; + /** Web URL of an owner/organization on the provider, or '' when the host is not knowable client-side. */ + organizationUrl: (organization: string) => string; + /** Where the user manages the installation's repository access, or null when the provider has no such page. */ + installationSettingsUrl: (providerInstallationId: string) => string | null; + /** GitHub predates the _APP_VCS_PROVIDERS variable, so it stays on unconditionally. */ + alwaysEnabled?: boolean; + /** Gitea is a self-hosted-only feature, not offered on Appwrite Cloud. */ + selfHostedOnly?: boolean; +} + +/** + * Single source of truth for the console's git providers - icons, labels, + * provider URLs and the authorize redirects. Key order is display order: + * GitHub first, Origin second, then the rest. + */ +export const VCS_PROVIDERS: Record = { + github: { + id: 'github', + label: 'GitHub', + icon: IconGithub, + organizationUrl: (organization) => `https://github.com/${organization}`, + installationSettingsUrl: (providerInstallationId) => + `https://github.com/settings/installations/${providerInstallationId}`, + alwaysEnabled: true + }, + origin: { + id: 'origin', + label: 'Origin', + icon: IconOrigin as unknown as ComponentType, + // Origin repositories are browsed in the Codebase section of cursor.com + organizationUrl: () => 'https://cursor.com/codebase', + installationSettingsUrl: () => 'https://cursor.com/codebase/settings/apps' + }, + gitea: { + id: 'gitea', + label: 'Gitea', + icon: IconGitea as unknown as ComponentType, + // The Gitea host is per-deployment server configuration the client does not know + organizationUrl: () => '', + installationSettingsUrl: () => null, + selfHostedOnly: true + } +}; + +/** Provider metadata with a GitHub fallback for unknown ids (cosmetic use only). */ +export function getVcsProvider(provider?: string): VcsProviderMeta { + return VCS_PROVIDERS[provider as VcsProviderId] ?? VCS_PROVIDERS.github; +} + +/** + * Providers the connect UI should offer, honoring the server's + * _APP_VCS_PROVIDERS list and each provider's own gates. + */ +export function enabledVcsProviders(vcsProviders: string[] | undefined): VcsProviderMeta[] { + return Object.values(VCS_PROVIDERS).filter( + (provider) => + provider.alwaysEnabled || + ((vcsProviders?.includes(provider.id) ?? false) && + (!provider.selfHostedOnly || isSelfHosted)) + ); +} + +/** + * Whether the console can create repositories on the provider. Servers that + * predate _APP_VCS_PROVIDERS_WITH_REPOSITORY_CREATION omit the list; keep the + * console's historical behavior (creation offered) for them. + */ +export function supportsRepositoryCreation( + provider: string, + variables: Models.ConsoleVariables +): boolean { + return variables?._APP_VCS_PROVIDERS_WITH_REPOSITORY_CREATION?.includes(provider) ?? true; +} + +/** + * Whether the provider can host public repositories. When it cannot, every + * repository is private and the public/private choice is meaningless. + */ +export function supportsPublicRepositories( + provider: string, + variables: Models.ConsoleVariables +): boolean { + return variables?._APP_VCS_PROVIDERS_WITH_PUBLIC_REPOSITORIES?.includes(provider) ?? true; +} + +export function connectVcsProvider(provider: string, callbackState: Record = null) { const redirect = new URL(page.url); if (callbackState) { Object.keys(callbackState).forEach((key) => { @@ -24,6 +121,25 @@ export function connectGitea(callbackState: Record = null) { return connectVcsProvider('gitea', callbackState); } +export function connectOrigin(callbackState: Record = null) { + return connectVcsProvider('origin', callbackState); +} + +/** + * Browser URL of an owner/organization on the provider. Unknown providers + * fall back to GitHub, matching the console's historical behavior. + */ +export function getProviderOrganizationUrl(provider: string, organization: string): string { + return getVcsProvider(provider).organizationUrl(organization); +} + +/** + * Browser URL of a repository on the provider. + */ +export function getProviderRepositoryUrl(provider: string, organization: string, name: string) { + return `${getProviderOrganizationUrl(provider, organization)}/${name}`; +} + export function deploymentStatusConverter(status: string) { // Status component possible values - status: 'waiting' | 'ready' | 'processing' | 'pending' | 'failed' | 'complete'; switch (status) { diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts index cdea8ebd19..0001d9a684 100644 --- a/src/lib/stores/sdk.ts +++ b/src/lib/stores/sdk.ts @@ -9,7 +9,6 @@ import { Client, Console, Functions, - Health, Locale, Messaging, Migrations, @@ -31,7 +30,8 @@ import { Webhooks, Realtime, Organizations, - VectorsDB + VectorsDB, + Embeddings } from '@appwrite.io/console'; import { buildRegionalV1Endpoint } from '$lib/helpers/apiEndpoint'; import { Sources } from '$lib/sdk/sources'; @@ -54,7 +54,6 @@ function createConsoleSdk(client: Client) { oauth2: new Oauth2(client), avatars: new Avatars(client), functions: new Functions(client), - health: new Health(client), locale: new Locale(client), projects: new Projects(client), teams: new Teams(client), @@ -115,7 +114,6 @@ const sdkForProject = { avatars: new Avatars(clientProject), backups: new Backups(clientProject), functions: new Functions(clientProject), - health: new Health(clientProject), locale: new Locale(clientProject), messaging: new Messaging(clientProject), project: new Project(clientProject), @@ -131,6 +129,7 @@ const sdkForProject = { tablesDB: new TablesDB(clientProject), documentsDB: new DocumentsDB(clientProject), vectorsDB: new VectorsDB(clientProject), + embeddings: new Embeddings(clientProject), webhooks: new Webhooks(clientProject), console: new Console(clientProject) // for suggestions API }; diff --git a/src/routes/(console)/account/payments/addressModal.svelte b/src/routes/(console)/account/payments/addressModal.svelte index af186cb103..57ea22c101 100644 --- a/src/routes/(console)/account/payments/addressModal.svelte +++ b/src/routes/(console)/account/payments/addressModal.svelte @@ -10,7 +10,7 @@ import type { Models } from '@appwrite.io/console'; export let show = false; - export let locale: Models.CloudLocale; + export let locale: Models.Locale; export let organization: string = null; export let countryList: Models.CountryList; diff --git a/src/routes/(console)/account/payments/billingAddress.svelte b/src/routes/(console)/account/payments/billingAddress.svelte index 703ad7e902..5e9b888376 100644 --- a/src/routes/(console)/account/payments/billingAddress.svelte +++ b/src/routes/(console)/account/payments/billingAddress.svelte @@ -29,7 +29,7 @@ export let data: PageData; - const locale: Models.CloudLocale = data.locale; + const locale: Models.Locale = data.locale; const countryList: Models.CountryList = data.countryList; let show = false; diff --git a/src/routes/(console)/account/payments/editAddressModal.svelte b/src/routes/(console)/account/payments/editAddressModal.svelte index 0fc1fdad9a..891b65103f 100644 --- a/src/routes/(console)/account/payments/editAddressModal.svelte +++ b/src/routes/(console)/account/payments/editAddressModal.svelte @@ -10,7 +10,7 @@ import type { Models } from '@appwrite.io/console'; export let show = false; - export let locale: Models.CloudLocale; + export let locale: Models.Locale; export let countryList: Models.CountryList; export let selectedAddress: Models.BillingAddress; diff --git a/src/routes/(console)/organization-[organization]/billing/billingAddress.svelte b/src/routes/(console)/organization-[organization]/billing/billingAddress.svelte index 6dbc5bfabb..ebecd52319 100644 --- a/src/routes/(console)/organization-[organization]/billing/billingAddress.svelte +++ b/src/routes/(console)/organization-[organization]/billing/billingAddress.svelte @@ -22,7 +22,7 @@ } from '@appwrite.io/pink-icons-svelte'; import type { Models } from '@appwrite.io/console'; - export let locale: Models.CloudLocale; + export let locale: Models.Locale; export let countryList: Models.CountryList; export let organization: Models.Organization; export let billingAddress: Models.BillingAddress; diff --git a/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte b/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte index 926f21319e..56798f55b3 100644 --- a/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte +++ b/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte @@ -13,7 +13,7 @@ import type { Models } from '@appwrite.io/console'; export let show = false; - export let locale: Models.CloudLocale; + export let locale: Models.Locale; export let countryList: Models.CountryList; let loading = true; diff --git a/src/routes/(console)/organization-[organization]/settings/Soc2.svelte b/src/routes/(console)/organization-[organization]/settings/Soc2.svelte index 7d71dbd609..167a802613 100644 --- a/src/routes/(console)/organization-[organization]/settings/Soc2.svelte +++ b/src/routes/(console)/organization-[organization]/settings/Soc2.svelte @@ -5,7 +5,7 @@ import type { Models } from '@appwrite.io/console'; let show = false; - export let locale: Models.CloudLocale; + export let locale: Models.Locale; export let countryList: Models.CountryList; diff --git a/src/routes/(console)/organization-[organization]/settings/Soc2Modal.svelte b/src/routes/(console)/organization-[organization]/settings/Soc2Modal.svelte index 34331de126..c4b3b645d1 100644 --- a/src/routes/(console)/organization-[organization]/settings/Soc2Modal.svelte +++ b/src/routes/(console)/organization-[organization]/settings/Soc2Modal.svelte @@ -11,7 +11,7 @@ import type { Models } from '@appwrite.io/console'; export let show = false; - export let locale: Models.CloudLocale; + export let locale: Models.Locale; export let countryList: Models.CountryList; let email = ''; diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers/terminology.ts b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers/terminology.ts index 02fb339a2a..8ca9c32a90 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers/terminology.ts +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/helpers/terminology.ts @@ -1,15 +1,19 @@ import type { Page } from '@sveltejs/kit'; import { capitalize, plural } from '$lib/helpers/string'; -import { AppwriteException, type TablesDBIndexType, type Models } from '@appwrite.io/console'; +import { + AppwriteException, + type DatabaseType as ConsoleDatabaseType, + type TablesDBIndexType, + type Models +} from '@appwrite.io/console'; import type { Attributes, Collection, Columns, Table } from '$database/store'; import type { Term, TerminologyResult, TerminologyShape } from '$database/(entity)/helpers/types'; type BaseTerminology = typeof baseTerminology; type ImplementedDBTypes = Omit; -/* manual type for the time being because vectorsdb is pending */ -export type DatabaseType = 'legacy' | 'tablesdb' | 'documentsdb' | 'vectorsdb'; +export type DatabaseType = `${ConsoleDatabaseType}`; export type CollectionDatabaseType = Extract; export const DEFAULT_VECTOR_DIMENSION = 768; diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/(components)/editor/embeddingModal.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/(components)/editor/embeddingModal.svelte index 51d427291b..5269113176 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/(components)/editor/embeddingModal.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/(components)/editor/embeddingModal.svelte @@ -27,7 +27,7 @@ try { const response = await sdk .forProject(page.params.region, page.params.project) - .vectorsDB.createTextEmbeddings({ texts: [content.trim()] }); + .embeddings.createTextEmbeddings({ texts: [content.trim()] }); const embedding = response?.embeddings?.[0]?.embedding; if (embedding?.length) { diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+page.svelte index 017e1a03a0..6186c43475 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+page.svelte @@ -105,7 +105,8 @@ .migrations.createJSONImport({ bucketId: pendingFile.bucketId, fileId: pendingFile.$id, - resourceId: `${page.params.database}:${page.params.collection}`, + databaseId: page.params.database, + collectionId: page.params.collection, internalFile: pendingLocalFile, onDuplicate: importOnDuplicate }); diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/export/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/export/+page.svelte index a4a2b7e9aa..9d19f13b9c 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/export/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/export/+page.svelte @@ -56,7 +56,8 @@ await sdk .forProject(page.params.region, page.params.project) .migrations.createJSONExport({ - resourceId: `${page.params.database}:${page.params.collection}`, + databaseId: page.params.database, + collectionId: page.params.collection, filename: filename, columns: [], queries: exportWithFilters ? Array.from(localQueries.values()) : [], diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte index f1fe008679..89444b447a 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte @@ -139,7 +139,8 @@ .migrations.createCSVImport({ bucketId: pendingFile.bucketId, fileId: pendingFile.$id, - resourceId: `${page.params.database}:${page.params.table}`, + databaseId: page.params.database, + collectionId: page.params.table, internalFile: pendingLocalFile, onDuplicate: importOnDuplicate }); diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/export/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/export/+page.svelte index 9ed600090f..8291162dbb 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/export/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/export/+page.svelte @@ -101,7 +101,8 @@ await sdk .forProject(page.params.region, page.params.project) .migrations.createCSVExport({ - resourceId: `${page.params.database}:${page.params.table}`, + databaseId: page.params.database, + collectionId: page.params.table, filename: filename, columns: selectedCols, queries: exportWithFilters ? Array.from(localQueries.values()) : [], diff --git a/src/routes/(console)/project-[region]-[project]/functions/create-function/(components)/aside.svelte b/src/routes/(console)/project-[region]-[project]/functions/create-function/(components)/aside.svelte index 4acf3d41a7..2b473c61a7 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/create-function/(components)/aside.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/create-function/(components)/aside.svelte @@ -1,7 +1,9 @@