Merge remote-tracking branch 'origin/main' into feat-pause-project

This commit is contained in:
Damodar Lohani committed 2023-04-05 09:14:30 +05:45
commit 554a01c91f
203 files changed
+941 -526

No files matched your search

+10 -11
View File
@@ -6,11 +6,10 @@
"packages": {
"": {
"name": "@appwrite/console",
"version": "0.0.1",
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@appwrite.io/console": "0.1.0-preview-0.1",
"@appwrite.io/pink": "0.0.6-rc.2",
"@aw-labs/appwrite-console": "^13.1.0",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
"@sentry/tracing": "^7.44.2",
@@ -147,6 +146,15 @@
"resolved": "https://registry.npmjs.org/@analytics/type-utils/-/type-utils-0.6.0.tgz",
"integrity": "sha512-1Yw7u/COtxx06BfwlI+kVhsa/upKYzmCNrT4c8QDeCY2KMYlnijkUjtHiPU08HxyTIVB5j6d75O0YWVIHwQS8g=="
},
"node_modules/@appwrite.io/console": {
"version": "0.1.0-preview-0.1",
"resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-0.1.0-preview-0.1.tgz",
"integrity": "sha512-908URjvRoQ87zLJXW7UD0zOgy9DvShgs/YKQBgA9mdNbNmFIzls1XwtbUeNWWLBnx0EVTMjyWiaSou+QIZnXfA==",
"dependencies": {
"cross-fetch": "3.1.5",
"isomorphic-form-data": "2.0.0"
}
},
"node_modules/@appwrite.io/pink": {
"version": "0.0.6-rc.2",
"resolved": "https://registry.npmjs.org/@appwrite.io/pink/-/pink-0.0.6-rc.2.tgz",
@@ -162,15 +170,6 @@
"resolved": "https://registry.npmjs.org/@appwrite.io/pink-icons/-/pink-icons-0.0.5.tgz",
"integrity": "sha512-Ej9usq4C9pwrqCvSNvRnFJ1jPF1+iXq2+edBbuttF1f30jFlOXol/Z7gkDR1ofwtWUBFs2X+181dIPLJHICq+A=="
},
"node_modules/@aw-labs/appwrite-console": {
"version": "13.1.0",
"resolved": "https://registry.npmjs.org/@aw-labs/appwrite-console/-/appwrite-console-13.1.0.tgz",
"integrity": "sha512-1FyKke5b3vx+D3VfNYd3YnFhzUOlsj9bD+KTRLWA4WRItb55thFVZJMWQQ4XnZtDiLPuJAn2XjbMSfMr+9XYwg==",
"dependencies": {
"cross-fetch": "3.1.5",
"isomorphic-form-data": "2.0.0"
}
},
"node_modules/@babel/code-frame": {
"version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz",
+1 -1
View File
@@ -19,8 +19,8 @@
},
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@appwrite.io/console": "0.1.0-preview-0.1",
"@appwrite.io/pink": "0.0.6-rc.2",
"@aw-labs/appwrite-console": "^13.1.0",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
"@sentry/tracing": "^7.44.2",
+3 -1
View File
@@ -2,7 +2,7 @@ import { page } from '$app/stores';
import { user } from '$lib/stores/user';
import { ENV, MODE, VARS } from '$lib/system';
import googleAnalytics from '@analytics/google-analytics';
import { AppwriteException } from '@aw-labs/appwrite-console';
import { AppwriteException } from '@appwrite.io/console';
import Analytics from 'analytics';
import { get } from 'svelte/store';
@@ -141,6 +141,8 @@ export enum Submit {
TeamUpdateName = 'submit_team_update_name',
AuthLimitUpdate = 'submit_auth_limit_update',
AuthStatusUpdate = 'submit_auth_status_update',
AuthPasswordHistoryUpdate = 'submit_auth_password_history_limit_update',
AuthPasswordDictionaryUpdate = 'submit_auth_password_dictionary_update',
SessionsLengthUpdate = 'submit_sessions_length_update',
SessionsLimitUpdate = 'submit_sessions_limit_update',
SessionDelete = 'submit_session_delete',
+1
View File
@@ -1,6 +1,7 @@
export { default as Modal } from './modal.svelte';
export { default as Pagination } from './pagination.svelte';
export { default as PaginationInline } from './paginationInline.svelte';
export { default as Paginator } from './paginator.svelte';
export { default as Card } from './card.svelte';
export { default as CardGrid } from './cardGrid.svelte';
export { default as CardContainer } from './cardContainer.svelte';
+18
View File
@@ -0,0 +1,18 @@
<script lang="ts">
import PaginationInline from './paginationInline.svelte';
export let items = [];
export let limit = 5;
let offset = 0;
$: total = items?.length;
$: paginatedItems = items.slice(offset, offset + limit);
</script>
<slot {paginatedItems} />
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {total}</p>
<PaginationInline {limit} bind:offset sum={total} hidePages />
</div>
+4 -2
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { tick } from 'svelte';
import { AvatarInitials } from '../';
import Output from '../output.svelte';
@@ -14,7 +14,9 @@
async function getData(
permission: string
): Promise<Partial<Models.User<Record<string, unknown>> & Models.Team>> {
): Promise<
Partial<Models.User<Record<string, unknown>> & Models.Team<Record<string, unknown>>>
> {
const role = permission.split(':')[0];
const id = permission.split(':')[1].split('/')[0];
if (role === 'user') {
+6 -3
View File
@@ -2,7 +2,7 @@
import { Button, InputSearch } from '$lib/elements/forms';
import { createEventDispatcher } from 'svelte';
import { sdk } from '$lib/stores/sdk';
import { Query, type Models } from '@aw-labs/appwrite-console';
import { Query, type Models } from '@appwrite.io/console';
import { AvatarInitials, EmptySearch, Modal, PaginationInline } from '..';
import type { Writable } from 'svelte/store';
import type { Permission } from './permissions.svelte';
@@ -14,7 +14,7 @@
let search = '';
let offset = 0;
let results: Models.TeamList;
let results: Models.TeamList<Record<string, unknown>>;
let selected: Set<string> = new Set();
let hasSelection = false;
@@ -31,7 +31,10 @@
async function request() {
if (!show) return;
results = await sdk.forProject.teams.list([Query.limit(5), Query.offset(offset)], search);
results = await sdk.forProject.teams.list(
[Query.limit(5), Query.offset(offset)],
search || undefined
);
}
function onSelection(event: Event, role: string) {
+5 -2
View File
@@ -3,7 +3,7 @@
import { createEventDispatcher } from 'svelte';
import { AvatarInitials, EmptySearch, Modal, PaginationInline } from '..';
import { sdk } from '$lib/stores/sdk';
import { Query, type Models } from '@aw-labs/appwrite-console';
import { Query, type Models } from '@appwrite.io/console';
import type { Writable } from 'svelte/store';
import type { Permission } from './permissions.svelte';
@@ -31,7 +31,10 @@
async function request() {
if (!show) return;
results = await sdk.forProject.users.list([Query.limit(5), Query.offset(offset)], search);
results = await sdk.forProject.users.list(
[Query.limit(5), Query.offset(offset)],
search || undefined
);
}
function onSelection(event: Event, role: string) {
+1 -1
View File
@@ -15,7 +15,7 @@
export let maxlength: number = null;
// https://www.geeksforgeeks.org/how-to-validate-a-domain-name-using-regular-expression/
const pattern = String.raw`^(?!-)[A-Za-z0-9-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,6}$`;
const pattern = String.raw`^(?!-)[A-Za-z0-9-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,18}$`;
let element: HTMLInputElement;
let error: string;
+1 -1
View File
@@ -11,7 +11,7 @@
} from '$lib/elements/table';
import { Container } from '$lib/layout';
import { toLocaleDateTime } from '$lib/helpers/date';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export let logs: Models.LogList;
export let offset = 0;
+1 -1
View File
@@ -9,7 +9,7 @@
import { sdk } from '$lib/stores/sdk';
import { page } from '$app/stores';
import { calculateTime } from '$lib/helpers/timeConversion';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
let selectedTab: string;
let rawData: string;
+1 -1
View File
@@ -163,7 +163,7 @@
</div>
{#if subNavigation}
<div class="side-nav-level-2 is-open" transition:slide={{ axis: 'x', duration: 250 }}>
<div class="side-nav-level-2 is-open" transition:slide|local={{ axis: 'x', duration: 250 }}>
<div class="side-nav-main">
<svelte:component this={subNavigation} />
</div>
+5 -5
View File
@@ -1,17 +1,17 @@
<script lang="ts">
import { navigating, page } from '$app/stores';
import { browser } from '$app/environment';
import { wizard } from '$lib/stores/wizard';
import { log } from '$lib/stores/logs';
import { beforeNavigate } from '$app/navigation';
import { page } from '$app/stores';
import { log } from '$lib/stores/logs';
import { wizard } from '$lib/stores/wizard';
export let isOpen = false;
export let showSideNavigation = false;
let y: number;
navigating.subscribe(() => {
if (isOpen) isOpen = false;
page.subscribe(({ url }) => {
isOpen = url.searchParams.get('openNavbar') === 'true';
});
const toggleMenu = () => {
+1 -1
View File
@@ -16,7 +16,7 @@
import { BarChart, LineChart } from '$lib/charts';
import { Card, SecondaryTabs, SecondaryTabsItem, Heading, Tiles } from '$lib/components';
import { Colors } from '$lib/charts/config';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { page } from '$app/stores';
type MetricMetadata = {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Models, Payload } from '@aw-labs/appwrite-console';
import type { Models, Payload } from '@appwrite.io/console';
import { Service } from './service';
export class Project extends Service {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Client, Payload } from '@aw-labs/appwrite-console';
import type { Client, Payload } from '@appwrite.io/console';
export class Service {
static CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
+1 -1
View File
@@ -1,5 +1,5 @@
import { writable } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export type AuthMethod = {
label: string;
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { writable } from 'svelte/store';
export const log = writable<{
+1 -1
View File
@@ -1,5 +1,5 @@
import { writable } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import type { SvelteComponent } from 'svelte';
import Apple from '../../routes/console/project-[project]/auth/appleOAuth.svelte';
import Microsoft from '../../routes/console/project-[project]/auth/microsoftOAuth.svelte';
+6 -3
View File
@@ -1,12 +1,15 @@
import { page } from '$app/stores';
import { derived, writable } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export const newOrgModal = writable<boolean>(false);
export const newMemberModal = writable<boolean>(false);
export const organizationList = derived(
page,
($page) => $page.data.organizations as Models.TeamList
($page) => $page.data.organizations as Models.TeamList<Record<string, unknown>>
);
export const organization = derived(
page,
($page) => $page.data?.organization as Models.Team<Record<string, unknown>>
);
export const organization = derived(page, ($page) => $page.data.organization as Models.Team);
export const members = derived(page, ($page) => $page.data.members as Models.MembershipList);
+1 -1
View File
@@ -1,5 +1,5 @@
import { writable } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export type Service = {
label: string;
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { writable } from 'svelte/store';
export const user = writable<Models.User<Record<string, unknown>>>();
+1 -1
View File
@@ -13,7 +13,7 @@ import {
Storage,
Teams,
Users
} from '@aw-labs/appwrite-console';
} from '@appwrite.io/console';
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`;
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { writable } from 'svelte/store';
import { sdk } from './sdk';
+1 -1
View File
@@ -1,6 +1,6 @@
import { page } from '$app/stores';
import { derived } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export const user = derived(
page,
+1 -1
View File
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { Heading } from '$lib/components';
import { Account, Client } from '@aw-labs/appwrite-console';
import { Account, Client } from '@appwrite.io/console';
import { onMount } from 'svelte';
const client = new Client();
+3 -2
View File
@@ -27,7 +27,7 @@
async function updateName() {
try {
await sdk.forConsole.account.updateName(name);
invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.ACCOUNT);
addNotification({
message: 'Name has been updated',
type: 'success'
@@ -41,10 +41,11 @@
trackError(error, Submit.AccountUpdateName);
}
}
async function updateEmail() {
try {
await sdk.forConsole.account.updateEmail(email, emailPassword);
invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.ACCOUNT);
addNotification({
message: 'Email has been updated',
type: 'success'
+1 -1
View File
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
+3 -3
View File
@@ -9,11 +9,11 @@
export let showDelete = false;
const deleteAccount = async () => {
async function deleteAccount() {
try {
await sdk.forConsole.account.updateStatus();
await invalidate(Dependencies.ACCOUNT);
showDelete = false;
invalidate(Dependencies.ACCOUNT);
addNotification({
type: 'success',
message: `Account was deleted `
@@ -26,7 +26,7 @@
});
trackError(error, Submit.AccountDelete);
}
};
}
</script>
<Modal bind:show={showDelete} onSubmit={deleteAccount} warning>
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { CARD_LIMIT } from '$lib/constants';
@@ -15,31 +15,32 @@
import { sdk } from '$lib/stores/sdk';
import { goto, invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import type { PageData } from './$types';
import { Submit, trackEvent } from '$lib/actions/analytics';
import { base } from '$app/paths';
export let data: PageData;
const getBrowser = (clientCode: string) => {
function getBrowser(clientCode: string) {
return sdk.forConsole.avatars.getBrowser(clientCode, 40, 40);
};
}
const logout = async (session: Models.Session) => {
async function logout(session: Models.Session) {
await sdk.forConsole.account.deleteSession(session.$id);
await invalidate(Dependencies.ACCOUNT_SESSIONS);
trackEvent(Submit.AccountDeleteSession);
if (session.current) {
await goto(`${base}/login`);
}
invalidate(Dependencies.ACCOUNT_SESSIONS);
};
const logoutAll = async () => {
}
async function logoutAll() {
await sdk.forConsole.account.deleteSessions();
await invalidate(Dependencies.ACCOUNT_SESSIONS);
trackEvent(Submit.AccountDeleteAllSessions);
await goto(`${base}/login`);
invalidate(Dependencies.ACCOUNT_SESSIONS);
};
}
</script>
<Container>
+3 -3
View File
@@ -8,7 +8,7 @@
import { goto, invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { ID } from '@aw-labs/appwrite-console';
import { ID } from '@appwrite.io/console';
export let show = false;
@@ -19,7 +19,7 @@
const dispatch = createEventDispatcher();
const create = async () => {
async function create() {
try {
const org = await sdk.forConsole.teams.create(id ?? ID.unique(), name);
await invalidate(Dependencies.ACCOUNT);
@@ -39,7 +39,7 @@
error = e.message;
trackError(e, Submit.OrganizationCreate);
}
};
}
</script>
<Modal {error} onSubmit={create} size="big" bind:show>
+1 -1
View File
@@ -10,7 +10,7 @@
import { Container } from '$lib/layout';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { ID } from '@aw-labs/appwrite-console';
import { ID } from '@appwrite.io/console';
let name: string;
let id: string;
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { CARD_LIMIT } from '$lib/constants';
@@ -17,16 +17,18 @@
let email: string, name: string, error: string;
const url = `${$page.url.origin}/invite`;
const create = async () => {
async function create() {
try {
const team = await sdk.forConsole.teams.createMembership(
$organization.$id,
email,
['owner'],
url,
name
email,
undefined,
undefined,
name || undefined
);
invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.ACCOUNT);
showCreate = false;
addNotification({
type: 'success',
@@ -38,7 +40,7 @@
error = e.message;
trackError(e, Submit.MemberCreate);
}
};
}
$: if (!showCreate) {
error = null;
@@ -51,6 +53,7 @@
<svelte:fragment slot="header">Invite Member</svelte:fragment>
<FormList>
<InputEmail
required
id="email"
label="Email"
placeholder="Enter email"
@@ -6,7 +6,7 @@
import { InputText, Button, FormList } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { ID } from '@aw-labs/appwrite-console';
import { ID } from '@appwrite.io/console';
import { createEventDispatcher } from 'svelte';
export let show = false;
@@ -5,7 +5,7 @@
import { Button } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { createEventDispatcher } from 'svelte';
import { user } from '$lib/stores/user';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
@@ -11,19 +11,18 @@
export let showDelete = false;
const deleteOrg = async () => {
async function deleteOrg() {
try {
await sdk.forConsole.teams.delete($organization.$id);
await invalidate(Dependencies.ACCOUNT);
addNotification({
type: 'success',
message: `${$organization.name} has been deleted`
});
trackEvent(Submit.OrganizationDelete);
if ($organizationList?.total > 1) {
await invalidate(Dependencies.ACCOUNT);
goto(`${base}/console/`);
} else {
await invalidate(Dependencies.ACCOUNT);
goto(`${base}/console/onboarding`);
}
showDelete = false;
@@ -34,7 +33,7 @@
});
trackError(error, Submit.OrganizationDelete);
}
};
}
</script>
<Modal onSubmit={deleteOrg} bind:show={showDelete} warning>
@@ -19,7 +19,7 @@
import { addNotification } from '$lib/stores/notifications';
import { members, newMemberModal, organization } from '$lib/stores/organization';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import type { PageData } from './$types';
import Delete from '../deleteMember.svelte';
@@ -33,10 +33,12 @@
try {
await sdk.forConsole.teams.createMembership(
$organization.$id,
member.userEmail,
member.roles,
url,
member.userName
member.userEmail,
undefined,
undefined,
member.userName || undefined
);
addNotification({
type: 'success',
@@ -1,7 +1,7 @@
import { PAGE_LIMIT } from '$lib/constants';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { sdk } from '$lib/stores/sdk';
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url, params, route }) => {
@@ -20,7 +20,7 @@
async function updateName() {
try {
await sdk.forConsole.teams.update($organization.$id, name);
await sdk.forConsole.teams.updateName($organization.$id, name);
await invalidate(Dependencies.ORGANIZATION);
addNotification({
message: 'Name has been updated',
@@ -1,13 +1,11 @@
<script lang="ts">
import { UploadBox } from '$lib/components';
import { sdk } from '$lib/stores/sdk';
import { onDestroy, onMount } from 'svelte';
import { onMount } from 'svelte';
import { stats } from './store';
let unsubscribe: { (): void };
onMount(() => {
unsubscribe = sdk.forConsole.client.subscribe(['project', 'console'], (response) => {
onMount(async () => {
return sdk.forConsole.client.subscribe(['project', 'console'], (response) => {
if (response.events.includes('stats.connections')) {
for (const [projectId, value] of Object.entries(response.payload)) {
stats.add(projectId, [new Date(response.timestamp).toISOString(), value]);
@@ -15,12 +13,6 @@
}
});
});
onDestroy(() => {
if (unsubscribe) {
unsubscribe();
}
});
</script>
<slot />
@@ -25,7 +25,7 @@
import { base } from '$app/paths';
import { goto } from '$app/navigation';
import Create from './createUser.svelte';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import type { PageData } from './$types';
export let data: PageData;
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, getSearch, pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
@@ -5,7 +5,7 @@
import { InputText, Button, FormList } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { ID } from '@aw-labs/appwrite-console';
import { ID } from '@appwrite.io/console';
import { createEventDispatcher } from 'svelte';
export let showCreate = false;
@@ -12,7 +12,7 @@
} from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { ID } from '@aw-labs/appwrite-console';
import { ID } from '@appwrite.io/console';
import { createEventDispatcher } from 'svelte';
export let showCreate = false;
@@ -27,10 +27,10 @@
try {
const user = await sdk.forProject.users.create(
id ?? ID.unique(),
mail,
phone,
pass,
name
mail || undefined,
phone || undefined,
pass || undefined,
name || undefined
);
mail = pass = name = '';
showCreate = false;
@@ -1,5 +1,7 @@
<script lang="ts">
import { Container } from '$lib/layout';
import UpdatePasswordDictionary from './updatePasswordDictionary.svelte';
import UpdatePasswordHistory from './updatePasswordHistory.svelte';
import UpdateSessionLength from './updateSessionLength.svelte';
import UpdateSessionsLimit from './updateSessionsLimit.svelte';
import UpdateUsersLimit from './updateUsersLimit.svelte';
@@ -9,4 +11,6 @@
<UpdateUsersLimit />
<UpdateSessionLength />
<UpdateSessionsLimit />
<UpdatePasswordHistory />
<UpdatePasswordDictionary />
</Container>
@@ -0,0 +1,62 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { CardGrid, Heading } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, FormList, InputSwitch } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { project } from '../../store';
const projectId = $project.$id;
let passwordDictionary = $project.authPasswordDictionary ?? false;
async function updatePasswordDictionary() {
try {
await sdk.forConsole.projects.updateAuthPasswordDictionary(
projectId,
passwordDictionary
);
await invalidate(Dependencies.PROJECT);
addNotification({
type: 'success',
message: 'Updated password dictionary check.'
});
trackEvent(Submit.AuthPasswordDictionaryUpdate);
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.AuthPasswordDictionaryUpdate);
}
}
</script>
<Form onSubmit={updatePasswordDictionary}>
<CardGrid>
<Heading tag="h2" size="6">Password Dictionary</Heading>
<svelte:fragment slot="aside">
<FormList>
<InputSwitch
bind:value={passwordDictionary}
id="passwordDictionary"
label="Password Dictionary" />
</FormList>
<p class="text">
Enabling this option prevent users from setting insecure passwords by comparing the
user's password with the <a
target="_blank"
rel="noopener noreferrer"
class="link"
href="https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/10k-most-common.txt"
>10k most commonly used passwords.</a>
</p>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={passwordDictionary === $project.authPasswordDictionary} submit
>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -0,0 +1,76 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { CardGrid, Heading } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputNumber, InputSwitch } from '$lib/elements/forms';
import FormList from '$lib/elements/forms/formList.svelte';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { project } from '../../store';
const projectId = $project.$id;
let passwordHistory = $project.authPasswordHistory < 1 ? 5 : $project.authPasswordHistory;
let passwordHistoryEnabled = ($project.authPasswordHistory ?? 0) != 0;
let initialPasswordHistoryEnabled = passwordHistoryEnabled;
async function updatePasswordHistoryLimit() {
try {
await sdk.forConsole.projects.updateAuthPasswordHistory(
projectId,
passwordHistoryEnabled ? passwordHistory : 0
);
await invalidate(Dependencies.PROJECT);
initialPasswordHistoryEnabled = passwordHistoryEnabled;
addNotification({
type: 'success',
message: 'Updated password history limit.'
});
trackEvent(Submit.AuthPasswordHistoryUpdate);
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.AuthPasswordHistoryUpdate);
}
}
</script>
<Form onSubmit={updatePasswordHistoryLimit}>
<CardGrid>
<Heading tag="h2" size="6">Password History</Heading>
<svelte:fragment slot="aside">
<FormList>
<InputSwitch
bind:value={passwordHistoryEnabled}
id="passwordHisotryEnabled"
label="Password History" />
</FormList>
<p class="text">
Enabling this option prevents users from reusing recent passwords by comparing the
new password with their password history.
</p>
<p class="text">
Set the maximum number of passwords saved per user. Maximum 20 passwords.
</p>
<FormList>
<InputNumber
max={20}
min={1}
id="max-session"
label="Limit"
disabled={!passwordHistoryEnabled}
bind:value={passwordHistory} />
</FormList>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button
disabled={(passwordHistory === $project.authPasswordHistory ||
$project.authPasswordHistory === 0) &&
initialPasswordHistoryEnabled === passwordHistoryEnabled}
submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -16,7 +16,7 @@
async function updateSessionLength() {
try {
await sdk.forConsole.projects.updateAuthDuration(projectId, $baseValue);
invalidate(Dependencies.PROJECT);
await invalidate(Dependencies.PROJECT);
addNotification({
type: 'success',
@@ -1,6 +1,8 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { CardGrid, Heading } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputNumber } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
@@ -13,6 +15,7 @@
async function updateSessionsLimit() {
try {
await sdk.forConsole.projects.updateAuthSessionsLimit(projectId, maxSessions);
await invalidate(Dependencies.PROJECT);
addNotification({
type: 'success',
@@ -14,11 +14,9 @@
let isLimited = $project.authLimit !== 0;
let newLimit = isLimited ? $project.authLimit : 100;
let submitting = false;
$: btnDisabled = (function isBtnDisabled() {
if (
submitting ||
(!isLimited && $project.authLimit === 0) ||
(isLimited && $project.authLimit === newLimit)
) {
@@ -29,10 +27,9 @@
})();
async function updateLimit() {
submitting = true;
try {
await sdk.forConsole.projects.updateAuthLimit(projectId, isLimited ? newLimit : 0);
invalidate(Dependencies.PROJECT).then(() => (submitting = false));
await invalidate(Dependencies.PROJECT);
addNotification({
type: 'success',
message: 'Updated project users limit successfully'
@@ -43,7 +40,6 @@
type: 'error',
message: error.message
});
submitting = false;
trackError(error, Submit.AuthLimitUpdate);
}
}
@@ -23,7 +23,7 @@
import { toLocaleDateTime } from '$lib/helpers/date';
import { Container } from '$lib/layout';
import { base } from '$app/paths';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import type { PageData } from './$types';
export let data: PageData;
@@ -31,7 +31,7 @@
let showCreate = false;
const project = $page.params.project;
const teamCreated = async (event: CustomEvent<Models.Team>) => {
const teamCreated = async (event: CustomEvent<Models.Team<Record<string, unknown>>>) => {
await goto(`${base}/console/project-${project}/auth/teams/team-${event.detail.$id}`);
};
</script>
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, getSearch, pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
@@ -1,42 +1,11 @@
<script lang="ts">
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { CardGrid, Box, Heading, AvatarInitials } from '$lib/components';
import { CardGrid, Heading, AvatarInitials } from '$lib/components';
import { Container } from '$lib/layout';
import { Button, InputText, Form } from '$lib/elements/forms';
import { sdk } from '$lib/stores/sdk';
import { toLocaleDateTime } from '$lib/helpers/date';
import { addNotification } from '$lib/stores/notifications';
import { team } from './store';
import { Dependencies } from '$lib/constants';
import { invalidate } from '$app/navigation';
import DeleteTeam from './deleteTeam.svelte';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
let showDelete = false;
let teamName: string = null;
onMount(async () => {
teamName ??= $team.name;
});
async function updateName() {
try {
await sdk.forProject.teams.update($page.params.team, teamName);
invalidate(Dependencies.TEAM);
addNotification({
message: 'Name has been updated',
type: 'success'
});
trackEvent(Submit.TeamUpdateName);
} catch (error) {
addNotification({
message: error.message,
type: 'error'
});
trackError(error, Submit.TeamUpdateName);
}
}
import UpdatePrefs from './updatePrefs.svelte';
import UpdateName from './updateName.svelte';
import DangerZone from './dangerZone.svelte';
</script>
<Container>
@@ -54,54 +23,7 @@
</div>
</svelte:fragment>
</CardGrid>
<Form onSubmit={updateName}>
<CardGrid>
<Heading tag="h6" size="7">Name</Heading>
<svelte:fragment slot="aside">
<ul>
<InputText
id="name"
label="Name"
placeholder="Enter team name"
autocomplete={false}
bind:value={teamName} />
</ul>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button submit disabled={teamName === $team.name || !teamName}>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
<CardGrid danger>
<div>
<Heading tag="h6" size="7">Delete Team</Heading>
</div>
<p>
The team will be permanently deleted, including all data associated with this team. This
action is irreversible.
</p>
<svelte:fragment slot="aside">
<Box>
<svelte:fragment slot="image">
<AvatarInitials size={48} name={$team.name} />
</svelte:fragment>
<svelte:fragment slot="title">
<h6 class="u-bold u-trim-1">{$team.name}</h6>
<span>{$team.total} Members</span>
</svelte:fragment>
</Box>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button secondary on:click={() => (showDelete = true)} event="delete_team">
Delete
</Button>
</svelte:fragment>
</CardGrid>
<UpdateName />
<UpdatePrefs />
<DangerZone />
</Container>
<DeleteTeam team={$team} bind:showDelete />
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
@@ -15,16 +15,18 @@
let name: string, email: string, roles: string[];
let error: string;
const create = async () => {
async function create() {
const url = `${$page.url.origin}/console/project-${$page.params.project}/auth/teams/team-${$page.params.team}/members`;
try {
const user = await sdk.forProject.teams.createMembership(
teamId,
email,
roles,
url,
name
email || undefined,
undefined,
undefined,
name || undefined
);
addNotification({
type: 'success',
@@ -39,7 +41,7 @@
error = e.message;
trackError(e, Submit.MemberCreate);
}
};
}
</script>
<Modal {error} onSubmit={create} size="big" bind:show={showCreate}>
@@ -0,0 +1,35 @@
<script lang="ts">
import { AvatarInitials, Box, CardGrid, Heading } from '$lib/components';
import { Button } from '$lib/elements/forms';
import DeleteTeam from './deleteTeam.svelte';
import { team } from './store';
let showDelete = false;
</script>
<CardGrid danger>
<div>
<Heading tag="h6" size="7">Delete Team</Heading>
</div>
<p>
The team will be permanently deleted, including all data associated with this team. This
action is irreversible.
</p>
<svelte:fragment slot="aside">
<Box>
<svelte:fragment slot="image">
<AvatarInitials size={48} name={$team.name} />
</svelte:fragment>
<svelte:fragment slot="title">
<h6 class="u-bold u-trim-1">{$team.name}</h6>
<span>{$team.total} Members</span>
</svelte:fragment>
</Box>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button secondary on:click={() => (showDelete = true)} event="delete_team">Delete</Button>
</svelte:fragment>
</CardGrid>
<DeleteTeam team={$team} bind:showDelete />
@@ -7,7 +7,7 @@
import { Button } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
@@ -7,10 +7,10 @@
import { Button } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export let showDelete = false;
export let team: Models.Team;
export let team: Models.Team<Record<string, unknown>>;
const deleteTeam = async () => {
try {
@@ -19,7 +19,7 @@
} from '$lib/elements/table';
import { Button } from '$lib/elements/forms';
import { Container } from '$lib/layout';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { invalidate } from '$app/navigation';
import { base } from '$app/paths';
import { toLocaleDateTime } from '$lib/helpers/date';
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, getSearch, pageToOffset } from '$lib/helpers/load';
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
@@ -1,5 +1,8 @@
import { derived } from 'svelte/store';
import { page } from '$app/stores';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export const team = derived(page, ($page) => $page.data.team as Models.Team);
export const team = derived(
page,
($page) => $page.data.team as Models.Team<Record<string, unknown>>
);
@@ -0,0 +1,57 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { page } from '$app/stores';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { CardGrid, Heading } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { team } from './store';
let teamName: string = null;
onMount(async () => {
teamName ??= $team.name;
});
async function updateName() {
try {
await sdk.forProject.teams.updateName($page.params.team, teamName);
await invalidate(Dependencies.TEAM);
addNotification({
message: 'Name has been updated',
type: 'success'
});
trackEvent(Submit.TeamUpdateName);
} catch (error) {
addNotification({
message: error.message,
type: 'error'
});
trackError(error, Submit.TeamUpdateName);
}
}
</script>
<Form onSubmit={updateName}>
<CardGrid>
<Heading tag="h6" size="7">Name</Heading>
<svelte:fragment slot="aside">
<ul>
<InputText
id="name"
label="Name"
placeholder="Enter team name"
autocomplete={false}
bind:value={teamName} />
</ul>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button submit disabled={teamName === $team.name || !teamName}>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -0,0 +1,135 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { CardGrid, Heading } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button, Form } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { team } from './store';
$: if (prefs) {
if (JSON.stringify(prefs) !== JSON.stringify(Object.entries($team.prefs))) {
if (!!prefs[prefs.length - 1][0] && !!prefs[prefs.length - 1][1]) {
arePrefsDisabled = false;
} else {
arePrefsDisabled = true;
}
} else {
arePrefsDisabled = true;
}
}
let prefs: [string, unknown][] = null;
let arePrefsDisabled = true;
onMount(async () => {
prefs = Object.entries($team.prefs);
if (!prefs?.length) {
prefs.push(['', '']);
}
});
async function updatePrefs() {
try {
let updatedPrefs = Object.fromEntries(prefs);
await sdk.forProject.teams.updatePrefs($team.$id, updatedPrefs);
await invalidate(Dependencies.TEAM);
arePrefsDisabled = true;
addNotification({
message: 'Preferences have been updated',
type: 'success'
});
trackEvent(Submit.UserUpdatePreferences);
} catch (error) {
addNotification({
message: error.message,
type: 'error'
});
trackError(error, Submit.UserUpdatePreferences);
}
}
</script>
<Form onSubmit={updatePrefs}>
<CardGrid>
<Heading tag="h6" size="7">Team Preferences</Heading>
<p>
You can update your team's preferences by storing shared information on the teams's
objects so they can easily be shared across members.
</p>
<svelte:fragment slot="aside">
<form class="form u-grid u-gap-16">
<ul class="form-list">
{#if prefs}
{#each prefs as [key, value], index}
<li class="form-item is-multiple">
<div class="form-item-part u-stretch">
<label class="label" for={`key-${index}`}>Key</label>
<div class="input-text-wrapper">
<input
id={`key-${key}`}
placeholder="Enter key"
type="text"
class="input-text"
bind:value={key} />
</div>
</div>
<div class="form-item-part u-stretch">
<label class="label" for={`value-${index}`}> Value </label>
<div class="input-text-wrapper">
<input
id={`value-${value}`}
placeholder="Enter value"
type="text"
class="input-text"
bind:value />
</div>
</div>
<div class="form-item-part u-cross-child-end">
<Button
text
disabled={(!key || !value) && index === 0}
on:click={() => {
if (index === 0) {
prefs = [['', '']];
} else {
prefs.splice(index, 1);
prefs = prefs;
}
}}>
<span class="icon-x" aria-hidden="true" />
</Button>
</div>
</li>
{/each}
{/if}
</ul>
<Button
noMargin
text
disabled={prefs?.length &&
prefs[prefs.length - 1][0] &&
prefs[prefs.length - 1][1]
? false
: true}
on:click={() => {
if (prefs[prefs.length - 1][0] && prefs[prefs.length - 1][1]) {
prefs.push(['', '']);
prefs = prefs;
}
}}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">Add Preference</span>
</Button>
</form>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={arePrefsDisabled} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -29,10 +29,12 @@ export async function updateOAuth({
await sdk.forConsole.projects.updateOAuth2(
projectId,
provider.name.toLowerCase(),
appId,
secret,
appId || undefined,
secret || undefined,
enabled
);
await invalidate(Dependencies.PROJECT);
addNotification({
type: 'success',
message: `${provider.name} authentication has been updated`
@@ -41,7 +43,6 @@ export async function updateOAuth({
provider,
enabled
});
invalidate(Dependencies.PROJECT);
return { status: 'success' };
} catch (e) {
@@ -1,4 +1,4 @@
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import type { PageLoad } from './$types';
import { error } from '@sveltejs/kit';
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
@@ -11,10 +11,10 @@
export let showDeleteAll = false;
const deleteAllSessions = async () => {
async function deleteAllSessions() {
try {
await sdk.forProject.users.deleteSessions($page.params.user);
invalidate(Dependencies.SESSIONS);
await invalidate(Dependencies.SESSIONS);
showDeleteAll = false;
addNotification({
type: 'success',
@@ -28,7 +28,7 @@
});
trackError(error, Submit.SessionDeleteAll);
}
};
}
</script>
<Modal bind:show={showDeleteAll} onSubmit={deleteAllSessions} warning>
@@ -8,20 +8,19 @@
import { Button } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export let showDelete = false;
export let selectedMembership: Models.Membership;
const deleteMembership = async () => {
async function deleteMembership() {
try {
await sdk.forProject.teams.deleteMembership(
selectedMembership.teamId,
selectedMembership.$id
);
invalidate(Dependencies.MEMBERSHIPS);
await invalidate(Dependencies.MEMBERSHIPS);
showDelete = false;
addNotification({
type: 'success',
message: `Membership has been deleted`
@@ -37,7 +36,7 @@
});
trackError(error, Submit.MemberDelete);
}
};
}
</script>
<Modal bind:show={showDelete} onSubmit={deleteMembership} warning>
@@ -11,10 +11,10 @@
export let showDelete = false;
export let selectedSessionId: string;
const deleteSession = async () => {
async function deleteSession() {
try {
await sdk.forProject.users.deleteSession($page.params.user, selectedSessionId);
invalidate(Dependencies.SESSIONS);
await invalidate(Dependencies.SESSIONS);
addNotification({
type: 'success',
message: 'Session has been deleted'
@@ -27,7 +27,7 @@
});
trackError(error, Submit.SessionDelete);
}
};
}
</script>
<Modal bind:show={showDelete} onSubmit={deleteSession} warning>
@@ -14,7 +14,7 @@
import { Button } from '$lib/elements/forms';
import { Container } from '$lib/layout';
import DeleteMembership from '../deleteMembership.svelte';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import type { PageData } from './$types';
import { trackEvent } from '$lib/actions/analytics';
import { toLocaleDateTime } from '$lib/helpers/date';
@@ -1,6 +1,6 @@
import { derived } from 'svelte/store';
import { page } from '$app/stores';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export const user = derived(
page,
@@ -17,7 +17,7 @@
async function updateEmail() {
try {
await sdk.forProject.users.updateEmail($user.$id, userEmail);
invalidate(Dependencies.USER);
await invalidate(Dependencies.USER);
addNotification({
message: 'Email has been updated',
type: 'success'
@@ -17,7 +17,7 @@
async function updateName() {
try {
await sdk.forProject.users.updateName($user.$id, userName);
invalidate(Dependencies.USER);
await invalidate(Dependencies.USER);
addNotification({
message: 'Name has been updated',
type: 'success'
@@ -17,7 +17,7 @@
async function updatePhone() {
try {
await sdk.forProject.users.updatePhone($user.$id, userPhone);
invalidate(Dependencies.USER);
await invalidate(Dependencies.USER);
addNotification({
message: 'Phone has been updated',
type: 'success'
@@ -36,7 +36,7 @@
let updatedPrefs = Object.fromEntries(prefs);
await sdk.forProject.users.updatePrefs($user.$id, updatedPrefs);
invalidate(Dependencies.USER);
await invalidate(Dependencies.USER);
arePrefsDisabled = true;
addNotification({
@@ -16,7 +16,7 @@
showVerifcationDropdown = false;
try {
await sdk.forProject.users.updateEmailVerification($user.$id, !$user.emailVerification);
invalidate(Dependencies.USER);
await invalidate(Dependencies.USER);
addNotification({
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
$user.emailVerification ? 'unverified' : 'verified'
@@ -36,7 +36,7 @@
showVerifcationDropdown = false;
try {
await sdk.forProject.users.updatePhoneVerification($user.$id, !$user.phoneVerification);
invalidate(Dependencies.USER);
await invalidate(Dependencies.USER);
addNotification({
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
$user.phoneVerification ? 'unverified' : 'verified'
@@ -8,7 +8,7 @@
import Create from './create.svelte';
import Grid from './grid.svelte';
import Table from './table.svelte';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import type { PageData } from './$types';
import { columns } from './store';
@@ -1,7 +1,7 @@
import { CARD_LIMIT } from '$lib/constants';
import { getLimit, getPage, getView, pageToOffset, View } from '$lib/helpers/load';
import { sdk } from '$lib/stores/sdk';
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url, route }) => {
@@ -5,7 +5,7 @@
import { Button, InputText, FormList } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { ID } from '@aw-labs/appwrite-console';
import { ID } from '@appwrite.io/console';
import { createEventDispatcher } from 'svelte';
export let showCreate = false;
@@ -1,6 +1,6 @@
<script lang="ts">
import { goto, invalidate } from '$app/navigation';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import CreateCollection from './createCollection.svelte';
import { showCreate } from './store';
import { base } from '$app/paths';
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, getView, pageToOffset, View } from '$lib/helpers/load';
import { CARD_LIMIT } from '$lib/constants';
@@ -5,7 +5,7 @@ import Breadcrumbs from './breadcrumbs.svelte';
import Header from './header.svelte';
import { error } from '@sveltejs/kit';
import SubNavigation from './subNavigation.svelte';
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
export const load: LayoutLoad = async ({ params, depends }) => {
depends(Dependencies.COLLECTION);
@@ -1,7 +1,7 @@
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
import { getLimit, getPage, getView, pageToOffset, View } from '$lib/helpers/load';
import { sdk } from '$lib/stores/sdk';
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params, depends, url, route }) => {
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
export async function submitBoolean(
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
export async function submitDatetime(
@@ -15,14 +15,14 @@
export let selectedAttribute: Attributes;
const databaseId = $page.params.database;
const handleDelete = async () => {
async function handleDelete() {
try {
await sdk.forProject.databases.deleteAttribute(
databaseId,
$collection.$id,
selectedAttribute.key
);
invalidate(Dependencies.COLLECTION);
await invalidate(Dependencies.COLLECTION);
showDelete = false;
addNotification({
type: 'success',
@@ -39,7 +39,7 @@
});
trackError(error, Submit.AttributeDelete);
}
};
}
</script>
<Modal warning={true} bind:show={showDelete} onSubmit={handleDelete}>
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
export async function submitEnum(
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
export async function submitFloat(
@@ -1,6 +1,6 @@
<script context="module" lang="ts">
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
export async function submitInteger(
databaseId: string,
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
export async function submitIp(
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
export async function submitString(
@@ -1,5 +1,5 @@
<script context="module" lang="ts">
import type { Models } from '@aw-labs/appwrite-console';
import type { Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
export async function submitUrl(
@@ -25,7 +25,7 @@
async function submit() {
try {
await $option.func(databaseId, collectionId, key, data);
invalidate(Dependencies.COLLECTION);
await invalidate(Dependencies.COLLECTION);
if (!$page.url.pathname.includes('attributes')) {
goto(
`${base}/console/project-${$page.params.project}/databases/database-${databaseId}/collection-${collectionId}/attributes`
@@ -13,7 +13,7 @@
import type { WizardStepsType } from '$lib/layout/wizard.svelte';
import { Dependencies } from '$lib/constants';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { ID } from '@aw-labs/appwrite-console';
import { ID } from '@appwrite.io/console';
const databaseId = $page.params.database;
const collectionId = $page.params.collection;
@@ -40,6 +40,7 @@
$createDocument.document,
$createDocument.permissions
);
await invalidate(Dependencies.DOCUMENTS);
addNotification({
message: 'Document has been created',
@@ -48,7 +49,6 @@
trackEvent(Submit.DocumentCreate, {
customId: !!$createDocument.id
});
invalidate(Dependencies.DOCUMENTS);
createDocument.reset();
wizard.hide();
@@ -29,7 +29,7 @@
$doc.data,
permissions
);
invalidate(Dependencies.DOCUMENT);
await invalidate(Dependencies.DOCUMENT);
arePermsDisabled = true;
addNotification({
message: 'Permissions have been updated',
@@ -1,4 +1,4 @@
import { Query } from '@aw-labs/appwrite-console';
import { Query } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
Loaded 100 of 203 files, more files were not shown because too many files have changed in this diff. Show more