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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"e2e": "playwright test tests/e2e"
},
"dependencies": {
"@appwrite.io/console": "^0.6.0-rc.9",
"@appwrite.io/console": "^0.6.0-rc.12",
"@appwrite.io/pink": "0.4.0",
"@appwrite.io/pink-icons": "0.4.0",
"@popperjs/core": "^2.11.8",
Expand Down
42 changes: 21 additions & 21 deletions src/lib/stores/project-services.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { writable } from 'svelte/store';
import { APIService, type Models } from '@appwrite.io/console';
import { ApiService, type Models } from '@appwrite.io/console';

export type Service = {
label: string;
method: APIService;
method: ApiService;
value: boolean | null;
};

Expand All @@ -12,52 +12,52 @@ function createServices() {
list: [
{
label: 'Account',
method: APIService.Account,
method: ApiService.Account,
value: null
},
{
label: 'Avatars',
method: APIService.Avatars,
method: ApiService.Avatars,
value: null
},
{
label: 'Databases',
method: APIService.Databases,
method: ApiService.Databases,
value: null
},
{
label: 'Functions',
method: APIService.Functions,
method: ApiService.Functions,
value: null
},
{
label: 'Health',
method: APIService.Health,
method: ApiService.Health,
value: null
},
{
label: 'Locale',
method: APIService.Locale,
method: ApiService.Locale,
value: null
},
{
label: 'Storage',
method: APIService.Storage,
method: ApiService.Storage,
value: null
},
{
label: 'Teams',
method: APIService.Teams,
method: ApiService.Teams,
value: null
},
{
label: 'Users',
method: APIService.Users,
method: ApiService.Users,
value: null
},
{
label: 'GraphQL',
method: APIService.Graphql,
method: ApiService.Graphql,
value: null
}
]
Expand All @@ -70,47 +70,47 @@ function createServices() {
const list = [
{
label: 'Account',
method: APIService.Account,
method: ApiService.Account,
value: project.serviceStatusForAccount
},
{
label: 'Avatars',
method: APIService.Avatars,
method: ApiService.Avatars,
value: project.serviceStatusForAvatars
},
{
label: 'Databases',
method: APIService.Databases,
method: ApiService.Databases,
value: project.serviceStatusForDatabases
},
{
label: 'Functions',
method: APIService.Functions,
method: ApiService.Functions,
value: project.serviceStatusForFunctions
},
{
label: 'Health',
method: APIService.Health,
method: ApiService.Health,
value: project.serviceStatusForHealth
},
{
label: 'Locale',
method: APIService.Locale,
method: ApiService.Locale,
value: project.serviceStatusForLocale
},
{
label: 'Storage',
method: APIService.Storage,
method: ApiService.Storage,
value: project.serviceStatusForStorage
},
{
label: 'Teams',
method: APIService.Teams,
method: ApiService.Teams,
value: project.serviceStatusForTeams
},
{
label: 'Users',
method: APIService.Users,
method: ApiService.Users,
value: project.serviceStatusForUsers
}
];
Expand Down
4 changes: 2 additions & 2 deletions src/routes/console/account/deleteMfa.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import InputDigits from '$lib/elements/forms/inputDigits.svelte';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { AuthenticatorProvider } from '@appwrite.io/console';
import { AuthenticatorType } from '@appwrite.io/console';

export let showDelete = false;

Expand All @@ -17,7 +17,7 @@

async function deleteProvider() {
try {
await sdk.forConsole.account.deleteAuthenticator(AuthenticatorProvider.Totp, code);
await sdk.forConsole.account.deleteAuthenticator(AuthenticatorType.Totp, code);
await invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.FACTORS);
showDelete = false;
Expand Down
16 changes: 8 additions & 8 deletions src/routes/console/account/mfa.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
import { Table, TableBody, TableCell, TableRow } from '$lib/elements/table';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { AuthenticatorFactor, type Models } from '@appwrite.io/console';
import { AuthenticatorType, type Models } from '@appwrite.io/console';

export let showSetup = false;
export let showRecoveryCodes = false;

let code: string;
let provider: Models.MfaProvider = null;
let type: Models.MfaType = null;
async function addAuthenticator(): Promise<URL> {
provider = await sdk.forConsole.account.addAuthenticator(AuthenticatorFactor.Totp);
type = await sdk.forConsole.account.addAuthenticator(AuthenticatorType.Totp);

return sdk.forConsole.avatars.getQR(provider.uri, 192 * 2);
return sdk.forConsole.avatars.getQR(type.uri, 192 * 2);
}

async function verifyAuthenticator() {
try {
await sdk.forConsole.account.verifyAuthenticator(AuthenticatorFactor.Totp, code);
await sdk.forConsole.account.verifyAuthenticator(AuthenticatorType.Totp, code);
await invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.FACTORS);
showSetup = false;
Expand Down Expand Up @@ -72,8 +72,8 @@
description="Learn more about multi-factor authentication in our documentation."
bind:show={showRecoveryCodes}
onSubmit={verifyAuthenticator}>
{#if provider}
{@const formattedBackupCodes = provider.backups.join('\n')}
{#if type}
{@const formattedBackupCodes = type.backups.join('\n')}
<Alert type="info">
<span slot="title">
It is highly recommended to securely store your recovery codes
Expand Down Expand Up @@ -109,7 +109,7 @@
</div>
<Table noMargin noStyles>
<TableBody>
{#each provider.backups as code}
{#each type.backups as code}
<TableRow>
<TableCell title="code">
<Output value={code} hideCopyIcon>{code}</Output>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/account/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { page } from '$app/stores';
import { derived } from 'svelte/store';
import type { Models } from '@appwrite.io/console';

export const factors = derived(page, ($page) => $page.data.factors as Models.MfaProviders);
export const factors = derived(page, ($page) => $page.data.factors as Models.MfaFactors);
15 changes: 10 additions & 5 deletions src/routes/console/project-[project]/auth/templates/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// TODO: fix TemplateType and TemplateLocale typing once SDK is updated
return await sdk.forConsole.projects.getEmailTemplate(
projectId,
type as TemplateType,
locale as TemplateLocale
type as EmailTemplateType,
locale as EmailTemplateLocale
);
} catch (e) {
addNotification({
Expand All @@ -19,8 +19,8 @@
// TODO: fix TemplateType and TemplateLocale typing once SDK is updated
return await sdk.forConsole.projects.getSmsTemplate(
projectId,
type as TemplateType,
locale as TemplateLocale
type as SmsTemplateType,
locale as SmsTemplateLocale
);
} catch (e) {
addNotification({
Expand Down Expand Up @@ -54,7 +54,12 @@
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
import { wizard } from '$lib/stores/wizard';
import { BillingPlan } from '$lib/constants';
import type { TemplateLocale, TemplateType } from '@appwrite.io/console';
import type {
SmsTemplateLocale,
SmsTemplateType,
EmailTemplateType,
EmailTemplateLocale
} from '@appwrite.io/console';

const projectId = $page.params.project;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import deepEqual from 'deep-equal';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { Box } from '$lib/components';
import type { TemplateLocale, TemplateType } from '@appwrite.io/console';
import type { EmailTemplateLocale, EmailTemplateType } from '@appwrite.io/console';

export let loading = false;
let openResetModal = false;
Expand Down Expand Up @@ -56,8 +56,8 @@
// TODO: fix TemplateType and TemplateLocale typing once SDK is updated
await sdk.forConsole.projects.updateEmailTemplate(
$project.$id,
$emailTemplate.type ? ($emailTemplate.type as TemplateType) : undefined,
$emailTemplate.locale ? ($emailTemplate.locale as TemplateLocale) : undefined,
$emailTemplate.type ? ($emailTemplate.type as EmailTemplateType) : undefined,
$emailTemplate.locale ? ($emailTemplate.locale as EmailTemplateLocale) : undefined,
$emailTemplate.subject ? $emailTemplate.subject : undefined,
$emailTemplate.message ? $emailTemplate.message : undefined,
$emailTemplate.senderName ? $emailTemplate.senderName : undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { Button } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import type { TemplateLocale, TemplateType } from '@appwrite.io/console';
import type { EmailTemplateLocale, EmailTemplateType } from '@appwrite.io/console';
import { project } from '../../store';
import { loadEmailTemplate } from './+page.svelte';
import { baseEmailTemplate, emailTemplate } from './store';
Expand All @@ -18,8 +18,8 @@
// TODO: fix TemplateType and TemplateLocale typing once SDK is updated
await sdk.forConsole.projects.deleteEmailTemplate(
$project.$id,
$emailTemplate.type as TemplateType,
$emailTemplate.locale as TemplateLocale
$emailTemplate.type as EmailTemplateType,
$emailTemplate.locale as EmailTemplateLocale
);
$emailTemplate = await loadEmailTemplate(
$project.$id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Modal } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { sdk } from '$lib/stores/sdk';
import type { TemplateLocale, TemplateType } from '@appwrite.io/console';
import type { SmsTemplateLocale, SmsTemplateType } from '@appwrite.io/console';
import { project } from '../../store';
import { loadSmsTemplate } from './+page.svelte';
import { baseSmsTemplate, smsTemplate } from './store';
Expand All @@ -17,8 +17,8 @@
// TODO: fix TemplateType and TemplateLocale typing once SDK is updated
await sdk.forConsole.projects.deleteSmsTemplate(
$project.$id,
$smsTemplate.type as TemplateType,
$smsTemplate.locale as TemplateLocale
$smsTemplate.type as SmsTemplateType,
$smsTemplate.locale as SmsTemplateLocale
);

$smsTemplate = await loadSmsTemplate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import deepEqual from 'deep-equal';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { Box } from '$lib/components';
import type { TemplateLocale, TemplateType } from '@appwrite.io/console';
import type { SmsTemplateLocale, SmsTemplateType } from '@appwrite.io/console';

export let loading = false;
const projectId = $page.params.project;
Expand Down Expand Up @@ -39,8 +39,8 @@
// TODO: fix TemplateType and TemplateLocale typing once SDK is updated
await sdk.forConsole.projects.updateSmsTemplate(
projectId,
$smsTemplate.type as TemplateType,
$smsTemplate.locale as TemplateLocale,
$smsTemplate.type as SmsTemplateType,
$smsTemplate.locale as SmsTemplateLocale,
$smsTemplate.message
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const load: LayoutLoad = async ({ params, depends }) => {
header: Header,
breadcrumbs: Breadcrumbs,
user: await sdk.forProject.users.get(params.user),
userFactors: await sdk.forProject.users.listProviders(params.user)
userFactors: await sdk.forProject.users.listFactors(params.user)
};
} catch (e) {
error(e.code, e.message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import InputDigits from '$lib/elements/forms/inputDigits.svelte';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { AuthenticatorProvider } from '@appwrite.io/console';
import { AuthenticatorType } from '@appwrite.io/console';
import { user } from './store';

export let showDelete = false;
Expand All @@ -18,11 +18,7 @@

async function deleteProvider() {
try {
await sdk.forConsole.users.deleteAuthenticator(
$user.$id,
AuthenticatorProvider.Totp,
''
);
await sdk.forConsole.users.deleteAuthenticator($user.$id, AuthenticatorType.Totp, '');
await invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.FACTORS);
showDelete = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const user = derived(
page,
($page) => $page.data.user as Models.User<Record<string, string>>
);
export const userFactors = derived(page, ($page) => $page.data.userFactors as Models.MfaProviders);
export const userFactors = derived(page, ($page) => $page.data.userFactors as Models.MfaFactors);
Loading