Merge branch '1.5.x' of https://github.com/appwrite/console into feat-mfa

This commit is contained in:
Torsten Dittmann committed 2024-02-02 14:32:06 +01:00
commit 0bb7a09858
34 files changed
+197 -217

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: Audit dependencies
run: npm audit --audit-level low
- name: Install dependencies
+53 -2
View File
@@ -79,12 +79,12 @@ export const scopes: {
},
{
scope: 'accounts.read',
description: 'Access to read your active acount',
description: 'Access to read your active account',
category: 'Auth'
},
{
scope: 'accounts.write',
description: 'Access to create, update and delete your active acount',
description: 'Access to create, update and delete your active account',
category: 'Auth'
},
{
@@ -190,6 +190,57 @@ export const scopes: {
description: "Access to execute your project's functions",
category: 'Functions'
},
{
scope: 'targets.read',
description: "Access to read your project's messaging targets",
category: 'Messaging'
},
{
scope: 'targets.write',
description: "Access to create, update, and delete your project's messaging targets",
category: 'Messaging'
},
{
scope: 'providers.read',
description: "Access to read your project's messaging providers",
category: 'Messaging'
},
{
scope: 'providers.write',
description: "Access to create, update, and delete your project's messaging providers",
category: 'Messaging'
},
{
scope: 'messages.read',
description: "Access to read your project's messages",
category: 'Messaging'
},
{
scope: 'messages.write',
description: "Access to create, update, and delete your project's messages",
category: 'Messaging'
},
{
scope: 'topics.read',
description: "Access to read your project's messaging topics",
category: 'Messaging'
},
{
scope: 'topics.write',
description: "Access to create, update, and delete your project's messaging topics",
category: 'Messaging'
},
{
scope: 'subscribers.read',
description: "Access to read your project's messaging topic subscribers",
category: 'Messaging'
},
{
scope: 'subscribers.write',
description:
"Access to create, update, and delete your project's messaging topic subscribers",
category: 'Messaging'
},
{
scope: 'locale.read',
description: "Access to access your project's Locale service",
+4
View File
@@ -71,10 +71,14 @@
{max}
autocomplete={autocomplete ? 'on' : 'off'}
type="date"
style="cursor: pointer;"
class="input-text"
bind:value
bind:this={element}
on:invalid={handleInvalid}
on:click={function () {
this.showPicker();
}}
style:--amount-of-buttons={isNullable ? 2.75 : 1}
style:--button-size={isNullable ? '2rem' : '1rem'} />
{#if isNullable}
+5 -1
View File
@@ -57,9 +57,13 @@
autocomplete={autocomplete ? 'on' : 'off'}
type="time"
class="input-text"
style="cursor: pointer;"
bind:value
bind:this={element}
on:invalid={handleInvalid} />
on:invalid={handleInvalid}
on:click={function () {
this.showPicker();
}} />
</div>
{#if error}
<Helper type="warning">{error}</Helper>
+7
View File
@@ -29,3 +29,10 @@ export type Column = {
*/
filter?: boolean;
};
export function isValueOfStringEnum<T extends Record<string, string>>(
enumType: T,
value: string
): value is T[keyof T] {
return Object.values<string>(enumType).includes(value);
}
@@ -23,7 +23,7 @@
<Container>
<div class="u-flex u-flex-vertical">
<div class="u-flex u-main-space-between">
<div class="u-flex u-main-space-between u-cross-center">
<Heading tag="h2" size="5">Targets</Heading>
<!-- TODO: Remove u-hide to add creating a target -->
<div class="is-only-mobile u-hide">
@@ -1,9 +1,9 @@
import { Query, type Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { getLimit, getPage, getQuery, getSearch, pageToOffset } from '$lib/helpers/load';
import { queries, queryParamToMap } from '$lib/components/filters';
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
import { getLimit, getPage, getQuery, getSearch, pageToOffset } from '$lib/helpers/load';
import { sdk } from '$lib/stores/sdk';
import { Query, type Models } from '@appwrite.io/console';
import type { PageLoad } from './$types';
import { queryParamToMap, queries } from '$lib/components/filters';
export const load: PageLoad = async ({ params, url, route, depends }) => {
depends(Dependencies.USER_TARGETS);
@@ -42,7 +42,7 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
payload
);
const promisesById: Record<string, Promise<any>> = {};
const promisesById: Record<string, Promise<Models.Provider>> = {};
targets.targets.forEach((target) => {
if (target.providerId && !promisesById[target.providerId]) {
promisesById[target.providerId] = sdk.forProject.client.call(
@@ -1,3 +1,5 @@
import { queries, queryParamToMap } from '$lib/components/filters';
import { CARD_LIMIT } from '$lib/constants';
import {
View,
getLimit,
@@ -7,11 +9,9 @@ import {
getView,
pageToOffset
} from '$lib/helpers/load';
import { CARD_LIMIT } from '$lib/constants';
import type { PageLoad } from './$types';
import { Query, type Models } from '@appwrite.io/console';
import { sdk } from '$lib/stores/sdk';
import { queries, queryParamToMap } from '$lib/components/filters';
import { Query, type Models } from '@appwrite.io/console';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url, route }) => {
const page = getPage(url);
@@ -26,7 +26,10 @@ export const load: PageLoad = async ({ url, route }) => {
// TODO: remove when the API is ready with data
// This allows us to mock w/ data and when search returns 0 results
let messages: { messages: Models.Message[]; total: number } = { messages: [], total: 0 };
let messages: {
messages: ({ data: Record<string, string> } & Models.Message)[];
total: number;
} = { messages: [], total: 0 };
const params = {
queries: [
Query.limit(limit),
@@ -18,10 +18,14 @@
import { wizard } from '$lib/stores/wizard';
import Wizard from '../wizard.svelte';
import type { PageData } from './$types';
import { isValueOfStringEnum } from '$lib/helpers/types';
export let data: PageData;
async function onEdit() {
if (!isValueOfStringEnum(ProviderTypes, $message.providerType)) {
throw new Error(`Invalid provider type: ${$message.providerType}`);
}
$operation = 'update';
$providerType = $message.providerType;
$topicsById = {};
@@ -35,7 +39,6 @@
topics: $message.topics,
users: $message.users,
targets: $message.targets,
description: $message.description,
status: MessageStatuses.DRAFT,
scheduledAt: $message.scheduledAt
};
@@ -3,7 +3,7 @@
import { Button, FormList, InputText, InputTextarea } from '$lib/elements/forms';
import type { Models } from '@appwrite.io/console';
export let message: Models.Message & { data: Record<string, string>; };
export let message: Models.Message & { data: Record<string, string> };
export let onEdit: () => void = null;
</script>
@@ -4,7 +4,7 @@
import type { Models } from '@appwrite.io/console';
import PushPhone from '../pushPhone.svelte';
export let message: Models.Message & { data: Record<string, string>; };
export let message: Models.Message & { data: Record<string, string> };
export let onEdit: () => void = null;
</script>
@@ -4,7 +4,7 @@
import type { Models } from '@appwrite.io/console';
import SMSPhone from '../smsPhone.svelte';
export let message: Models.Message & { data: Record<string, string>; };
export let message: Models.Message & { data: Record<string, string> };
export let onEdit: () => void = null;
</script>
@@ -2,4 +2,7 @@ import { derived } from 'svelte/store';
import { page } from '$app/stores';
import type { Models } from '@appwrite.io/console';
export const message = derived(page, ($page) => $page.data.message as Models.Message);
export const message = derived(
page,
($page) => $page.data.message as Models.Message & { data: Record<string, string> }
);
@@ -7,7 +7,7 @@
</script>
<script lang="ts">
import type { Models } from "@appwrite.io/console";
import type { Models } from '@appwrite.io/console';
export let type: ProviderTypes | Models.Provider['type'];
export let noIcon = false;
@@ -186,7 +186,7 @@
providerId: providerId,
name: $providerParams[$provider].name,
enabled: $providerParams[$provider].enabled,
serverKey: $providerParams[$provider].serverKey
serviceAccountJSON: $providerParams[$provider].serviceAccountJSON
}
);
break;
@@ -7,13 +7,9 @@
import { providerType, provider } from './wizard/store';
import { ProviderTypes } from '../providerType.svelte';
import { Providers } from '../provider.svelte';
import { isValueOfStringEnum } from '$lib/helpers/types';
export let showCreateDropdown = false;
const isValueOfStringEnum = <T extends Record<string, string>>(
enumType: T,
value: string
): value is T[keyof T] => Object.values<string>(enumType).includes(value);
</script>
<DropList bind:show={showCreateDropdown} scrollable placement="bottom-end">
@@ -1,19 +1,20 @@
<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, InputSwitch } from '$lib/elements/forms';
import { toLocaleDateTime } from '$lib/helpers/date';
import { onMount } from 'svelte';
import { provider } from './store';
import { sdk } from '$lib/stores/sdk';
import { isValueOfStringEnum } from '$lib/helpers/types';
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { Dependencies } from '$lib/constants';
import { invalidate } from '$app/navigation';
import Provider, { Providers } from '../../provider.svelte';
import ProviderType from '../../providerType.svelte';
import { provider as wizardProvider, providerType, providerParams } from '../wizard/store';
import { sdk } from '$lib/stores/sdk';
import { wizard } from '$lib/stores/wizard';
import { onMount } from 'svelte';
import Provider, { Providers } from '../../provider.svelte';
import ProviderType, { ProviderTypes } from '../../providerType.svelte';
import Update from '../update.svelte';
import { providerParams, providerType, provider as wizardProvider } from '../wizard/store';
import { provider } from './store';
let enabled: boolean = null;
@@ -22,6 +23,13 @@
});
function configure() {
if (!isValueOfStringEnum(ProviderTypes, $provider.type)) {
throw new Error(`Invalid provider type: ${$provider.type}`);
}
if (!isValueOfStringEnum(Providers, $provider.provider)) {
throw new Error(`Invalid provider: ${$provider.provider}`);
}
$providerType = $provider.type;
$wizardProvider = $provider.provider;
@@ -101,7 +109,7 @@
providerId: $provider.$id,
name: $provider.name,
enabled: $provider.enabled,
serverKey: $provider.credentials['serverKey']
serviceAccountJSON: $provider.credentials['serviceAccountJSON']
};
break;
case Providers.APNS:
@@ -1,10 +1,8 @@
import { writable } from 'svelte/store';
import type { Column } from '$lib/helpers/types';
import { writable } from 'svelte/store';
import { Providers } from '../provider.svelte';
import { ProviderTypes } from '../providerType.svelte';
export let showCreate = writable(false);
export const columns = writable<Column[]>([
{ id: '$id', title: 'Provider ID', type: 'string', show: true },
{ id: 'name', title: 'Name', type: 'string', show: true },
@@ -49,13 +47,13 @@ export const providers: ProvidersMap = {
description: 'Firebase Cloud Messaging',
configure: [
{
label: 'Server key (.json file)',
name: 'serverKey',
label: 'Service account JSON (.json file)',
name: 'serviceAccountJSON',
type: 'file',
allowedFileExtensions: ['json'],
placeholder: 'Enter server key',
placeholder: 'Enter service account JSON',
popover: [
'<b>How to get the FCM server key?</b>',
'<b>How to get the FCM service account JSON?</b>',
'Head to <b>Project settings -> Service accounts -> Generate new private key.</b>',
'Generating the new key will result in the download of a JSON file.'
]
@@ -186,7 +186,7 @@
providerId: providerId,
name: $providerParams[$provider].name,
enabled: $providerParams[$provider].enabled,
serverKey: $providerParams[$provider].serverKey
serviceAccountJSON: $providerParams[$provider].serviceAccountJSON
}
);
break;
@@ -96,7 +96,7 @@
providerId: id,
name: name,
enabled: true,
serverKey: ''
serviceAccountJSON: ''
};
break;
case Providers.APNS:
@@ -1,6 +1,6 @@
import type { Models } from '@appwrite.io/console';
import type { Providers } from '../../provider.svelte';
import { writable } from 'svelte/store';
import type { Providers } from '../../provider.svelte';
import type { ProviderTypes } from '../../providerType.svelte';
type ProviderParams = {
providerId: string;
@@ -69,7 +69,7 @@ export type SendgridProviderParams = ProviderParams & {
*/
export type FCMProviderParams = ProviderParams & {
serverKey: string;
serviceAccountJSON: string;
};
export type APNSProviderParams = ProviderParams & {
@@ -83,8 +83,8 @@ export type MQTTProviderParams = ProviderParams & {
serverKey: string;
};
export const providerType = writable<Models.Provider['type']>(null);
export const provider = writable<Models.Provider['provider']>(null);
export const providerType = writable<ProviderTypes>(null);
export const provider = writable<Providers>(null);
export const providerParams = writable<{
twilio: Partial<TwilioProviderParams>;
msg91: Partial<Msg91ProviderParams>;
@@ -6,7 +6,6 @@ export const showCreate = writable(false);
export const columns = writable<Column[]>([
{ id: '$id', title: 'Message ID', type: 'string', show: true, width: 140 },
{ id: 'description', title: 'Description', type: 'string', show: true, width: 140 },
{ id: 'message', title: 'Message', type: 'string', show: false, filter: false, width: 140 },
{ id: 'providerType', title: 'Type', type: 'string', show: true, width: 100 },
{ id: 'status', title: 'Status', type: 'string', show: true, width: 120 },
@@ -12,7 +12,7 @@
const dispatch = createEventDispatcher();
let name: string, description: string, id: string, error: string;
let name: string, id: string, error: string;
let showCustomId = false;
const create = async () => {
@@ -27,12 +27,10 @@
},
{
name,
description: description || undefined,
topicId: id ?? ID.unique()
}
);
name = '';
description = '';
showCreate = false;
showCustomId = false;
addNotification({
@@ -64,12 +62,6 @@
autofocus={true}
required
bind:value={name} />
<InputText
id="description"
label="Description"
placeholder="Enter description"
bind:value={description}>
</InputText>
{#if !showCustomId}
<div>
<Pill button on:click={() => (showCustomId = !showCustomId)}
@@ -6,7 +6,6 @@ export const showCreate = writable(false);
export const columns = writable<Column[]>([
{ id: '$id', title: 'Topic ID', type: 'string', show: true, width: 140 },
{ id: 'name', title: 'Name', type: 'string', show: true, width: 140 },
{ id: 'description', title: 'Description', type: 'string', show: true, width: 140 },
{ id: 'total', title: 'Subscribers', type: 'integer', show: true, width: 140 },
{ id: '$createdAt', title: 'Created', type: 'datetime', show: true, width: 140 }
]);
@@ -2,13 +2,11 @@
import { Container } from '$lib/layout';
import DangerZone from './dangerZone.svelte';
import Details from './details.svelte';
import UpdateDescription from './updateDescription.svelte';
import UpdateName from './updateName.svelte';
</script>
<Container>
<Details />
<UpdateName />
<UpdateDescription />
<DangerZone />
</Container>
@@ -1,65 +0,0 @@
<script lang="ts">
import { CardGrid, Heading } from '$lib/components';
import { Button, Form, InputText } from '$lib/elements/forms';
import { onMount } from 'svelte';
import { topic } from './store';
import { invalidate } from '$app/navigation';
import { trackEvent, Submit, trackError } from '$lib/actions/analytics';
import { Dependencies } from '$lib/constants';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
let description: string = null;
onMount(async () => {
description ??= $topic.description;
});
async function updateDescription() {
try {
await sdk.forProject.client.call(
'PATCH',
new URL(`${sdk.forProject.client.config.endpoint}/messaging/topics/${$topic.$id}`),
{
'X-Appwrite-Project': sdk.forProject.client.config.project,
'content-type': 'application/json',
'X-Appwrite-Mode': 'admin'
},
{
description
}
);
await invalidate(Dependencies.MESSAGING_TOPIC);
addNotification({
message: 'Description has been updated',
type: 'success'
});
trackEvent(Submit.MessagingTopicUpdateDescription);
} catch (error) {
addNotification({
message: error.message,
type: 'error'
});
trackError(error, Submit.MessagingTopicUpdateDescription);
}
}
</script>
<Form onSubmit={updateDescription}>
<CardGrid>
<Heading tag="h6" size="7">Description</Heading>
<svelte:fragment slot="aside">
<ul data-private>
<InputText
id="description"
label="Description"
placeholder="Enter description"
autocomplete={false}
bind:value={description} />
</ul>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={description === $topic.description} submit>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>
@@ -22,10 +22,7 @@
let search = '';
let offset = 0;
let totalResults = 0;
let userResultsById: Record<
string,
Models.User<Record<string, unknown>>
> = {}; // use a hash map so we can quickly look up a user by id
let userResultsById: Record<string, Models.User<Record<string, unknown>>> = {}; // use a hash map so we can quickly look up a user by id
let selected: Record<string, Models.Target> = {};
let hasSelection = false;
@@ -147,7 +144,7 @@
bind:value={search} />
{#if Object.keys(userResultsById).length > 0}
<Collapsible>
{#each Object.entries(userResultsById) as [userId, user]}
{#each Object.entries(userResultsById) as [userId, user] (userId)}
{@const selectedCount = user.targets.filter(
(target) => selected[target.$id]
).length}
@@ -81,29 +81,33 @@
);
break;
case ProviderTypes.Push:
const customData: Record<string, string> = {};
const { data } = $messageParams[ProviderTypes.Push];
if (data && data.length > 0) {
data.forEach((item) => {
if (item[0] === '') return;
customData[item[0]] = item[1];
});
}
response = await sdk.forProject.client.call(
'POST',
new URL(sdk.forProject.client.config.endpoint + '/messaging/messages/push'),
{
'X-Appwrite-Project': sdk.forProject.client.config.project,
'content-type': 'application/json',
'X-Appwrite-Mode': 'admin'
},
{
...payload,
data: customData,
messageId
{
const customData: Record<string, string> = {};
const { data } = $messageParams[ProviderTypes.Push];
if (data && data.length > 0) {
data.forEach((item) => {
if (item[0] === '') return;
customData[item[0]] = item[1];
});
}
);
response = await sdk.forProject.client.call(
'POST',
new URL(
sdk.forProject.client.config.endpoint + '/messaging/messages/push'
),
{
'X-Appwrite-Project': sdk.forProject.client.config.project,
'content-type': 'application/json',
'X-Appwrite-Mode': 'admin'
},
{
...payload,
data: customData,
messageId
}
);
}
break;
}
wizard.hide();
@@ -198,31 +202,33 @@
);
break;
case ProviderTypes.Push:
const customData: Record<string, string> = {};
const { data } = $messageParams[ProviderTypes.Push];
if (data && data.length > 0) {
data.forEach((item) => {
if (item[0] === '') return;
customData[item[0]] = item[1];
});
}
response = await sdk.forProject.client.call(
'PATCH',
new URL(
`${sdk.forProject.client.config.endpoint}/messaging/messages/push/${messageId}`
),
{
'X-Appwrite-Project': sdk.forProject.client.config.project,
'content-type': 'application/json',
'X-Appwrite-Mode': 'admin'
},
{
...payload,
data: customData,
messageId
{
const customData: Record<string, string> = {};
const { data } = $messageParams[ProviderTypes.Push];
if (data && data.length > 0) {
data.forEach((item) => {
if (item[0] === '') return;
customData[item[0]] = item[1];
});
}
);
response = await sdk.forProject.client.call(
'PATCH',
new URL(
`${sdk.forProject.client.config.endpoint}/messaging/messages/push/${messageId}`
),
{
'X-Appwrite-Project': sdk.forProject.client.config.project,
'content-type': 'application/json',
'X-Appwrite-Mode': 'admin'
},
{
...payload,
data: customData,
messageId
}
);
}
break;
}
wizard.hide();
@@ -52,7 +52,6 @@
createEmailMessage({
topics: $messageParams[ProviderTypes.Email]?.topics || [],
targets: $messageParams[ProviderTypes.Email]?.targets || [],
description: $messageParams[ProviderTypes.Email]?.description || 'Test message',
status: MessageStatuses.PROCESSING,
messageId: ID.unique(),
// TODO: properly handle the test email address
@@ -126,13 +125,6 @@
Enable the HTML mode if your message contains HTML tags.
</svelte:fragment>
</InputSwitch>
<InputText
id="description"
label="Description"
placeholder="Enter description"
tooltip="Provide a summary of the message. Users won't see this description."
bind:value={$messageParams[$providerType]['description']}>
</InputText>
{#if $operation === 'create'}
{#if !showCustomId}
<div>
@@ -86,7 +86,6 @@
createPushMessage({
topics: $messageParams[ProviderTypes.Push]?.topics || [],
targets: $messageParams[ProviderTypes.Push]?.targets || [],
description: $messageParams[ProviderTypes.Push]?.description || 'Test push',
status: MessageStatuses.PROCESSING,
messageId: ID.unique(),
// TODO: properly handle the test email address
@@ -163,7 +162,11 @@
</Modal>
</div>
<form class="form">
<Label>Custom data <span class="u-color-text-gray">(Optional)</span></Label>
<FormItem>
<Label
tooltip="Deliver supplementary data alongside the notification, which remains hidden from the user's view but can be accessed by your application."
>Custom data <span class="u-color-text-gray">(Optional)</span></Label>
</FormItem>
<div class=" u-grid u-gap-8">
<ul class="form-list" style="--p-form-list-gap: 1rem">
{#each customData || [] as _, rowIndex}
@@ -220,13 +223,6 @@
</Button>
</div>
</form>
<InputText
id="description"
label="Description"
placeholder="Enter description"
tooltip="Provide a summary of the message. Users won't see this description."
bind:value={$messageParams[$providerType]['description']}>
</InputText>
{#if $operation === 'create'}
{#if !showCustomId}
<div>
@@ -23,14 +23,7 @@
MessageStatuses,
operation
} from './store';
import {
Button,
FormList,
InputEmail,
InputRadio,
InputText,
InputTextarea
} from '$lib/elements/forms';
import { Button, FormList, InputEmail, InputRadio, InputTextarea } from '$lib/elements/forms';
import { Pill } from '$lib/elements';
import { CustomId, Modal } from '$lib/components';
import { user } from '$lib/stores/user';
@@ -51,7 +44,6 @@
createSMSMessage({
topics: $messageParams[ProviderTypes.Email]?.topics || [],
targets: $messageParams[ProviderTypes.Email]?.targets || [],
description: $messageParams[ProviderTypes.Email]?.description || 'Test message',
status: MessageStatuses.PROCESSING,
messageId: ID.unique(),
// TODO: properly handle the test email address
@@ -115,13 +107,6 @@
</svelte:fragment>
</Modal>
</div>
<InputText
id="description"
label="Description"
placeholder="Enter description"
tooltip="Provide a summary of the message. Users won't see this description."
bind:value={$messageParams[$providerType]['description']}>
</InputText>
{#if $operation === 'create'}
{#if !showCustomId}
<div>
@@ -1,6 +1,6 @@
import type { Models } from '@appwrite.io/console';
import { ProviderTypes } from '../providerType.svelte';
import { writable } from 'svelte/store';
import { ProviderTypes } from '../providerType.svelte';
export enum MessageStatuses {
DRAFT = 'draft',
@@ -15,7 +15,6 @@ export type MessageParams = {
topics: string[];
users: string[];
targets: string[];
description: string;
status: MessageStatuses;
scheduledAt?: string;
};
@@ -12,6 +12,7 @@
Auth = 'Auth',
Database = 'Database',
Functions = 'Functions',
Messaging = 'Messaging',
Storage = 'Storage',
Other = 'Other'
}
@@ -44,6 +44,7 @@
import { sdk } from '$lib/stores/sdk.js';
import Create from './create-file/create.svelte';
import DeleteFile from './deleteFile.svelte';
import { isCloud } from '$lib/system';
export let data;
@@ -53,9 +54,12 @@
const projectId = $page.params.project;
const bucketId = $page.params.bucket;
const usedStorage = bytesToSize(data.organizationUsage.storageTotal, 'GB');
const usedStorage =
isCloud && data?.organizationUsage?.storageTotal
? bytesToSize(data.organizationUsage.storageTotal, 'GB')
: null;
const getPreview = (fileId: string) =>
sdk.forProject.storage.getFilePreview(bucketId, fileId, 32, 32).toString() + '&mode=admin';
sdk.forProject.storage.getFilePreview(bucketId, fileId, 64, 64).toString() + '&mode=admin';
async function fileDeleted(event: CustomEvent<Models.File>) {
showDelete = false;