chore: merge conflicts

This commit is contained in:
Arman committed 2025-05-02 14:15:20 +02:00
1 parent 665eac6b89
commit 43de6fae0a
233 files changed
+1684 -1582

No files matched your search

+68 -18
View File
@@ -10,10 +10,13 @@ importers:
dependencies:
'@ai-sdk/svelte':
specifier: ^1.1.24
version: 1.1.24(svelte@4.2.19)(zod@3.24.2)
version: 1.1.24(svelte@5.25.3)(zod@3.24.3)
'@appwrite.io/console':
specifier: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@e2f082e
version: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@e2f082e
specifier: 1.6.0
version: 1.6.0
'@appwrite.io/pink':
specifier: 0.25.0
version: 0.25.0
'@appwrite.io/pink-icons':
specifier: 0.25.0
version: 0.25.0
@@ -251,9 +254,8 @@ packages:
'@analytics/type-utils@0.6.2':
resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==}
'@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@e2f082e':
resolution: {tarball: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@e2f082e}
version: 1.2.1
'@appwrite.io/console@1.6.0':
resolution: {integrity: sha512-o8dvCeJcnMORozB2NdLCiN042HyyLLQzteiTelU83dTgp7q2E1DTKu69hFwyMgoEXqcxMmKeJKmMI/1qt002IQ==}
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bd21ff7f':
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bd21ff7f}
@@ -283,6 +285,9 @@ packages:
react-dom: ^18.0.0
svelte: ^4.0.0
'@appwrite.io/pink@0.25.0':
resolution: {integrity: sha512-9z4G/iAhjvVpM7tkNqzGqrokst4hvNt3Fkf2jD4W6n8j//EJbQ3mJ0I+5dye5Sry0a33wUanq5DSztqFNYq5zw==}
'@asamuzakjp/css-color@3.1.1':
resolution: {integrity: sha512-hpRD68SV2OMcZCsrbdkccTw5FXjNDLo5OuqSHyHZfwweGsDWZwDJ2+gONyNAbazZclobMirACLw0lk8WVxIqxA==}
@@ -2091,6 +2096,9 @@ packages:
resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==}
engines: {node: '>=4.0'}
estree-walker@2.0.2:
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
estree-walker@3.0.3:
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
@@ -2098,6 +2106,10 @@ packages:
resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}
engines: {node: '>=0.10.0'}
eventsource-parser@1.0.0:
resolution: {integrity: sha512-9jgfSCa3dmEme2ES3mPByGXfgZ87VbP97tng1G2nWwWx6bV2nYxm2AWCrbQjXToSe+yYlqaZNtxffR9IeQr95g==}
engines: {node: '>=14.18'}
eventsource-parser@3.0.0:
resolution: {integrity: sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA==}
engines: {node: '>=18.0.0'}
@@ -2650,6 +2662,9 @@ packages:
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
engines: {node: '>=0.10.0'}
normalize.css@8.0.1:
resolution: {integrity: sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==}
nwsapi@2.2.20:
resolution: {integrity: sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==}
@@ -2957,6 +2972,9 @@ packages:
scheduler@0.23.2:
resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
secure-json-parse@2.7.0:
resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}
semver@6.3.1:
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
hasBin: true
@@ -3519,6 +3537,14 @@ packages:
zimmerframe@1.1.2:
resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==}
zod-to-json-schema@3.24.5:
resolution: {integrity: sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==}
peerDependencies:
zod: ^3.24.1
zod@3.24.3:
resolution: {integrity: sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==}
zrender@5.6.1:
resolution: {integrity: sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==}
@@ -3529,35 +3555,35 @@ snapshots:
'@adobe/css-tools@4.4.2': {}
'@ai-sdk/provider-utils@2.1.13(zod@3.24.2)':
'@ai-sdk/provider-utils@2.1.13(zod@3.24.3)':
dependencies:
'@ai-sdk/provider': 1.0.11
eventsource-parser: 3.0.0
nanoid: 3.3.9
nanoid: 3.3.11
secure-json-parse: 2.7.0
optionalDependencies:
zod: 3.24.2
zod: 3.24.3
'@ai-sdk/provider@1.0.11':
dependencies:
json-schema: 0.4.0
'@ai-sdk/svelte@1.1.24(svelte@4.2.19)(zod@3.24.2)':
'@ai-sdk/svelte@1.1.24(svelte@5.25.3)(zod@3.24.3)':
dependencies:
'@ai-sdk/provider-utils': 2.1.13(zod@3.24.2)
'@ai-sdk/ui-utils': 1.1.19(zod@3.24.2)
'@ai-sdk/provider-utils': 2.1.13(zod@3.24.3)
'@ai-sdk/ui-utils': 1.1.19(zod@3.24.3)
optionalDependencies:
svelte: 4.2.19
svelte: 5.25.3
transitivePeerDependencies:
- zod
'@ai-sdk/ui-utils@1.1.19(zod@3.24.2)':
'@ai-sdk/ui-utils@1.1.19(zod@3.24.3)':
dependencies:
'@ai-sdk/provider': 1.0.11
'@ai-sdk/provider-utils': 2.1.13(zod@3.24.2)
zod-to-json-schema: 3.24.3(zod@3.24.2)
'@ai-sdk/provider-utils': 2.1.13(zod@3.24.3)
zod-to-json-schema: 3.24.5(zod@3.24.3)
optionalDependencies:
zod: 3.24.2
zod: 3.24.3
'@ampproject/remapping@2.3.0':
dependencies:
@@ -3598,7 +3624,7 @@ snapshots:
'@analytics/type-utils@0.6.2': {}
'@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@e2f082e': {}
'@appwrite.io/console@1.6.0': {}
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bd21ff7f(svelte@5.25.3)':
dependencies:
@@ -3633,6 +3659,12 @@ snapshots:
svelte-motion: 0.12.2(svelte@5.25.3)
svelte-sonner: 0.3.28(svelte@5.25.3)
'@appwrite.io/pink@0.25.0':
dependencies:
'@appwrite.io/pink-icons': 0.25.0
normalize.css: 8.0.1
the-new-css-reset: 1.11.3
'@asamuzakjp/css-color@3.1.1':
dependencies:
'@csstools/css-calc': 2.1.2(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)
@@ -5688,12 +5720,16 @@ snapshots:
estraverse@5.3.0: {}
estree-walker@2.0.2: {}
estree-walker@3.0.3:
dependencies:
'@types/estree': 1.0.7
esutils@2.0.3: {}
eventsource-parser@1.0.0: {}
eventsource-parser@3.0.0: {}
expect-type@1.2.0: {}
@@ -6218,6 +6254,8 @@ snapshots:
normalize-path@3.0.0: {}
normalize.css@8.0.1: {}
nwsapi@2.2.20: {}
object-inspect@1.13.4: {}
@@ -6400,6 +6438,10 @@ snapshots:
react-is@17.0.2: {}
react@18.3.1:
dependencies:
loose-envify: 1.4.0
readdirp@3.6.0:
dependencies:
picomatch: 2.3.1
@@ -6528,6 +6570,8 @@ snapshots:
dependencies:
loose-envify: 1.4.0
secure-json-parse@2.7.0: {}
semver@6.3.1: {}
semver@7.7.1: {}
@@ -7083,6 +7127,12 @@ snapshots:
zimmerframe@1.1.2: {}
zod-to-json-schema@3.24.5(zod@3.24.3):
dependencies:
zod: 3.24.3
zod@3.24.3: {}
zrender@5.6.1:
dependencies:
tslib: 2.3.0
+10 -12
View File
@@ -4,7 +4,7 @@ import { project } from '$routes/(console)/project-[region]-[project]/store';
import { get } from 'svelte/store';
import type { Searcher } from '../commands';
import type { Models } from '@appwrite.io/console';
import { page } from '$app/stores';
import { page } from '$app/state';
import { showCreateDeployment } from '$routes/(console)/project-[region]-[project]/functions/function-[function]/store';
import { base } from '$app/paths';
import { IconLightningBolt, IconPlus } from '@appwrite.io/pink-icons-svelte';
@@ -21,10 +21,9 @@ const getFunctionCommand = (fn: Models.Function, region: string, projectId: stri
};
export const functionsSearcher = (async (query: string) => {
const $page = get(page);
const projectId = get(project).$id;
const { functions } = await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.functions.list();
const filtered = functions.filter((fn) => fn.name.toLowerCase().includes(query.toLowerCase()));
@@ -32,15 +31,14 @@ export const functionsSearcher = (async (query: string) => {
if (filtered.length === 1) {
const func = filtered[0];
return [
getFunctionCommand(func, $page.params.region, projectId),
getFunctionCommand(func, page.params.region, projectId),
{
label: 'Create deployment',
nested: true,
async callback() {
const $page = get(page);
if (!$page.url.pathname.endsWith(func.$id)) {
if (!page.url.pathname.endsWith(func.$id)) {
await goto(
`${base}/project-${$page.params.region}-${projectId}/functions/function-${func.$id}`
`${base}/project-${page.params.region}-${projectId}/functions/function-${func.$id}`
);
}
showCreateDeployment.set(true);
@@ -53,7 +51,7 @@ export const functionsSearcher = (async (query: string) => {
nested: true,
callback() {
goto(
`${base}/project-${$page.params.region}-${projectId}/functions/function-${func.$id}`
`${base}/project-${page.params.region}-${projectId}/functions/function-${func.$id}`
);
},
group: 'functions'
@@ -63,7 +61,7 @@ export const functionsSearcher = (async (query: string) => {
nested: true,
callback() {
goto(
`${base}/project-${$page.params.region}-${projectId}/functions/function-${func.$id}/usage`
`${base}/project-${page.params.region}-${projectId}/functions/function-${func.$id}/usage`
);
},
group: 'functions'
@@ -73,7 +71,7 @@ export const functionsSearcher = (async (query: string) => {
nested: true,
callback() {
goto(
`${base}/project-${$page.params.region}-${projectId}/functions/function-${func.$id}/executions`
`${base}/project-${page.params.region}-${projectId}/functions/function-${func.$id}/executions`
);
},
group: 'functions'
@@ -83,7 +81,7 @@ export const functionsSearcher = (async (query: string) => {
nested: true,
callback() {
goto(
`${base}/project-${$page.params.region}-${projectId}/functions/function-${func.$id}/settings`
`${base}/project-${page.params.region}-${projectId}/functions/function-${func.$id}/settings`
);
},
group: 'functions'
@@ -91,5 +89,5 @@ export const functionsSearcher = (async (query: string) => {
];
}
return filtered.map((fn) => getFunctionCommand(fn, $page.params.region, projectId));
return filtered.map((fn) => getFunctionCommand(fn, page.params.region, projectId));
}) satisfies Searcher;
@@ -1,12 +1,12 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Button } from '$lib/elements/forms';
import { HeaderAlert } from '$lib/layout';
import { failedInvoice } from '$lib/stores/billing';
import { organization } from '$lib/stores/organization';
$: isOnProjects = $page.route.id.includes('project-[project]');
$: isOnProjects = page.route.id.includes('project-[region]-[project]');
</script>
{#if $failedInvoice && $failedInvoice.teamId === $organization.$id && isOnProjects}
+2 -2
View File
@@ -13,7 +13,7 @@
import { BillingPlan } from '$lib/constants';
import { upgradeURL } from '$lib/stores/billing';
import { addBottomModalAlerts } from '$routes/(console)/bottomAlerts';
import { project } from '$routes/(console)/project-[project]/store';
import { project } from '$routes/(console)/project-[region]-[project]/store';
import { page } from '$app/state';
import { Click, trackEvent } from '$lib/actions/analytics';
@@ -21,7 +21,7 @@
let openModalOnMobile = false;
function getPageScope(pathname: string) {
const isProjectPage = pathname.includes('project-[project]');
const isProjectPage = pathname.includes('project-[region]-[project]');
const isOrganizationPage = pathname.includes('organization-[organization]');
return { isProjectPage, isOrganizationPage };
+1 -1
View File
@@ -11,7 +11,7 @@
import { addNotification } from '$lib/stores/notifications';
import { page } from '$app/state';
import { Typography } from '@appwrite.io/pink-svelte';
import { project } from '$routes/(console)/project-[project]/store';
import { project } from '$routes/(console)/project-[region]-[project]/store';
$: $selectedFeedback = feedbackOptions.find((option) => option.type === $feedback.type);
@@ -12,6 +12,7 @@
import { addNotification } from '$lib/stores/notifications';
import { Click, trackEvent } from '$lib/actions/analytics';
import RepositoryBehaviour from '$lib/components/git/repositoryBehaviour.svelte';
import { page } from '$app/state';
let {
show = $bindable(false),
@@ -38,7 +39,9 @@
let error = $state('');
onMount(async () => {
installations = await sdk.forProject.vcs.listInstallations();
installations = await sdk
.forProject(page.params.region, page.params.project)
.vcs.listInstallations();
if (!$installation?.$id && installations?.total) {
$installation = installations.installations[0];
}
@@ -51,11 +54,9 @@
async function connectRepo() {
try {
if (repositoryBehaviour === 'new') {
const repo = await sdk.forProject.vcs.createRepository(
$installation.$id,
repositoryName,
repositoryPrivate
);
const repo = await sdk
.forProject(page.params.region, page.params.project)
.vcs.createRepository($installation.$id, repositoryName, repositoryPrivate);
repository.set(repo);
selectedRepository = repo.id;
}
@@ -4,6 +4,7 @@
import SelectRootModal from './selectRootModal.svelte';
import { sdk } from '$lib/stores/sdk';
import { sortBranches } from '$lib/stores/vcs';
import { page } from '$app/state';
export let branch = 'main';
export let rootDir: string;
@@ -15,10 +16,9 @@
let show = false;
async function loadBranches() {
const { branches } = await sdk.forProject.vcs.listRepositoryBranches(
installationId,
repositoryId
);
const { branches } = await sdk
.forProject(page.params.region, page.params.project)
.vcs.listRepositoryBranches(installationId, repositoryId);
const sorted = sortBranches(branches);
branch = sorted[0]?.name ?? null;
+19 -12
View File
@@ -3,7 +3,7 @@
import { Button, InputSearch, InputSelect } from '$lib/elements/forms';
import { timeFromNow } from '$lib/helpers/date';
import { sdk } from '$lib/stores/sdk';
import { repositories } from '$routes/(console)/project-[project]/functions/function-[function]/store';
import { repositories } from '$routes/(console)/project-[region]-[project]/functions/function-[function]/store';
import { installation, installations, repository } from '$lib/stores/vcs';
import {
Layout,
@@ -20,6 +20,7 @@
import { VCSDetectionType, type Models } from '@appwrite.io/console';
import { getFrameworkIcon } from '$lib/stores/sites';
import { connectGitHub } from '$lib/stores/git';
import { page } from '$app/state';
let {
action = $bindable('select'),
@@ -54,7 +55,9 @@
}
return installationList.installations;
} else {
const { installations } = await sdk.forProject.vcs.listInstallations();
const { installations } = await sdk
.forProject(page.params.region, page.params.project)
.vcs.listInstallations();
if (installations.length) {
selectedInstallation = installations[0].$id;
installation.set(installations.find((entry) => entry.$id === selectedInstallation));
@@ -85,19 +88,23 @@
async function fetchRepos(installationId: string, search: string) {
if (product === 'functions') {
$repositories.repositories = (
(await sdk.forProject.vcs.listRepositories(
installationId,
VCSDetectionType.Runtime,
search || undefined
)) as unknown as Models.ProviderRepositoryRuntimeList
(await sdk
.forProject(page.params.region, page.params.project)
.vcs.listRepositories(
installationId,
VCSDetectionType.Runtime,
search || undefined
)) as unknown as Models.ProviderRepositoryRuntimeList
).runtimeProviderRepositories; //TODO: remove forced cast after backend fixes
} else {
$repositories.repositories = (
(await sdk.forProject.vcs.listRepositories(
installationId,
VCSDetectionType.Framework,
search || undefined
)) as unknown as Models.ProviderRepositoryFrameworkList
(await sdk
.forProject(page.params.region, page.params.project)
.vcs.listRepositories(
installationId,
VCSDetectionType.Framework,
search || undefined
)) as unknown as Models.ProviderRepositoryFrameworkList
).frameworkProviderRepositories;
}
}
+15 -16
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import { page } from '$app/state';
import { Modal } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { iconPath } from '$lib/stores/app';
@@ -39,11 +40,9 @@
onMount(async () => {
try {
const content = await sdk.forProject.vcs.getRepositoryContents(
$installation.$id,
$repository.id,
currentPath
);
const content = await sdk
.forProject(page.params.region, page.params.project)
.vcs.getRepositoryContents($installation.$id, $repository.id, currentPath);
// console.log(content);
directories[0].fileCount = content.contents?.length ?? 0;
directories[0].children = content.contents
@@ -83,11 +82,9 @@
directories = [...directories];
try {
const content = await sdk.forProject.vcs.getRepositoryContents(
$installation.$id,
$repository.id,
path
);
const content = await sdk
.forProject(page.params.region, page.params.project)
.vcs.getRepositoryContents($installation.$id, $repository.id, path);
// console.log(content);
const fileCount = content.contents?.length ?? 0;
const contentDirectories = content.contents.filter((e) => e.isDirectory);
@@ -103,12 +100,14 @@
fileCount: undefined,
thumbnailUrl: undefined
}));
const runtime = await sdk.forProject.vcs.createRepositoryDetection(
$installation.$id,
$repository.id,
product === 'sites' ? VCSDetectionType.Framework : VCSDetectionType.Runtime,
path
);
const runtime = await sdk
.forProject(page.params.region, page.params.project)
.vcs.createRepositoryDetection(
$installation.$id,
$repository.id,
product === 'sites' ? VCSDetectionType.Framework : VCSDetectionType.Runtime,
path
);
if (product === 'sites') {
currentDir.children.forEach((dir) => {
dir.thumbnailUrl = $iconPath(runtime.framework, 'color');
+1 -1
View File
@@ -21,7 +21,7 @@
const url = new URL(pageStore.url);
const previousLimit = Number(url.searchParams.get('limit'));
url.searchParams.set('limit', limit.toString());
preferences.setLimit($pageStore.params.project, $pageStore.route, limit);
preferences.setLimit(pageStore.params.project, pageStore.route, limit);
if (url.searchParams.has('page')) {
const page = Number(url.searchParams.get('page'));
+2 -2
View File
@@ -11,7 +11,7 @@
<Alert.Inline status="info" title="Your logs are disabled">
To view logs and errors, enable them in your
<Link
href={`${base}/project-${page.params.project}/sites/site-${page.params.site}/settings`}>
href={`${base}/project-${page.params.region}-${page.params.project}/sites/site-${page.params.site}/settings`}>
site settings</Link
>.
</Alert.Inline>
@@ -19,7 +19,7 @@
<Alert.Inline status="info" title="Your execution logs are disabled">
To view execution logs and errors, enable them in your
<Link
href={`${base}/project-${page.params.project}/functions/function-${page.params.function}/settings`}>
href={`${base}/project-${page.params.region}-${page.params.project}/functions/function-${page.params.function}/settings`}>
function settings</Link
>.
</Alert.Inline>
+2 -2
View File
@@ -1,5 +1,5 @@
<script lang="ts" context="module">
import { page } from '$app/stores';
import { page } from '$app/state';
import { parseIfString } from '$lib/helpers/object';
import { getProjectId } from '$lib/helpers/project';
import { realtime } from '$lib/stores/sdk';
@@ -51,7 +51,7 @@
onMount(() => {
return realtime
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.subscribe<Models.Migration>(['console'], async (response) => {
if (!response.channels.includes(`projects.${getProjectId()}`)) return;
if (response.events.includes('migrations.*')) {
+5 -1
View File
@@ -1,8 +1,12 @@
import { isValueOfStringEnum } from '$lib/helpers/types';
import { Flag } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { page } from '$app/state';
export function getFlagUrl(countryCode: string) {
if (!isValueOfStringEnum(Flag, countryCode)) return '';
return sdk.forProject.avatars.getFlag(countryCode, 22, 15, 100)?.toString();
return sdk
.forProject(page.params.region, page.params.project)
.avatars.getFlag(countryCode, 22, 15, 100)
?.toString();
}
+4 -11
View File
@@ -9,15 +9,8 @@ export function getPage(url: URL): number {
return Number(url.searchParams.get('page'));
}
export function getLimit(
projectId: string,
url: URL,
route: Page['route'],
fallback: number
): number {
return Number(
url.searchParams.get('limit') ?? preferences.get(projectId, route).limit ?? fallback
);
export function getLimit(url: URL, route: Page['route'], fallback: number): number {
return Number(url.searchParams.get('limit') ?? preferences.get(route).limit ?? fallback);
}
export enum View {
@@ -35,8 +28,8 @@ export function getView(url: URL, route: Page['route'], fallback: View, overwrit
: (overwrite ?? View.Table ?? fallback);
}
export function getColumns(projectId: string, route: Page['route'], fallback: string[]): string[] {
return preferences.get(projectId, route).columns ?? fallback;
export function getColumns(route: Page['route'], fallback: string[]): string[] {
return preferences.get(route).columns ?? fallback;
}
export function getSearch(url: URL): string | undefined {
+3 -3
View File
@@ -1,4 +1,4 @@
import { page } from '$app/stores';
import { page } from '$app/state';
import { get } from 'svelte/store';
import { sdk } from '$lib/stores/sdk';
import { projectRegion } from '$routes/(console)/project-[region]-[project]/store';
@@ -6,7 +6,7 @@ import { projectRegion } from '$routes/(console)/project-[region]-[project]/stor
/**
* Returns the current project ID.
*
* The function first checks for a `project` parameter in the Svelte `$page` store.
* The function first checks for a `project` parameter in the Svelte `page` store.
* If not found, it extracts the project ID from the pathname.
*
* Supports:
@@ -20,7 +20,7 @@ import { projectRegion } from '$routes/(console)/project-[region]-[project]/stor
*/
export function getProjectId(): string | null {
// safety check!
const projectFromParams = get(page)?.params?.project;
const projectFromParams = page?.params?.project;
if (projectFromParams) {
return projectFromParams;
}
+1 -1
View File
@@ -2,7 +2,6 @@
import { beforeNavigate } from '$app/navigation';
import { Navbar, Sidebar } from '$lib/components';
import type { NavbarProject } from '$lib/components/navbar.svelte';
import { page } from '$app/stores';
import { wizard } from '$lib/stores/wizard';
import { activeHeaderAlert } from '$routes/(console)/store';
import { setContext } from 'svelte';
@@ -18,6 +17,7 @@
import { hasOnboardingDismissed } from '$lib/helpers/onboarding';
import { isSidebarOpen } from '$lib/stores/sidebar';
import { BillingPlan } from '$lib/constants';
import { page } from '$app/stores';
export let showSideNavigation = false;
export let showHeader = true;
+2 -2
View File
@@ -8,14 +8,14 @@
import Step2 from './wizard/step2.svelte';
import { onMount } from 'svelte';
import type { Models } from '@appwrite.io/console';
import { page } from '$app/stores';
import { page } from '$app/state';
import { realtime } from '$lib/stores/sdk';
onMount(() => {
domain.set({ $id: '', domain: '' });
return realtime
.forProject($page.params.region, $page.params.region)
.forProject(page.params.region, page.params.region)
.subscribe<Models.ProxyRule>('console', (data) => domain.set(data.payload));
});
+1 -1
View File
@@ -61,7 +61,7 @@
</Layout.Stack>
<Layout.Stack direction="row" alignItems="center" justifyContent="flex-end">
<Button
href={`${base}/project-${page.params.project}/settings/domains/create`}
href={`${base}/project-${page.params.region}-${page.params.project}/settings/domains/create`}
event="create_user"
size="s">
<Icon size="s" icon={IconPlus} slot="start" />
+1 -1
View File
@@ -4,7 +4,7 @@
import { WizardStep } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { isSelfHosted } from '$lib/system';
import { func } from '$routes/(console)/project-[project]/functions/function-[function]/store';
import { func } from '$routes/(console)/project-[region]-[project]/functions/function-[function]/store';
import { domain } from './store';
import { consoleVariables } from '$routes/(console)/store';
import { Alert } from '@appwrite.io/pink-svelte';
+3 -2
View File
@@ -1,5 +1,4 @@
import { page } from '$app/state';
import { get } from 'svelte/store';
import { sdk } from './sdk';
export function connectGitHub(callbackState: Record<string, string> = null) {
@@ -9,7 +8,9 @@ export function connectGitHub(callbackState: Record<string, string> = null) {
redirect.searchParams.append(key, callbackState[key]);
});
}
const target = new URL(`${sdk.forProject.client.config.endpoint}/vcs/github/authorize`);
const target = new URL(
`${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}/vcs/github/authorize`
);
target.searchParams.set('project', page.params.project);
target.searchParams.set('success', redirect.toString());
target.searchParams.set('failure', redirect.toString());
+3 -3
View File
@@ -74,7 +74,7 @@
});
$: isOnSettingsLayout = $project?.$id
? page.url.pathname.includes(`project-${$project.$id}/settings`)
? page.url.pathname.includes(`project-${$project.region}-${$project.$id}/settings`)
: false;
$: $registerCommands([
@@ -289,9 +289,9 @@
}
database.subscribe(async (database) => {
if (!database || !$page.params.region || !$page.params.project) return;
if (!database || !page.params.region || !page.params.project) return;
// the component checks `isCloud` internally.
await checkForDatabaseBackupPolicies($page.params.region, $page.params.project, database);
await checkForDatabaseBackupPolicies(page.params.region, page.params.project, database);
});
let currentOrganizationId = null;
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url, route }) => {
const page = getPage(url);
const limit = getLimit('console', url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
return {
@@ -7,7 +7,7 @@ import { isCloud } from '$lib/system';
export const load: PageLoad = async ({ url, route }) => {
const page = getPage(url);
const limit = getLimit('console', url, route, CARD_LIMIT);
const limit = getLimit(url, route, CARD_LIMIT);
const offset = pageToOffset(page, limit);
const queries = [Query.offset(offset), Query.limit(limit), Query.orderDesc('')];
@@ -1,6 +1,6 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { Modal } from '$lib/components';
import { Dependencies } from '$lib/constants';
@@ -29,9 +29,9 @@
onMount(async () => {
const countryList = await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.locale.listCountries();
const locale = await sdk.forProject($page.params.region, $page.params.project).locale.get();
const locale = await sdk.forProject(page.params.region, page.params.project).locale.get();
if (locale.countryCode) {
country = locale.countryCode;
}
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, url, route, depends, parent }) =>
const { scopes } = await parent();
depends(Dependencies.ORGANIZATION);
const page = getPage(url);
const limit = getLimit('console', url, route, CARD_LIMIT);
const limit = getLimit(url, route, CARD_LIMIT);
const offset = pageToOffset(page, limit);
if (!scopes.includes('projects.read') && scopes.includes('billing.read')) {
return redirect(301, `/console/organization-${params.organization}/billing`);
@@ -1,5 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { page } from '$app/state';
import { BillingPlan } from '$lib/constants';
import { Button } from '$lib/elements/forms';
import { organization } from '$lib/stores/organization';
@@ -10,7 +10,7 @@
$: redirectUrl = `${base}/organization-${$organization.$id}/billing#update-budget`;
</script>
{#if $showBudgetAlert && $organization?.$id && $organization?.billingPlan !== BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes($page.url.pathname)}
{#if $showBudgetAlert && $organization?.$id && $organization?.billingPlan !== BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes(page.url.pathname)}
<HeaderAlert type="error" title="Budget limit reached">
<svelte:fragment>
This organization has reached its budget limit and is now blocked. To continue using
@@ -4,7 +4,7 @@ import { getLimit, getPage, getQuery, getSearch, pageToOffset } from '$lib/helpe
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
import { queries, queryParamToMap } from '$lib/components/filters';
export const load = async ({ depends, url, route }) => {
export const load = async ({ depends, url, route, params }) => {
depends(Dependencies.DOMAINS);
const page = getPage(url);
const limit = getLimit(url, route, PAGE_LIMIT);
@@ -1,5 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { page } from '$app/state';
import { Button } from '$lib/elements/forms';
import { organization } from '$lib/stores/organization';
import { HeaderAlert } from '$lib/layout';
@@ -14,7 +14,7 @@
$: redirectUrl = `${base}/organization-${$organization?.$id}/billing#payment-history`;
</script>
{#if $organization?.$id && $organization?.status === teamStatusReadonly && $organization?.remarks === billingLimitOutstandingInvoice && $readOnly && !hideBillingHeaderRoutes.includes($page.url.pathname)}
{#if $organization?.$id && $organization?.status === teamStatusReadonly && $organization?.remarks === billingLimitOutstandingInvoice && $readOnly && !hideBillingHeaderRoutes.includes(page.url.pathname)}
<HeaderAlert type="error" title="Access restricted">
<svelte:fragment>
Your organization’s access to resources has been restricted due to unpaid invoices.
@@ -27,7 +27,7 @@
onMount(() => {
return realtime
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.subscribe(['project', 'console'], (response) => {
if (response.events.includes('stats.connections')) {
for (const [projectId, value] of Object.entries(response.payload)) {
@@ -94,7 +94,7 @@
{
label: 'Go to Sites',
callback: () => {
goto(`${base}/project-${$project.$id}/sites`);
goto(`${base}/project-${$project.region}-${$project.$id}/sites`);
},
keys: ['g', 'i'],
group: 'navigation',
@@ -8,7 +8,7 @@ import { showCreateUser } from './+page.svelte';
export const load: PageLoad = async ({ url, route, params }) => {
const page = getPage(url);
const search = getSearch(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
if (typeof url.searchParams.get('create') === 'string') {
@@ -1,5 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { page } from '$app/state';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { Modal, CustomId } from '$lib/components';
import { InputText, Button } from '$lib/elements/forms';
@@ -20,7 +20,7 @@
const create = async () => {
try {
const team = await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.teams.create(id ?? ID.unique(), name);
name = '';
showCreate = false;
@@ -1,5 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { page } from '$app/state';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { Modal, CustomId } from '$lib/components';
import { Button, InputPassword, InputEmail, InputText, InputPhone } from '$lib/elements/forms';
@@ -21,7 +21,7 @@
const create = async () => {
try {
const user = await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.create(
id ?? ID.unique(),
mail || undefined,
@@ -7,7 +7,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url, route, params }) => {
const page = getPage(url);
const search = getSearch(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
return {
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params, url, route }) => {
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
return {
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Breadcrumbs } from '$lib/layout';
import { organization } from '$lib/stores/organization';
import { project } from '../../../store';
@@ -12,15 +12,15 @@
title: $organization?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}`,
href: `${base}/project-${page.params.region}-${page.params.project}`,
title: $project?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/auth`,
href: `${base}/project-${page.params.region}-${page.params.project}/auth`,
title: 'Auth'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/auth/teams/team-${$team?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/auth/teams/team-${$team?.$id}`,
title: $team?.name
}
];
@@ -10,7 +10,7 @@ export const load: PageLoad = async ({ params, depends, url, route }) => {
const teamId = params.team;
const page = getPage(url);
const search = getSearch(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
return {
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params, url, route }) => {
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
return {
offset,
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Breadcrumbs } from '$lib/layout';
import { organization } from '$lib/stores/organization';
import { project } from '../../store';
@@ -12,15 +12,15 @@
title: $organization?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}`,
href: `${base}/project-${page.params.region}-${page.params.project}`,
title: $project?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/auth`,
href: `${base}/project-${page.params.region}-${page.params.project}/auth`,
title: 'Auth'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/auth/user-${$user?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/auth/user-${$user?.$id}`,
title: $user?.name
}
];
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
depends(Dependencies.MESSAGING_TOPIC_SUBSCRIBERS);
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
const search = getSearch(url);
const query = getQuery(url);
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
depends(Dependencies.USER_TARGETS);
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
const query = getQuery(url);
@@ -8,7 +8,7 @@
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { user } from './store';
import { page } from '$app/stores';
import { page } from '$app/state';
let userEmail: string = null;
@@ -19,7 +19,7 @@
async function updateEmail() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.updateEmail($user.$id, userEmail);
await invalidate(Dependencies.USER);
addNotification({
@@ -8,7 +8,7 @@
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { user } from './store';
import { page } from '$app/stores';
import { page } from '$app/state';
let userName: string = null;
onMount(async () => {
@@ -18,7 +18,7 @@
async function updateName() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.updateName($user.$id, userName);
await invalidate(Dependencies.USER);
addNotification({
@@ -5,14 +5,14 @@
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { user } from './store';
import { page } from '$app/stores';
import { page } from '$app/state';
let newPassword: string = null;
async function updatePassword() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.updatePassword($user.$id, newPassword);
newPassword = null;
addNotification({
@@ -8,7 +8,7 @@
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { user } from './store';
import { page } from '$app/stores';
import { page } from '$app/state';
let userPhone: string = null;
onMount(async () => {
@@ -18,7 +18,7 @@
async function updatePhone() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.updatePhone($user.$id, userPhone);
await invalidate(Dependencies.USER);
addNotification({
@@ -1,6 +1,6 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { AvatarInitials, CardGrid, DropList, DropListItem } from '$lib/components';
import { Dependencies } from '$lib/constants';
@@ -19,7 +19,7 @@
showVerificationDropdown = false;
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.updateEmailVerification($user.$id, !$user.emailVerification);
await invalidate(Dependencies.USER);
addNotification({
@@ -41,7 +41,7 @@
showVerificationDropdown = false;
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.updatePhoneVerification($user.$id, !$user.phoneVerification);
await invalidate(Dependencies.USER);
addNotification({
@@ -62,7 +62,7 @@
async function updateStatus() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.users.updateStatus($user.$id, !$user.status);
await invalidate(Dependencies.USER);
addNotification({
@@ -61,7 +61,7 @@
{#if !isGlobal}
<Alert.Inline>
When there is a naming conflict with a global variable in your <Link
href={`${base}/project-${$project.$id}/settings/variables`}>
href={`${base}/project-${$project.region}-${$project.$id}/settings/variables`}>
project settings</Link>
and a {product} environment variable, the global variable will be ignored.
</Alert.Inline>
@@ -27,7 +27,7 @@
async function handleCreate(event: CustomEvent<Models.Database>) {
showCreate = false;
await goto(
`${base}/project-${$page.params.region}-${project}/databases/database-${event.detail.$id}`
`${base}/project-${page.params.region}-${project}/databases/database-${event.detail.$id}`
);
}
@@ -83,8 +83,10 @@
total={data.databases.total} />
{:else if data.search}
<EmptySearch target="databases" hidePagination>
<Button href={`${base}/project-${page.params.project}/databases`} size="s" secondary
>Clear Search</Button>
<Button
href={`${base}/project-${page.params.region}-${page.params.project}/databases`}
size="s"
secondary>Clear Search</Button>
</EmptySearch>
{:else}
<Empty
@@ -14,7 +14,7 @@ export const load: PageLoad = async ({ url, route, depends, params, parent }) =>
const page = getPage(url);
const search = getSearch(url);
const limit = getLimit(params.project, url, route, CARD_LIMIT);
const limit = getLimit(url, route, CARD_LIMIT);
const view = getView(params.project, url, route, View.Grid);
const offset = pageToOffset(page, limit);
@@ -8,7 +8,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
depends(Dependencies.COLLECTIONS);
const page = getPage(url);
const search = getSearch(url);
const limit = getLimit(params.project, url, route, CARD_LIMIT);
const limit = getLimit(url, route, CARD_LIMIT);
const view = getView(params.project, url, route, View.Grid);
const offset = pageToOffset(page, limit);
const collections = await sdk
@@ -9,7 +9,7 @@ export const load = async ({ params, url, route, depends, parent }) => {
depends(Dependencies.BACKUPS);
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const view = getView(params.project, url, route, View.Grid);
const offset = pageToOffset(page, limit);
@@ -8,7 +8,7 @@ import { queries, queryParamToMap } from '$lib/components/filters';
export const load: PageLoad = async ({ params, depends, url, route }) => {
depends(Dependencies.DOCUMENTS);
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const view = getView(params.project, url, route, View.Grid);
const offset = pageToOffset(page, limit);
const query = getQuery(url);
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params, url, route }) => {
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
return {
@@ -1,7 +1,6 @@
<script context="module" lang="ts">
import { sdk } from '$lib/stores/sdk';
import { page } from '$app/stores';
import { get } from 'svelte/store';
import { page } from '$app/state';
import type { Models } from '@appwrite.io/console';
export async function submitBoolean(
@@ -10,9 +9,8 @@
key: string,
data: Partial<Models.AttributeBoolean>
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.createBooleanAttribute(
databaseId,
collectionId,
@@ -28,9 +26,8 @@
data: Partial<Models.AttributeBoolean>,
originalKey?: string
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateBooleanAttribute(
databaseId,
collectionId,
@@ -1,7 +1,7 @@
<script context="module" lang="ts">
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { page } from '$app/stores';
import { page } from '$app/state';
import { get } from 'svelte/store';
export async function submitDatetime(
@@ -10,9 +10,8 @@
key: string,
data: Partial<Models.AttributeDatetime>
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.createDatetimeAttribute(
databaseId,
collectionId,
@@ -29,9 +28,8 @@
data: Partial<Models.AttributeDatetime>,
originalKey?: string
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateDatetimeAttribute(
databaseId,
collectionId,
@@ -1,6 +1,6 @@
<script context="module" lang="ts">
import { get } from 'svelte/store';
import { page } from '$app/stores';
import { page } from '$app/state';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
@@ -10,9 +10,8 @@
key: string,
data: Partial<Models.AttributeFloat>
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.createFloatAttribute(
databaseId,
collectionId,
@@ -31,9 +30,8 @@
data: Partial<Models.AttributeFloat>,
originalKey?: string
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateFloatAttribute(
databaseId,
collectionId,
@@ -1,6 +1,6 @@
<script context="module" lang="ts">
import { get } from 'svelte/store';
import { page } from '$app/stores';
import { page } from '$app/state';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
@@ -10,9 +10,8 @@
key: string,
data: Partial<Models.AttributeIp>
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.createIpAttribute(
databaseId,
collectionId,
@@ -28,9 +27,8 @@
data: Partial<Models.AttributeIp>,
originalKey?: string
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateIpAttribute(
databaseId,
collectionId,
@@ -1,6 +1,6 @@
<script context="module" lang="ts">
import { get } from 'svelte/store';
import { page } from '$app/stores';
import { page } from '$app/state';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
@@ -10,9 +10,8 @@
key: string,
data: Partial<Models.AttributeString>
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.createStringAttribute(
databaseId,
collectionId,
@@ -29,9 +28,8 @@
data: Partial<Models.AttributeString>,
originalKey?: string
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateStringAttribute(
databaseId,
collectionId,
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Breadcrumbs } from '$lib/layout';
import { database } from '../store';
import { collection } from './store';
@@ -10,15 +10,15 @@
title: '...'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/databases`,
href: `${base}/project-${page.params.region}-${page.params.project}/databases`,
title: 'Databases'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/databases/database-${$database?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/databases/database-${$database?.$id}`,
title: $database?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/databases/database-${$database?.$id}/collection-${$collection?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/databases/database-${$database?.$id}/collection-${$collection?.$id}`,
title: $collection?.name
}
];
@@ -53,13 +53,15 @@
async function create() {
try {
const { $id } = await sdk.forProject.databases.createDocument(
page.params.database,
page.params.collection,
$createDocument.id ?? ID.unique(),
$createDocument.document,
$createDocument.permissions
);
const { $id } = await sdk
.forProject(page.params.region, page.params.project)
.databases.createDocument(
page.params.database,
page.params.collection,
$createDocument.id ?? ID.unique(),
$createDocument.document,
$createDocument.permissions
);
addNotification({
message: 'Document has been created',
@@ -69,7 +71,7 @@
customId: !!$createDocument.id
});
goto(
`${base}/project-${page.params.project}/databases/database-${page.params.database}/collection-${page.params.collection}/document-${$id}`
`${base}/project-${page.params.region}-${page.params.project}/databases/database-${page.params.database}/collection-${page.params.collection}/document-${$id}`
);
} catch (error) {
addNotification({
@@ -83,7 +85,7 @@
<Wizard
title="Create document"
href={`${base}/project-${page.params.project}/databases/database-${page.params.database}/collection-${page.params.collection}/`}
href={`${base}/project-${page.params.region}-${page.params.project}/databases/database-${page.params.database}/collection-${page.params.collection}/`}
bind:showExitModal
column
columnSize="s"
@@ -6,7 +6,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params, url, route }) => {
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
return {
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Breadcrumbs } from '$lib/layout';
import { database } from '../../store';
import { collection } from '../store';
@@ -11,15 +11,15 @@
title: '...'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/databases/database-${$database?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/databases/database-${$database?.$id}`,
title: $database?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/databases/database-${$database?.$id}/collection-${$collection?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/databases/database-${$database?.$id}/collection-${$collection?.$id}`,
title: $collection?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/databases/database-${$database?.$id}/collection-${$collection?.$id}/document-${$doc?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/databases/database-${$database?.$id}/collection-${$collection?.$id}/document-${$doc?.$id}`,
title: $doc?.$id
}
];
@@ -49,7 +49,7 @@
async function updateData() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateDocument(
databaseId,
collectionId,
@@ -53,7 +53,7 @@
async function updateData() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateDocument(
databaseId,
collectionId,
@@ -19,7 +19,7 @@
async function handleDelete() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.deleteIndex(databaseId, $collection.$id, selectedIndex.key);
await invalidate(Dependencies.COLLECTION);
showDelete = false;
@@ -21,7 +21,7 @@
async function updateName() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateCollection(
databaseId,
$collection.$id,
@@ -26,7 +26,7 @@
async function updatePermissions() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateCollection(
databaseId,
$collection.$id,
@@ -21,7 +21,7 @@
async function updateSecurity() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateCollection(
databaseId,
$collection.$id,
@@ -22,7 +22,7 @@
async function toggleCollection() {
try {
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateCollection(
databaseId,
$collection.$id,
@@ -25,7 +25,7 @@
error = null;
try {
const collection = await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.createCollection(databaseId, id ? id : ID.unique(), name);
showCreate = false;
dispatch('created', collection);
@@ -18,7 +18,7 @@
event="collection">
{#each data.collections.collections as collection}
<GridItem1
href={`${base}/project-${$page.params.region}-${projectId}/databases/database-${databaseId}/collection-${collection.$id}`}>
href={`${base}/project-${page.params.region}-${projectId}/databases/database-${databaseId}/collection-${collection.$id}`}>
<svelte:fragment slot="title">{collection.name}</svelte:fragment>
<svelte:fragment slot="status">
{#if !collection.enabled}
@@ -1,6 +1,6 @@
<script context="module" lang="ts">
import { get } from 'svelte/store';
import { page } from '$app/stores';
import { page } from '$app/state';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
@@ -10,9 +10,8 @@
key: string,
data: Partial<Models.AttributeString>
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.createStringAttribute(
databaseId,
collectionId,
@@ -29,9 +28,8 @@
data: Partial<Models.AttributeString>,
originalKey?: string
) {
const $page = get(page);
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.databases.updateStringAttribute(
databaseId,
collectionId,
@@ -17,7 +17,7 @@
service="databases">
{#each data.databases.databases as database}
<GridItem1
href={`${base}/project-${$page.params.region}-${project}/databases/database-${database.$id}`}>
href={`${base}/project-${page.params.region}-${project}/databases/database-${database.$id}`}>
<svelte:fragment slot="title">{database.name}</svelte:fragment>
<svelte:fragment slot="subtitle">
{#if data.lastBackups && data.lastBackups[database.$id]}
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Breadcrumbs } from '$lib/layout';
import { organization } from '$lib/stores/organization';
import { project } from '../store';
@@ -11,11 +11,11 @@
title: $organization?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}`,
href: `${base}/project-${page.params.region}-${page.params.project}`,
title: $project?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/functions`,
href: `${base}/project-${page.params.region}-${page.params.project}/functions`,
title: 'Functions'
}
];
@@ -27,7 +27,7 @@
export let data;
const isVcsEnabled = $consoleVariables?._APP_VCS_ENABLED === true;
const wizardBase = `${base}/project-${page.params.project}/functions`;
const wizardBase = `${base}/project-${page.params.region}-${page.params.project}/functions`;
let previousPage: string = wizardBase;
afterNavigate(({ from }) => {
previousPage = from?.url?.pathname || previousPage;
@@ -55,58 +55,62 @@
async function create() {
try {
const func = await sdk.forProject.functions.create(
id || ID.unique(),
name,
runtime,
roles?.length ? roles : undefined,
undefined,
undefined,
undefined,
true,
undefined,
entrypoint,
buildCommand,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
specification || undefined
);
const func = await sdk
.forProject(page.params.region, page.params.project)
.functions.create(
id || ID.unique(),
name,
runtime,
roles?.length ? roles : undefined,
undefined,
undefined,
undefined,
true,
undefined,
entrypoint,
buildCommand,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
specification || undefined
);
// Add domain
await sdk.forProject.proxy.createFunctionRule(
`${ID.unique()}.${$consoleVariables._APP_DOMAIN_FUNCTIONS}`,
func.$id
);
await sdk
.forProject(page.params.region, page.params.project)
.proxy.createFunctionRule(
`${ID.unique()}.${$consoleVariables._APP_DOMAIN_FUNCTIONS}`,
func.$id
);
//Add variables
const promises = variables.map((variable) =>
sdk.forProject.functions.createVariable(
func.$id,
variable.key,
variable.value,
variable?.secret ?? false
)
sdk
.forProject(page.params.region, page.params.project)
.functions.createVariable(
func.$id,
variable.key,
variable.value,
variable?.secret ?? false
)
);
await Promise.all(promises);
await sdk.forProject.functions.createDeployment(
func.$id,
files[0],
true,
undefined,
undefined
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.createDeployment(func.$id, files[0], true, undefined, undefined);
trackEvent(Submit.FunctionCreate, {
source: 'repository',
runtime: runtime
});
await goto(`${base}/project-${page.params.project}/functions/function-${func.$id}`);
await goto(
`${base}/project-${page.params.region}-${page.params.project}/functions/function-${func.$id}`
);
invalidate(Dependencies.FUNCTION);
} catch (e) {
@@ -136,7 +140,7 @@
<Wizard
title="Create function"
bind:showExitModal
href={`${base}/project-${page.params.project}/functions`}
href={`${base}/project-${page.params.region}-${page.params.project}/functions`}
column
columnSize="s"
confirmExit>
@@ -65,57 +65,62 @@
async function create() {
try {
const func = await sdk.forProject.functions.create(
id || ID.unique(),
name,
runtime,
roles?.length ? roles : undefined,
undefined,
undefined,
undefined,
true,
undefined,
entrypoint,
buildCommand,
undefined,
$installation.$id,
$repository.id,
branch,
silentMode,
rootDir,
specification || undefined
);
const func = await sdk
.forProject(page.params.region, page.params.project)
.functions.create(
id || ID.unique(),
name,
runtime,
roles?.length ? roles : undefined,
undefined,
undefined,
undefined,
true,
undefined,
entrypoint,
buildCommand,
undefined,
$installation.$id,
$repository.id,
branch,
silentMode,
rootDir,
specification || undefined
);
// Add domain
await sdk.forProject.proxy.createFunctionRule(
`${ID.unique()}.${$consoleVariables._APP_DOMAIN_FUNCTIONS}`,
func.$id
);
await sdk
.forProject(page.params.region, page.params.project)
.proxy.createFunctionRule(
`${ID.unique()}.${$consoleVariables._APP_DOMAIN_FUNCTIONS}`,
func.$id
);
//Add variables
const promises = variables.map((variable) =>
sdk.forProject.functions.createVariable(
func.$id,
variable.key,
variable.value,
variable?.secret ?? false
)
sdk
.forProject(page.params.region, page.params.project)
.functions.createVariable(
func.$id,
variable.key,
variable.value,
variable?.secret ?? false
)
);
await Promise.all(promises);
await sdk.forProject.functions.createVcsDeployment(
func.$id,
VCSDeploymentType.Branch,
branch,
true
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.createVcsDeployment(func.$id, VCSDeploymentType.Branch, branch, true);
trackEvent(Submit.FunctionCreate, {
source: 'repository',
runtime: runtime
});
await goto(`${base}/project-${page.params.project}/functions/function-${func.$id}`);
await goto(
`${base}/project-${page.params.region}-${page.params.project}/functions/function-${func.$id}`
);
invalidate(Dependencies.FUNCTION);
} catch (e) {
@@ -135,7 +140,7 @@
<Wizard
title="Create function"
bind:showExitModal
href={`${base}/project-${page.params.project}/functions`}
href={`${base}/project-${page.params.region}-${page.params.project}/functions`}
confirmExit>
<Form bind:this={formComponent} onSubmit={create} bind:isSubmitting>
<Layout.Stack gap="xl">
@@ -4,7 +4,9 @@ export const load = async ({ parent, params, url }) => {
const { installations, runtimesList, specificationsList } = await parent();
const [repository] = await Promise.all([
sdk.forProject.vcs.getRepository(url.searchParams.get('installation'), params.repository)
sdk
.forProject(params.region, params.project)
.vcs.getRepository(url.searchParams.get('installation'), params.repository)
]);
return {
@@ -17,7 +17,9 @@
{repository?.organization}/{repository?.name}
</Typography.Text>
</Layout.Stack>
<Button secondary href={`${base}/project-${page.params.project}/functions/create-function`}>
<Button
secondary
href={`${base}/project-${page.params.region}-${page.params.project}/functions/create-function`}>
Change
</Button>
</Layout.Stack>
@@ -94,11 +94,9 @@
async function createRepository() {
try {
isCreatingRepository = true;
const repo = await sdk.forProject.vcs.createRepository(
$installation.$id,
repositoryName,
repositoryPrivate
);
const repo = await sdk
.forProject(page.params.region, page.params.project)
.vcs.createRepository($installation.$id, repositoryName, repositoryPrivate);
repository.set(repo);
selectedRepository = repo.id;
showConfig = true;
@@ -123,52 +121,60 @@
try {
const rt = data.template.runtimes.find((r) => r.name === runtime);
const func = await sdk.forProject.functions.create(
id || ID.unique(),
name,
runtime as Runtime,
data.template.permissions?.length ? data.template.permissions : undefined,
data.template.events?.length ? data.template.events : undefined,
data.template.cron || undefined,
data.template.timeout ? data.template.timeout : undefined,
undefined,
undefined,
entrypoint || rt?.entrypoint || undefined,
rt?.commands || undefined,
selectedScopes?.length ? selectedScopes : undefined,
connectBehaviour === 'later' ? undefined : $installation?.$id || undefined,
connectBehaviour === 'later' ? undefined : $repository?.id || undefined,
branch,
silentMode,
rootDir,
specification || undefined
);
const func = await sdk
.forProject(page.params.region, page.params.project)
.functions.create(
id || ID.unique(),
name,
runtime as Runtime,
data.template.permissions?.length ? data.template.permissions : undefined,
data.template.events?.length ? data.template.events : undefined,
data.template.cron || undefined,
data.template.timeout ? data.template.timeout : undefined,
undefined,
undefined,
entrypoint || rt?.entrypoint || undefined,
rt?.commands || undefined,
selectedScopes?.length ? selectedScopes : undefined,
connectBehaviour === 'later' ? undefined : $installation?.$id || undefined,
connectBehaviour === 'later' ? undefined : $repository?.id || undefined,
branch,
silentMode,
rootDir,
specification || undefined
);
// Add domain
await sdk.forProject.proxy.createFunctionRule(
`${ID.unique()}.${$consoleVariables._APP_DOMAIN_FUNCTIONS}`,
func.$id
);
await sdk
.forProject(page.params.region, page.params.project)
.proxy.createFunctionRule(
`${ID.unique()}.${$consoleVariables._APP_DOMAIN_FUNCTIONS}`,
func.$id
);
// Add variables
const promises = variables.map((variable) =>
sdk.forProject.functions.createVariable(
func.$id,
variable.name,
variable.value,
variable?.secret ?? false
)
sdk
.forProject(page.params.region, page.params.project)
.functions.createVariable(
func.$id,
variable.name,
variable.value,
variable?.secret ?? false
)
);
await Promise.all(promises);
await sdk.forProject.functions.createTemplateDeployment(
func.$id,
data.template.providerRepositoryId || undefined,
data.template.providerOwner || undefined,
rt?.providerRootDirectory || undefined,
data.template.providerVersion || undefined,
true
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.createTemplateDeployment(
func.$id,
data.template.providerRepositoryId || undefined,
data.template.providerOwner || undefined,
rt?.providerRootDirectory || undefined,
data.template.providerVersion || undefined,
true
);
trackEvent(Submit.FunctionCreate, {
runtime: runtime,
@@ -176,7 +182,9 @@
framework: data.template.name
});
await goto(`${base}/project-${page.params.project}/functions/function-${func.$id}`);
await goto(
`${base}/project-${page.params.region}-${page.params.project}/functions/function-${func.$id}`
);
invalidate(Dependencies.FUNCTION);
} catch (e) {
addNotification({
@@ -209,7 +217,7 @@
<Wizard
title="Create function"
bind:showExitModal
href={`${base}/project-${page.params.project}/functions`}
href={`${base}/project-${page.params.region}-${page.params.project}/functions`}
confirmExit>
<Form bind:this={formComponent} onSubmit={create} bind:isSubmitting>
<Layout.Stack gap="xl">
@@ -2,7 +2,9 @@ import { sdk } from '$lib/stores/sdk';
export const load = async ({ parent, params }) => {
const { installations, runtimesList, specificationsList } = await parent();
const template = await sdk.forProject.functions.getTemplate(params.template);
const template = await sdk
.forProject(params.region, params.project)
.functions.getTemplate(params.template);
return {
installations,
@@ -14,7 +14,7 @@
import type { Component } from 'svelte';
import { getApiEndpoint } from '$lib/stores/sdk';
import { page } from '$app/state';
import { project } from '$routes/(console)/project-[project]/store';
import { project } from '$routes/(console)/project-[region]-[project]/store';
export let variables: Partial<Models.TemplateVariable>[] = [];
export let templateVariables: Models.TemplateVariable[] = [];
@@ -114,7 +114,7 @@
{:else}
<Typography.Text variant="m-400" color="--fgcolor-neutral-primary">
Only the <Link
href={`${base}/project-${page.params.project}/functions/function-${$func.$id}/deployment-${$func.deploymentId}`}
href={`${base}/project-${page.params.region}-${page.params.project}/functions/function-${$func.$id}/deployment-${$func.deploymentId}`}
variant="default">active deployment</Link> has a domain.
</Typography.Text>
{/if}
@@ -15,16 +15,13 @@
const handleSubmit = async () => {
try {
<<<<<<<< HEAD:src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/activateModal.svelte
await sdk.forProject(page.params.region, page.params.project).functions.updateFunctionDeployment(
selectedDeployment.resourceId,
selectedDeployment.$id
);
========
await sdk
.forProject(page.params.region, page.params.project)
.functions.updateDeployment(selectedDeployment.resourceId, selectedDeployment.$id);
>>>>>>>> 93754b342accbdb6db066c33b2addea7b9e92d67:src/routes/(console)/project-[region]-[project]/functions/function-[function]/activate.svelte
.functions.updateFunctionDeployment(
selectedDeployment.resourceId,
selectedDeployment.$id
);
showActivate = false;
addNotification({
type: 'success',
@@ -40,16 +40,14 @@
try {
await loadInstallations();
if (!$repository?.id && hasRepository) {
$repository = await sdk.forProject.vcs.getRepository(
$installation.$id,
$func.providerRepositoryId
);
$repository = await sdk
.forProject(page.params.region, page.params.project)
.vcs.getRepository($installation.$id, $func.providerRepositoryId);
}
selectedRepository = $repository?.id;
const branchList = await sdk.forProject.vcs.listRepositoryBranches(
$installation.$id,
selectedRepository
);
const branchList = await sdk
.forProject(page.params.region, page.params.project)
.vcs.listRepositoryBranches($installation.$id, selectedRepository);
const sorted = sortBranches(branchList.branches);
branch = sorted[0]?.name ?? null;
@@ -68,41 +66,47 @@
async function createDeployment() {
try {
if (!$func?.providerRepositoryId) {
await sdk.forProject.functions.update(
$func.$id,
$func.name,
$func.runtime as Runtime,
$func.execute || undefined,
$func.events || undefined,
$func.schedule || undefined,
$func.timeout || undefined,
$func.enabled || undefined,
$func.logging || undefined,
$func.entrypoint,
$func.commands || undefined,
$func.scopes || undefined,
$installation.$id || undefined,
selectedRepository || undefined,
branch || undefined,
undefined,
undefined,
undefined
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.update(
$func.$id,
$func.name,
$func.runtime as Runtime,
$func.execute || undefined,
$func.events || undefined,
$func.schedule || undefined,
$func.timeout || undefined,
$func.enabled || undefined,
$func.logging || undefined,
$func.entrypoint,
$func.commands || undefined,
$func.scopes || undefined,
$installation.$id || undefined,
selectedRepository || undefined,
branch || undefined,
undefined,
undefined,
undefined
);
}
if (commit) {
await sdk.forProject.functions.createVcsDeployment(
$func.$id,
VCSDeploymentType.Commit,
commit,
activate
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.createVcsDeployment(
$func.$id,
VCSDeploymentType.Commit,
commit,
activate
);
} else if (branch) {
await sdk.forProject.functions.createVcsDeployment(
$func.$id,
VCSDeploymentType.Branch,
branch,
activate
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.createVcsDeployment(
$func.$id,
VCSDeploymentType.Branch,
branch,
activate
);
}
show = false;
invalidate(Dependencies.DEPLOYMENTS);
@@ -10,6 +10,7 @@
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
import { Icon, Layout, Tooltip, Typography, Upload } from '@appwrite.io/pink-svelte';
import { func } from '../store';
import { page } from '$app/state';
export let show = false;
@@ -18,13 +19,9 @@
async function create() {
try {
await sdk.forProject.functions.createDeployment(
$func.$id,
files[0],
true,
undefined,
undefined
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.createDeployment($func.$id, files[0], true, undefined, undefined);
await invalidate(Dependencies.DEPLOYMENTS);
files = undefined;
show = false;
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) =>
const data = await parent();
depends(Dependencies.DEPLOYMENTS);
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
const query = getQuery(url);
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Breadcrumbs } from '$lib/layout';
import { organization } from '$lib/stores/organization';
import { project } from '../../store';
@@ -12,15 +12,15 @@
title: $organization?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}`,
href: `${base}/project-${page.params.region}-${page.params.project}`,
title: $project?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/functions`,
href: `${base}/project-${page.params.region}-${page.params.project}/functions`,
title: 'Functions'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/functions/function-${$func?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/functions/function-${$func?.$id}`,
title: $func?.name
}
];
@@ -1,6 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Breadcrumbs } from '$lib/layout';
import { func } from '../store';
import { deployment } from './store';
@@ -10,15 +10,15 @@
title: '...'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/functions`,
href: `${base}/project-${page.params.region}-${page.params.project}/functions`,
title: 'Functions'
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/functions/function-${$func?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/functions/function-${$func?.$id}`,
title: $func?.name
},
{
href: `${base}/project-${$page.params.region}-${$page.params.project}/functions/function-${$func?.$id}/deployment-${$deployment?.$id}`,
href: `${base}/project-${page.params.region}-${page.params.project}/functions/function-${$func?.$id}/deployment-${$deployment?.$id}`,
title: 'Deployment'
}
];
@@ -12,7 +12,7 @@
<Cover>
<svelte:fragment slot="header">
<CoverTitle
href={`${base}/project-${$page.params.region}-${projectId}/functions/function-${functionId}`}>
href={`${base}/project-${page.params.region}-${projectId}/functions/function-${functionId}`}>
Deployment
</CoverTitle>
<Id value={$deployment.$id}>{$deployment.$id}</Id>
@@ -13,7 +13,7 @@ import { PAGE_LIMIT } from '$lib/constants';
export const load: PageLoad = async ({ depends, params, url, route }) => {
depends(Dependencies.FUNCTION_DOMAINS);
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
const query = getQuery(url);
const search = getSearch(url);
@@ -19,7 +19,7 @@
import { ConnectRepoModal } from '$lib/components/git/index.js';
import { isValueOfStringEnum } from '$lib/helpers/types.js';
const routeBase = `${base}/project-${page.params.project}/functions/function-${page.params.function}/domains`;
const routeBase = `${base}/project-${page.params.region}-${page.params.project}/functions/function-${page.params.function}/domains`;
let { data } = $props();
@@ -48,23 +48,18 @@
try {
let rule: Models.ProxyRule;
if (behaviour === 'BRANCH') {
rule = await sdk.forProject.proxy.createFunctionRule(
domainName,
page.params.function,
branch
);
rule = await sdk
.forProject(page.params.region, page.params.project)
.proxy.createFunctionRule(domainName, page.params.function, branch);
} else if (behaviour === 'REDIRECT') {
const sc = Object.values(StatusCode).find((code) => parseInt(code) === statusCode);
rule = await sdk.forProject.proxy.createRedirectRule(
domainName,
$protocol + redirect,
sc
);
rule = await sdk
.forProject(page.params.region, page.params.project)
.proxy.createRedirectRule(domainName, $protocol + redirect, sc);
} else if (behaviour === 'ACTIVE') {
rule = await sdk.forProject.proxy.createFunctionRule(
domainName,
page.params.function
);
rule = await sdk
.forProject(page.params.region, page.params.project)
.proxy.createFunctionRule(domainName, page.params.function);
}
if (rule?.status === 'verified') {
await goto(routeBase);
@@ -86,26 +81,28 @@
if (!isValueOfStringEnum(Runtime, data.func.runtime)) {
throw new Error(`Invalid runtime: ${data.func.runtime}`);
}
await sdk.forProject.functions.update(
data.func.$id,
data.func.name,
data.func.runtime as Runtime,
data.func.execute || undefined,
data.func.events || undefined,
data.func.schedule || undefined,
data.func.timeout || undefined,
data.func.enabled || undefined,
data.func.logging || undefined,
data.func.entrypoint,
data.func.commands || undefined,
data.func.scopes || undefined,
selectedInstallationId,
selectedRepository,
'main',
undefined,
undefined,
undefined
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.update(
data.func.$id,
data.func.name,
data.func.runtime as Runtime,
data.func.execute || undefined,
data.func.events || undefined,
data.func.schedule || undefined,
data.func.timeout || undefined,
data.func.enabled || undefined,
data.func.logging || undefined,
data.func.entrypoint,
data.func.commands || undefined,
data.func.scopes || undefined,
selectedInstallationId,
selectedRepository,
'main',
undefined,
undefined,
undefined
);
await invalidate(Dependencies.FUNCTION);
} catch (error) {
console.log(error);
@@ -3,16 +3,18 @@ import { Query } from '@appwrite.io/console';
import { RuleTrigger, RuleType } from '$lib/stores/sdk';
import { Dependencies } from '$lib/constants';
export const load = async ({ parent, depends }) => {
export const load = async ({ parent, depends, params }) => {
const { function: func } = await parent();
depends(Dependencies.DOMAINS, Dependencies.FUNCTION_DOMAINS);
const [domains, installations] = await Promise.all([
sdk.forProject.proxy.listRules([
Query.equal('type', RuleType.DEPLOYMENT),
Query.equal('trigger', RuleTrigger.MANUAL)
]),
sdk.forProject.vcs.listInstallations()
sdk
.forProject(params.region, params.project)
.proxy.listRules([
Query.equal('type', RuleType.DEPLOYMENT),
Query.equal('trigger', RuleTrigger.MANUAL)
]),
sdk.forProject(params.region, params.project).vcs.listInstallations()
]);
return {
@@ -21,10 +23,9 @@ export const load = async ({ parent, depends }) => {
installations,
branches:
func?.installationId && func?.providerRepositoryId
? await sdk.forProject.vcs.listRepositoryBranches(
func.installationId,
func.providerRepositoryId
)
? await sdk
.forProject(params.region, params.project)
.vcs.listRepositoryBranches(func.installationId, func.providerRepositoryId)
: undefined
};
};
@@ -40,7 +40,7 @@
);
let verified = $state(false);
let routeBase = `${base}/project-${page.params.project}/functions/function-${page.params.function}/domains`;
let routeBase = `${base}/project-${page.params.region}-${page.params.project}/functions/function-${page.params.function}/domains`;
let isSubmitting = $state(writable(false));
async function verify() {
@@ -48,7 +48,9 @@
data.domainsList.domains.findIndex((rule) => rule.domain === page.params.domain) === -1;
try {
if (selectedTab !== 'nameserver') {
const ruleData = await sdk.forProject.proxy.updateRuleVerification(ruleId);
const ruleData = await sdk
.forProject(page.params.region, page.params.project)
.proxy.updateRuleVerification(ruleId);
verified = ruleData.status === 'verified';
} else if (isNewDomain && isCloud) {
const domainData = await sdk.forConsole.domains.create(
@@ -77,7 +79,7 @@
async function back() {
if (ruleId) {
await sdk.forProject.proxy.deleteRule(ruleId);
await sdk.forProject(page.params.region, page.params.project).proxy.deleteRule(ruleId);
}
await goto(`${routeBase}/add-domain?domain=${page.params.domain}`);
}
@@ -8,6 +8,7 @@
import { Dependencies } from '$lib/constants';
import { Confirm } from '$lib/components';
import { Typography } from '@appwrite.io/pink-svelte';
import { page } from '$app/state';
export let show = false;
export let selectedDomain: Models.ProxyRule;
@@ -16,7 +17,9 @@
async function deleteDomain() {
try {
await sdk.forProject.proxy.deleteRule(selectedDomain.$id);
await sdk
.forProject(page.params.region, page.params.project)
.proxy.deleteRule(selectedDomain.$id);
await invalidate(Dependencies.FUNCTION_DOMAINS);
show = false;
addNotification({
@@ -9,6 +9,7 @@
import RecordsCard from './recordsCard.svelte';
import type { Domain } from '$lib/sdk/domains';
import type { Models } from '@appwrite.io/console';
import { page } from '$app/state';
export let show = false;
export let selectedDomain: Domain | Models.ProxyRule;
@@ -16,7 +17,9 @@
let error = null;
async function retryDomain() {
try {
await sdk.forProject.proxy.updateRuleVerification(selectedDomain.$id);
await sdk
.forProject(page.params.region, page.params.project)
.proxy.updateRuleVerification(selectedDomain.$id);
await invalidate(Dependencies.SITES_DOMAINS);
show = false;
addNotification({
@@ -1,13 +1,13 @@
<script>
import { invalidate } from '$app/navigation';
import { page } from '$app/stores';
import { page } from '$app/state';
import { Dependencies } from '$lib/constants';
import { realtime } from '$lib/stores/sdk';
import { onMount } from 'svelte';
onMount(() => {
return realtime
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.subscribe('functions.*.executions', (response) => {
if (response.events.includes('functions.*.executions.*')) {
invalidate(Dependencies.EXECUTIONS);
@@ -10,7 +10,7 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) =>
depends(Dependencies.EXECUTIONS);
const page = getPage(url);
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
const limit = getLimit(url, route, PAGE_LIMIT);
const offset = pageToOffset(page, limit);
const query = getQuery(url);
@@ -24,7 +24,7 @@
throw new Error(`Invalid runtime: ${$func.runtime}`);
}
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.functions.update(
functionId,
$func.name,
@@ -17,25 +17,27 @@
if (!isValueOfStringEnum(Runtime, func.runtime)) {
throw new Error(`Invalid runtime: ${func.runtime}`);
}
await sdk.forProject.functions.update(
func.$id,
func.name,
func.runtime,
func.execute || undefined,
func.events || undefined,
func.schedule || undefined,
func.timeout || undefined,
func.enabled || undefined,
func.logging || undefined,
func.entrypoint || undefined,
buildCommand || undefined,
func.scopes || undefined,
func.installationId || undefined,
func.providerRepositoryId || undefined,
func.providerBranch || undefined,
func.providerSilentMode || undefined,
func.providerRootDirectory || undefined
);
await sdk
.forProject(page.params.region, page.params.project)
.functions.update(
func.$id,
func.name,
func.runtime,
func.execute || undefined,
func.events || undefined,
func.schedule || undefined,
func.timeout || undefined,
func.enabled || undefined,
func.logging || undefined,
func.entrypoint || undefined,
buildCommand || undefined,
func.scopes || undefined,
func.installationId || undefined,
func.providerRepositoryId || undefined,
func.providerBranch || undefined,
func.providerSilentMode || undefined,
func.providerRootDirectory || undefined
);
await invalidate(Dependencies.FUNCTION);
addNotification({
type: 'success',
@@ -30,7 +30,7 @@
throw new Error(`Invalid runtime: ${$func.runtime}`);
}
await sdk
.forProject($page.params.region, $page.params.project)
.forProject(page.params.region, page.params.project)
.functions.update(
functionId,
$func.name,
Loaded 100 of 233 files, more files were not shown because too many files have changed in this diff. Show more