diff --git a/.env.example b/.env.example index 5a16f982f..9ba4011c0 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ PUBLIC_CONSOLE_MODE=self-hosted -PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths +PUBLIC_CONSOLE_FEATURE_FLAGS= PUBLIC_APPWRITE_MULTI_REGION=false PUBLIC_APPWRITE_ENDPOINT=http://localhost/v1 PUBLIC_STRIPE_KEY= diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a700a4add..8cfa0c03f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,7 +39,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-args: | "PUBLIC_CONSOLE_MODE=cloud" - "PUBLIC_CONSOLE_FEATURE_FLAGS=sites" + "PUBLIC_CONSOLE_FEATURE_FLAGS=" "PUBLIC_APPWRITE_MULTI_REGION=true" "PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}" "PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY }}" @@ -79,7 +79,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-args: | "PUBLIC_CONSOLE_MODE=cloud" - "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths" + "PUBLIC_CONSOLE_FEATURE_FLAGS=" "PUBLIC_APPWRITE_MULTI_REGION=true" "PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}" "PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}" @@ -118,7 +118,7 @@ jobs: build-args: | "PUBLIC_CONSOLE_MODE=self-hosted" "PUBLIC_APPWRITE_MULTI_REGION=false" - "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths" + "PUBLIC_CONSOLE_FEATURE_FLAGS=" "PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}" publish-cloud-no-regions: @@ -156,6 +156,6 @@ jobs: build-args: | "PUBLIC_CONSOLE_MODE=cloud" "PUBLIC_APPWRITE_MULTI_REGION=false" - "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths" + "PUBLIC_CONSOLE_FEATURE_FLAGS=" "PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}" "PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}" diff --git a/docker/nginx.conf b/docker/nginx.conf index e26105222..82f57204a 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -6,12 +6,6 @@ server { root /usr/share/nginx/html; - # Security headers for all locations - add_header X-UA-Compatible "IE=Edge"; - add_header X-Frame-Options SAMEORIGIN; - add_header X-XSS-Protection "1; mode=block;"; - add_header X-Content-Type-Options nosniff; - # Only cache files in /console/_app/immutable/ for 1 year location /console/_app/immutable/ { try_files $uri =404; @@ -35,6 +29,12 @@ server { expires 0; add_header Cache-Control "no-cache, no-store"; add_header Pragma "no-cache"; + + # Security headers + add_header X-UA-Compatible "IE=Edge"; + add_header X-Frame-Options SAMEORIGIN; + add_header X-XSS-Protection "1; mode=block;"; + add_header X-Content-Type-Options nosniff; } location / { diff --git a/e2e/journeys/upgrade-free-tier.spec.ts b/e2e/journeys/upgrade-free-tier.spec.ts index 80802f499..55c759a66 100644 --- a/e2e/journeys/upgrade-free-tier.spec.ts +++ b/e2e/journeys/upgrade-free-tier.spec.ts @@ -10,7 +10,6 @@ test('upgrade - free tier', async ({ page }) => { await page.getByRole('link', { name: 'Upgrade', exact: true }).click(); await page.waitForURL(/\/organization-[^/]+\/change-plan/); await page.locator('input[value="tier-1"]').click(); - await page.getByRole('button', { name: 'add' }).first().click(); await enterCreditCard(page); diff --git a/e2e/steps/pro-project.ts b/e2e/steps/pro-project.ts index 438caebef..94cbb601f 100644 --- a/e2e/steps/pro-project.ts +++ b/e2e/steps/pro-project.ts @@ -7,12 +7,15 @@ type Metadata = { }; export async function enterCreditCard(page: Page) { - const dialog = page.locator('.modal').filter({ - hasText: 'add payment method' - }); - await dialog.waitFor({ - state: 'visible' - }); + // click the `add` button inside correct view layer + await page + .locator('#no-payments-card-stack') + .getByRole('button', { name: 'add' }) + .first() + .click(); + + const dialog = page.locator('.modal').filter({ hasText: 'add payment method' }); + await dialog.waitFor({ state: 'visible' }); await page.getByPlaceholder('cardholder').fill('Test User'); const stripe = page.locator('[title="Secure payment input frame"]').nth(0).contentFrame(); await stripe.locator('id=Field-numberInput').fill('4242424242424242'); @@ -35,7 +38,6 @@ export async function createProProject(page: Page): Promise { await page.getByRole('radio', { name: /^Pro\b/ }).check(); // `create organization` because there's already free created on start! await page.getByRole('button', { name: 'create organization' }).click(); - await page.getByRole('button', { name: 'add' }).first().click(); await enterCreditCard(page); // skip members await page.getByRole('button', { name: 'create organization' }).click(); diff --git a/package.json b/package.json index c26394610..76d311983 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ "@ai-sdk/svelte": "^1.1.24", "@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@6d2d4ec", "@appwrite.io/pink-icons": "0.25.0", - "@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1", + "@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@2cf27e0", "@appwrite.io/pink-legacy": "^1.0.3", - "@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@0f90bf1", + "@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40fb564", "@faker-js/faker": "^9.9.0", "@popperjs/core": "^2.11.8", "@sentry/sveltekit": "^8.38.0", @@ -95,5 +95,5 @@ "svelte-preprocess" ] }, - "packageManager": "pnpm@10.15.0" + "packageManager": "pnpm@10.15.1" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6b334c693..62b71c51e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,14 +18,14 @@ importers: specifier: 0.25.0 version: 0.25.0 '@appwrite.io/pink-icons-svelte': - specifier: ^2.0.0-RC.1 - version: https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fpink-icons-svelte@12707b9(svelte@5.25.3) + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@2cf27e0 + version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@2cf27e0(svelte@5.25.3) '@appwrite.io/pink-legacy': specifier: ^1.0.3 version: 1.0.3 '@appwrite.io/pink-svelte': - specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@0f90bf1 - version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@0f90bf1(svelte@5.25.3) + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40fb564 + version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40fb564(svelte@5.25.3) '@faker-js/faker': specifier: ^9.9.0 version: 9.9.0 @@ -269,8 +269,8 @@ packages: peerDependencies: svelte: ^4.0.0 - '@appwrite.io/pink-icons-svelte@https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fpink-icons-svelte@12707b9': - resolution: {tarball: https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fpink-icons-svelte@12707b9} + '@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@2cf27e0': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@2cf27e0} version: 2.0.0-RC.1 peerDependencies: svelte: ^4.0.0 @@ -284,8 +284,8 @@ packages: '@appwrite.io/pink-legacy@1.0.3': resolution: {integrity: sha512-GGde5fmPhs+s6/3aFeMPc/kKADG/gTFkYQSy6oBN8pK0y0XNCLrZZgBv+EBbdhwdtqVEWXa0X85Mv9w7jcIlwQ==} - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@0f90bf1': - resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@0f90bf1} + '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40fb564': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40fb564} version: 2.0.0-RC.2 peerDependencies: svelte: ^4.0.0 @@ -3706,7 +3706,7 @@ snapshots: dependencies: svelte: 5.25.3 - '@appwrite.io/pink-icons-svelte@https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fpink-icons-svelte@12707b9(svelte@5.25.3)': + '@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@2cf27e0(svelte@5.25.3)': dependencies: svelte: 5.25.3 @@ -3719,7 +3719,7 @@ snapshots: '@appwrite.io/pink-icons': 1.0.0 the-new-css-reset: 1.11.3 - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@0f90bf1(svelte@5.25.3)': + '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40fb564(svelte@5.25.3)': dependencies: '@appwrite.io/pink-icons-svelte': 2.0.0-RC.1(svelte@5.25.3) '@floating-ui/dom': 1.6.13 diff --git a/src/lib/components/archiveProject.svelte b/src/lib/components/archiveProject.svelte new file mode 100644 index 000000000..c7896c991 --- /dev/null +++ b/src/lib/components/archiveProject.svelte @@ -0,0 +1,384 @@ + + +{#if projectsToArchive.length > 0} +
+ + + These projects have been archived and are read-only. You can view and migrate their + data. + + +
+ + {#each projectsToArchive as project} + {@const platforms = filterPlatforms( + project.platforms.map((platform) => getPlatformInfo(platform.type)) + )} + {@const formatted = formatName(project.name)} + + + {project?.platforms?.length ? project?.platforms?.length : 'No'} apps + + {formatted} + +
+ + { + e.preventDefault(); + e.stopPropagation(); + readOnlyInfoOpen = { + ...readOnlyInfoOpen, + [project.$id]: !readOnlyInfoOpen[project.$id] + }; + }}> + + Read only + + +
  • + + Archived projects are read-only. You can view + and migrate their data, but they no longer + accept edits or requests. + +
  • +
    +
    + + + + handleUnarchiveProject(project)} + >Unarchive project + handleMigrateProject(project)} + >Migrate project +
    + +
    + handleDeleteProject(project)} + >Delete project +
    +
    +
    +
    + + {#each platforms.slice(0, 2) as platform} + {@const icon = getIconForPlatform(platform.icon)} + + + + {/each} + + {#if platforms.length > 3} + + {/if} + + + {#if isCloud && $regionsStore?.regions} + {@const region = findRegion(project)} + {region?.name} + {/if} + +
    + {/each} +
    +
    +
    +
    +{/if} + + + +

    Are you sure you want to unarchive {projectToUnarchive?.name}?

    +

    This will move the project back to your active projects list.

    + + + + + + + +
    + + + + + The archived project {projectToDelete?.name} will be deleted along with all + of its metadata, stats, and other resources. + This action is irreversible. + + + + + + + + + + + diff --git a/src/lib/components/billing/alerts/limitReached.svelte b/src/lib/components/billing/alerts/limitReached.svelte index 11d832107..4885db75e 100644 --- a/src/lib/components/billing/alerts/limitReached.svelte +++ b/src/lib/components/billing/alerts/limitReached.svelte @@ -20,9 +20,14 @@ plan. Consider upgrading to increase your resource usage. - + {#if !page.data.currentPlan?.usagePerProject} + + {/if} {:else} @@ -257,7 +265,11 @@ {selectedOrg?.name ?? 'Organization'} + > {/if} @@ -476,6 +488,7 @@ border-radius: var(--border-radius-S, 8px); background: var(--overlay-neutral-hover, rgba(25, 25, 28, 0.03)); } + .trigger { display: inline-flex; align-items: center; diff --git a/src/lib/components/columnSelector.svelte b/src/lib/components/columnSelector.svelte index 6c1180d73..506735df3 100644 --- a/src/lib/components/columnSelector.svelte +++ b/src/lib/components/columnSelector.svelte @@ -59,23 +59,23 @@ }; const saveColumnPreferences = () => { - const shownColumns = $columns.filter((n) => n.hide === true).map((n) => n.id); + const hiddenColumns = $columns.filter((n) => n.hide === true).map((n) => n.id); if (isCustomTable) { onPreferencesUpdated?.(); - preferences.setCustomTableColumns(page.params.table, shownColumns); + preferences.setCustomTableColumns(page.params.table, hiddenColumns); } else { - preferences.setColumns(shownColumns); + preferences.setColumns(hiddenColumns); } }; onMount(() => { if (isCustomTable) { - const shownColumns = preferences.getCustomTableColumns(page.params.table); + const hiddenColumns = preferences.getCustomTableColumns(page.params.table); columns.update((n) => n.map((column) => { - column.hide = shownColumns?.includes(column.id) ?? false; + column.hide = hiddenColumns?.includes(column.id) ?? false; return column; }) ); diff --git a/src/lib/components/confirm.svelte b/src/lib/components/confirm.svelte index fa23d1b71..d6488ff00 100644 --- a/src/lib/components/confirm.svelte +++ b/src/lib/components/confirm.svelte @@ -10,6 +10,7 @@ export let disabled: boolean = false; export let submissionLoader = false; export let confirmDeletion: boolean = false; + export let confirmDeletionLabel: string = 'I understand and confirm'; export let onSubmit: (e: SubmitEvent) => Promise | void = function () { return; }; @@ -46,7 +47,7 @@ required id={checkboxId} bind:checked={confirm} - label="I understand and confirm" /> + label={confirmDeletionLabel} /> {/if} diff --git a/src/lib/components/domains/nameserverTable.svelte b/src/lib/components/domains/nameserverTable.svelte index 55414d839..a08de4208 100644 --- a/src/lib/components/domains/nameserverTable.svelte +++ b/src/lib/components/domains/nameserverTable.svelte @@ -23,8 +23,8 @@ {/if} - Add the following nameservers on your DNS provider. Note that DNS changes may take time to - propagate fully. + Add the following nameservers on your DNS provider. Note that changes may take up to 48 + hours to propagate fully. diff --git a/src/lib/components/dualTimeView.svelte b/src/lib/components/dualTimeView.svelte index 61c28c424..c597d7e87 100644 --- a/src/lib/components/dualTimeView.svelte +++ b/src/lib/components/dualTimeView.svelte @@ -11,6 +11,7 @@ import { menuOpen } from '$lib/components/menu/store'; export let time: string | null = null; + export let showDatetime: boolean = false; export let canShowPopover: boolean = true; export let placement: ComponentProps['placement'] = 'bottom'; @@ -85,7 +86,7 @@ } }} on:mouseleave={() => hidePopover(hide)}> - {capitalize(timeFromNow(time))} + {showDatetime ? toLocaleDateTime(time) : capitalize(timeFromNow(time))}
    + import { Layout, Card } from '@appwrite.io/pink-svelte'; + export let gap: 'none' | 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl' = 'l'; + + + + + + + diff --git a/src/lib/components/filters/store.ts b/src/lib/components/filters/store.ts index c25113dbb..0b9a350ee 100644 --- a/src/lib/components/filters/store.ts +++ b/src/lib/components/filters/store.ts @@ -63,7 +63,7 @@ function initQueries(initialValue = new Map()) { const currentLocation = window.location.pathname; if (usableQueries.size) { - const queryParam = mapToQueryParams(get(queries)); + const queryParam = mapToQueryParams(usableQueries); goto(`${currentLocation}?query=${queryParam}`, { noScroll: true }); } else { goto(currentLocation, { noScroll: true }); diff --git a/src/lib/components/gridItem1.svelte b/src/lib/components/gridItem1.svelte index 89b2d3bb2..40c8e66d9 100644 --- a/src/lib/components/gridItem1.svelte +++ b/src/lib/components/gridItem1.svelte @@ -1,6 +1,6 @@ diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index 63e079b9c..47afdf41a 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -84,5 +84,6 @@ export { default as UsageCard } from './usageCard.svelte'; export { default as ViewToggle } from './viewToggle.svelte'; export { default as RegionEndpoint } from './regionEndpoint.svelte'; export { default as ExpirationInput } from './expirationInput.svelte'; +export { default as EstimatedCard } from './estimatedCard.svelte'; export { default as EmailVerificationBanner } from './alerts/emailVerificationBanner.svelte'; export { default as SortButton, type SortDirection } from './sortButton.svelte'; diff --git a/src/lib/components/labelCard.svelte b/src/lib/components/labelCard.svelte index 9eb761198..2cd95edc9 100644 --- a/src/lib/components/labelCard.svelte +++ b/src/lib/components/labelCard.svelte @@ -45,7 +45,7 @@ -
    +
    + import { Button } from '$lib/elements/forms'; + import { getServiceLimit, plansInfo } from '$lib/stores/billing'; + import { BillingPlan } from '$lib/constants'; + import { Click, trackEvent } from '$lib/actions/analytics'; + import { Badge, Icon, Layout, Table, Typography, Tooltip } from '@appwrite.io/pink-svelte'; + import { IconArrowUp, IconInfo } from '@appwrite.io/pink-icons-svelte'; + + import { formatNumberWithCommas } from '$lib/helpers/numbers'; + import { Modal } from '$lib/components'; + import { Alert } from '@appwrite.io/pink-svelte'; + import { addNotification } from '$lib/stores/notifications'; + import { toLocaleDate, toLocaleDateTime } from '$lib/helpers/date'; + import { organization, type Organization } from '$lib/stores/organization'; + import type { Models } from '@appwrite.io/console'; + + // Props + type Props = { + organization: Organization; + projects?: Models.Project[]; + members?: Models.Membership[]; + storageUsage?: number; + }; + + const { projects = [], members = [], storageUsage = 0 }: Props = $props(); + + let showSelectProject = $state(false); + let selectedProjects = $state([]); + let error = $state(null); + let showSelectionReminder = $state(false); + + // Derived state using runes + let freePlanLimits = $derived({ + projects: $plansInfo?.get(BillingPlan.FREE)?.projects, + members: getServiceLimit('members', BillingPlan.FREE), + storage: getServiceLimit('storage', BillingPlan.FREE) + }); + + // When preparing to downgrade to Free, enforce Free plan limit locally (2) + let allowedProjectsToKeep = $derived(freePlanLimits.projects); + + let currentUsage = $derived({ + projects: projects?.length || 0, + members: members?.length || 0, + storage: storageUsage || 0 + }); + + let storageUsageGB = $derived(storageUsage / (1024 * 1024 * 1024)); + + let isLimitExceeded = $derived({ + projects: currentUsage.projects > freePlanLimits.projects, + members: currentUsage.members > freePlanLimits.members, + storage: storageUsageGB > freePlanLimits.storage + }); + + let excessUsage = $derived({ + projects: Math.max(0, currentUsage.projects), + members: Math.max(0, currentUsage.members - freePlanLimits.members), + storage: Math.max(0, storageUsageGB - freePlanLimits.storage) + }); + + // projects that would be archived with the current selection + let projectsToArchive = $derived( + projects.filter((project) => !selectedProjects.includes(project.$id)) + ); + + function formatProjectsToArchive(): string { + let result = ''; + projectsToArchive.forEach((project, index) => { + const isLast = index === projectsToArchive.length - 1; + const isSecondLast = index === projectsToArchive.length - 2; + + result += `${index === 0 ? '' : ' '}${project.name}`; + + if (!isLast) { + if (isSecondLast) result += ' and'; + else result += ','; + } + }); + return result; + } + + function formatNumber(num: number): string { + return formatNumberWithCommas(num); + } + + function handleManageProjects() { + showSelectProject = true; + showSelectionReminder = false; + trackEvent(Click.OrganizationClickUpgrade, { source: 'usage_limits_manage_projects' }); + } + + // Expose validation for parent to call before submitting downgrade + export function validateOrAlert(): boolean { + const filteredSelection = selectedProjects.filter((id) => + projects.some((p) => p.$id === id) + ); + const isValid = filteredSelection.length === allowedProjectsToKeep; + showSelectionReminder = !isValid && isLimitExceeded.projects; + return isValid; + } + + export function getSelectedProjects(): string[] { + return selectedProjects.filter((id) => projects.some((p) => p.$id === id)); + } + + function updateSelected() { + error = null; + const filteredSelection = selectedProjects.filter((id) => + projects.some((p) => p.$id === id) + ); + if (filteredSelection.length !== allowedProjectsToKeep) { + error = `You must select exactly ${allowedProjectsToKeep} projects to keep.`; + return; + } + // Keep selection locally; parent flow will apply after plan change + showSelectProject = false; + showSelectionReminder = false; + addNotification({ type: 'success', message: `Projects selected for archiving` }); + } + + + + {#if showSelectionReminder} + + The Free plan lets you keep {allowedProjectsToKeep} projects. Select them before continuing. + + + + + {/if} + +
    + + + Resource + Free limit + + + Excess usage + + + Usage beyond the Free plan limits. + + + + + + + + + + + Projects + {#if isLimitExceeded.projects} + + {/if} + + + + {formatNumber(allowedProjectsToKeep)} projects + + + {#if isLimitExceeded.projects} + + + + {formatNumber(excessUsage.projects)} projects + + + {:else} + + {formatNumber(currentUsage.projects)} / {formatNumber( + allowedProjectsToKeep + )} + + {/if} + + + {#if isLimitExceeded.projects} + + + + {/if} + + + + + + + Organization members + + + {formatNumber(freePlanLimits.members)} member + + + {#if isLimitExceeded.members} + + + + {formatNumber(excessUsage.members)} members + + + {:else} + + {formatNumber(currentUsage.members)} / {formatNumber( + freePlanLimits.members + )} + + {/if} + + + + + + + + Storage + + + {freePlanLimits.storage} GB + + + {#if isLimitExceeded.storage} + + + + {excessUsage.storage.toFixed(2)} GB + + + {:else} + + {storageUsageGB.toFixed(2)} / {freePlanLimits.storage} GB + + {/if} + + + + +
    +
    + +{#if showSelectProject} + + + Choose which {freePlanLimits.projects} projects to keep. Projects over the limit will be + blocked after your billing cycle ends on {toLocaleDate( + $organization.billingNextInvoiceDate + )}. + + + {#if error} + {error} + {/if} + +
    + + + Project Name + Created + + {#each projects as project} + + {project.name} + + {toLocaleDateTime(project.$createdAt)} + + + {/each} + +
    + {#if selectedProjects.length === allowedProjectsToKeep} + {@const difference = projects.length - selectedProjects.length} + {@const messagePrefix = + difference > 1 ? `${difference} projects` : `${difference} project`} + + {formatProjectsToArchive()} will be archived + + {/if} + + + + + +
    +{/if} + + diff --git a/src/lib/components/paginationInline.svelte b/src/lib/components/paginationInline.svelte index 2d1b8a26c..b35ab2f8a 100644 --- a/src/lib/components/paginationInline.svelte +++ b/src/lib/components/paginationInline.svelte @@ -66,6 +66,7 @@ {:else} import { page } from '$app/state'; - import { goto } from '$app/navigation'; import { onDestroy } from 'svelte'; + import { goto } from '$app/navigation'; import { trackEvent } from '$lib/actions/analytics'; import { Icon, Input } from '@appwrite.io/pink-svelte'; import { IconSearch, IconX } from '@appwrite.io/pink-icons-svelte'; import { debounce as createDebounce } from '$lib/helpers/debounce.js'; - export let placeholder = ''; - export let debounce = 250; - export let required = false; - export let disabled = false; - export let autofocus = false; + interface Props { + placeholder?: string; + debounce?: number; + required?: boolean; + disabled?: boolean; + autofocus?: boolean; + } - let inputValue = page.url.searchParams.get('search') ?? ''; + let { + placeholder = '', + debounce = 250, + required = false, + disabled = false, + autofocus = false + }: Props = $props(); + + let inputValue = $state(page.url.searchParams.get('search') ?? ''); const runSearch = createDebounce((value: string) => { const trimmed = value.trim(); @@ -36,15 +46,21 @@ goto(url, { keepFocus: true }); }, debounce); - $: runSearch(inputValue); - - function clearInput() { + export function clearInput() { inputValue = ''; } onDestroy(() => { runSearch.cancel?.(); }); + + $effect(() => { + const urlSearch = page.url.searchParams.get('search') ?? ''; + + if (urlSearch !== inputValue) { + runSearch(inputValue); + } + });
    diff --git a/src/lib/components/sidebar.svelte b/src/lib/components/sidebar.svelte index 3cc961b5d..325eb8bd5 100644 --- a/src/lib/components/sidebar.svelte +++ b/src/lib/components/sidebar.svelte @@ -34,7 +34,7 @@ import { showSupportModal } from '$routes/(console)/wizard/support/store'; import MobileSupportModal from '$routes/(console)/wizard/support/mobileSupportModal.svelte'; import MobileFeedbackModal from '$routes/(console)/wizard/feedback/mobileFeedbackModal.svelte'; - import { getSidebarState, updateSidebarState } from '$lib/helpers/sidebar'; + import { getSidebarState, isInDatabasesRoute, updateSidebarState } from '$lib/helpers/sidebar'; import { isTabletViewport, isSmallViewport } from '$lib/stores/viewport'; import { Click, trackEvent } from '$lib/actions/analytics'; import { bannerSpacing } from '$lib/layout/headerAlert.svelte'; @@ -73,8 +73,6 @@ } } - $: state = $isTabletViewport ? 'closed' : getSidebarState(); - const projectOptions = [ { name: 'Auth', icon: IconUserGroup, slug: 'auth', category: 'build' }, { name: 'Databases', icon: IconDatabase, slug: 'databases', category: 'build' }, @@ -93,6 +91,13 @@ const isSelected = (service: string): boolean => { return $page.route.id?.includes(service); }; + + $: state = $isTabletViewport + ? 'closed' + : // example: manual resize + isInDatabasesRoute($page.route) + ? 'icons' + : getSidebarState();
    {/each} {#if project && $isSmallViewport} - - -{#if subNavigation} - -{/if} +
    + {#if subNavigation} + + {/if} +
    diff --git a/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte b/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte index ca84dbf21..338be255e 100644 --- a/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte +++ b/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte @@ -17,9 +17,14 @@ Appwrite services, update the budget limit. - + {#if !page.data.currentPlan?.usagePerProject} + + {/if} diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte index 1d39fdbc5..364014828 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte @@ -4,7 +4,6 @@ import { page } from '$app/state'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; import { PlanComparisonBox, PlanSelection, SelectPaymentMethod } from '$lib/components/billing'; - import PlanExcess from '$lib/components/billing/planExcess.svelte'; import ValidateCreditModal from '$lib/components/billing/validateCreditModal.svelte'; import { BillingPlan, Dependencies, feedbackDowngradeOptions } from '$lib/constants'; import { Button, Form, InputSelect, InputTags, InputTextarea } from '$lib/elements/forms'; @@ -33,7 +32,11 @@ import { onMount } from 'svelte'; import { loadAvailableRegions } from '$routes/(console)/regions'; import EstimatedTotalBox from '$lib/components/billing/estimatedTotalBox.svelte'; + import OrganizationUsageLimits from '$lib/components/organizationUsageLimits.svelte'; import { Query } from '@appwrite.io/console'; + import type { OrganizationUsage } from '$lib/sdk/billing'; + import type { Models } from '@appwrite.io/console'; + import { toLocaleDate } from '$lib/helpers/date'; export let data; @@ -43,6 +46,9 @@ let previousPage: string = base; let showExitModal = false; let formComponent: Form; + let usageLimitsComponent: + | { validateOrAlert: () => boolean; getSelectedProjects: () => string[] } + | undefined; let isSubmitting = writable(false); let collaborators: string[] = data?.members?.memberships @@ -55,6 +61,8 @@ let showCreditModal = false; let feedbackDowngradeReason: string; let feedbackMessage: string; + let orgUsage: OrganizationUsage; + let allProjects: { projects: Models.Project[] } | undefined; $: paymentMethods = null; @@ -91,6 +99,21 @@ selectedPlan = $currentPlan?.$id === BillingPlan.SCALE ? BillingPlan.SCALE : BillingPlan.PRO; + + try { + orgUsage = await sdk.forConsole.billing.listUsage(data.organization.$id); + } catch { + orgUsage = undefined; + } + + try { + allProjects = await sdk.forConsole.projects.list([ + Query.equal('teamId', data.organization.$id), + Query.limit(1000) + ]); + } catch { + allProjects = { projects: [] }; + } }); async function loadPaymentMethods() { @@ -100,6 +123,16 @@ async function handleSubmit() { if (isDowngrade) { + // If target plan has a non-zero project limit, ensure selection made + const targetProjectsLimit = $plansInfo?.get(selectedPlan)?.projects ?? 0; + const shouldShowProjectSelector = + targetProjectsLimit > 0 && allProjects.projects.length > targetProjectsLimit; + + if (shouldShowProjectSelector && usageLimitsComponent?.validateOrAlert) { + const ok = usageLimitsComponent.validateOrAlert(); + if (!ok) return; + } + await downgrade(); } else if (isUpgrade) { await upgrade(); @@ -136,6 +169,7 @@ async function downgrade() { try { + // 1) update the plan first await sdk.forConsole.billing.updatePlan( data.organization.$id, selectedPlan, @@ -143,11 +177,26 @@ null ); - trackDowngradeFeedback(); + // 2) If the target plan has a project limit, apply selected projects now + const targetProjectsLimit = $plansInfo?.get(selectedPlan)?.projects ?? 0; + if (targetProjectsLimit > 0 && usageLimitsComponent) { + const selected = usageLimitsComponent.getSelectedProjects(); + if (selected?.length) { + try { + await sdk.forConsole.billing.updateSelectedProjects( + data.organization.$id, + selected + ); + } catch (projectError) { + console.warn('Project selection failed after plan update:', projectError); + } + } + } - await invalidate(Dependencies.ORGANIZATION); + await Promise.all([trackDowngradeFeedback(), invalidate(Dependencies.ORGANIZATION)]); await goto(previousPage); + addNotification({ type: 'success', message: `${$organization.name} plan has been successfully updated.` @@ -299,24 +348,25 @@ - To downgrade this organization, first migrate or delete one of your - existing paid organizations. - + To downgrade this organization, first migrate or delete your existing + free organization. + + + {/if} {#if isDowngrade} - {#if selectedPlan === BillingPlan.FREE && !data.hasFreeOrgs} - - {:else if selectedPlan === BillingPlan.PRO && data.organization.billingPlan === BillingPlan.SCALE && collaborators?.length > 0} - {@const extraMembers = collaborators?.length ?? 0} - {@const price = formatCurrency( - extraMembers * - ($plansInfo?.get(selectedPlan)?.addons?.seats?.price ?? 0) - )} + {@const extraMembers = collaborators?.length ?? 0} + {@const price = formatCurrency( + extraMembers * + ($plansInfo?.get(selectedPlan)?.addons?.seats?.price ?? 0) + )} + {#if selectedPlan === BillingPlan.PRO} Your monthly payments will be adjusted for the Pro plan @@ -326,7 +376,26 @@ >you will be charged {price} monthly for {extraMembers} team members. This will be reflected in your next invoice. + {:else if selectedPlan === BillingPlan.FREE} + + You will retain access to {tierToPlan($organization.billingPlan) + .name} plan features until your billing period ends. After that, + all team members except the owner will be removed, + and service disruptions may occur if usage exceeds Free plan limits. + {/if} + + {/if} diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.ts b/src/routes/(console)/organization-[organization]/change-plan/+page.ts index ecb712008..c6a137f96 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.ts +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.ts @@ -1,11 +1,20 @@ import type { PageLoad } from './$types'; import type { Organization } from '$lib/stores/organization'; import { BillingPlan, Dependencies } from '$lib/constants'; +import { sdk } from '$lib/stores/sdk'; export const load: PageLoad = async ({ depends, parent }) => { const { members, currentPlan, organizations } = await parent(); depends(Dependencies.UPGRADE_PLAN); + let plans; + try { + plans = await sdk.forConsole.billing.listPlans(); + } catch (error) { + console.error('Failed to load billing plans:', error); + plans = { plans: {} }; + } + let plan: BillingPlan; if (currentPlan?.$id === BillingPlan.SCALE) { @@ -22,6 +31,7 @@ export const load: PageLoad = async ({ depends, parent }) => { return { members, plan, + plans, selfService, hasFreeOrgs }; diff --git a/src/routes/(console)/organization-[organization]/domains/recordsCard.svelte b/src/routes/(console)/organization-[organization]/domains/recordsCard.svelte index 9c16ed14c..6d3d8b41a 100644 --- a/src/routes/(console)/organization-[organization]/domains/recordsCard.svelte +++ b/src/routes/(console)/organization-[organization]/domains/recordsCard.svelte @@ -84,8 +84,8 @@ {/if} - Add the following nameservers on your DNS provider. Note that DNS changes may take - time to propagate fully. + Add the following nameservers on your DNS provider. Note that changes may take up to + 48 hours to propagate fully. diff --git a/src/routes/(console)/organization-[organization]/domains/retryDomainModal.svelte b/src/routes/(console)/organization-[organization]/domains/retryDomainModal.svelte index e6a4a67c6..de237930a 100644 --- a/src/routes/(console)/organization-[organization]/domains/retryDomainModal.svelte +++ b/src/routes/(console)/organization-[organization]/domains/retryDomainModal.svelte @@ -64,8 +64,8 @@ >{selectedDomain.domain} - Add the following nameservers on your DNS provider. Note that DNS changes may take time - to propagate fully. + Add the following nameservers on your DNS provider. Note that changes may take up to 48 + hours to propagate fully. diff --git a/src/routes/(console)/organization-[organization]/header.svelte b/src/routes/(console)/organization-[organization]/header.svelte index f114dcc22..1a81ae48c 100644 --- a/src/routes/(console)/organization-[organization]/header.svelte +++ b/src/routes/(console)/organization-[organization]/header.svelte @@ -66,7 +66,11 @@ event: 'usage', title: 'Usage', hasChildren: true, - disabled: !(isCloud && ($isOwner || $isBilling)) + disabled: !( + isCloud && + ($isOwner || $isBilling) && + !page.data.currentPlan?.usagePerProject + ) }, { href: `${path}/billing`, diff --git a/src/routes/(console)/organization-[organization]/members/+page.svelte b/src/routes/(console)/organization-[organization]/members/+page.svelte index 4a9f16b99..05c350080 100644 --- a/src/routes/(console)/organization-[organization]/members/+page.svelte +++ b/src/routes/(console)/organization-[organization]/members/+page.svelte @@ -47,9 +47,7 @@ // Calculate if button should be disabled and tooltip should show $: memberCount = data.organizationMembers?.total ?? 0; $: isFreeWithMembers = $organization?.billingPlan === BillingPlan.FREE && memberCount >= 1; - $: isButtonDisabled = isCloud - ? isFreeWithMembers || !$currentPlan?.addons?.seats?.supported - : false; + $: isButtonDisabled = isCloud ? isFreeWithMembers : false; const resend = async (member: Models.Membership) => { try { diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index e27353624..a9422df60 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -8,7 +8,8 @@ getServiceLimit, showUsageRatesModal, type Tier, - upgradeURL + upgradeURL, + useNewPricingModal } from '$lib/stores/billing'; import { organization } from '$lib/stores/organization'; import ProjectBreakdown from './ProjectBreakdown.svelte'; @@ -76,14 +77,32 @@ {#if $organization.billingPlan === BillingPlan.SCALE}

    On the Scale plan, you'll be charged only for any usage that exceeds the thresholds per - resource listed below. ($showUsageRatesModal = true)} - >Learn more + resource listed below. + {#if $useNewPricingModal} + ($showUsageRatesModal = true)}>Learn more + {:else} + + Learn more + + {/if}

    {:else if $organization.billingPlan === BillingPlan.PRO}

    On the Pro plan, you'll be charged only for any usage that exceeds the thresholds per - resource listed below. ($showUsageRatesModal = true)} - >Learn more + resource listed below. + {#if $useNewPricingModal} + ($showUsageRatesModal = true)}>Learn more + {:else} + + Learn more + + {/if}

    {:else if $organization.billingPlan === BillingPlan.FREE}

    diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/+page.svelte index be123b600..0726e2165 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/+page.svelte @@ -18,7 +18,7 @@ const databaseId = page.params.database; - + diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/backups/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/backups/+page.svelte index ef597992c..da868ba29 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/backups/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/backups/+page.svelte @@ -177,7 +177,7 @@ }); - +

    {#if !isDisabled}
    diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/header.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/header.svelte index 7b18c985c..591955ca3 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/header.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/header.svelte @@ -38,11 +38,14 @@ ].filter((tab) => !tab.disabled); - + - + {$database.name} + {$database.$id} diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/settings/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/settings/+page.svelte index 65e6c2b07..00c09144e 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/settings/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/settings/+page.svelte @@ -61,7 +61,7 @@ {#if $database} - + {$database.name} diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/store.ts b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/store.ts index 221122bd4..368b1b30e 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/store.ts +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/store.ts @@ -2,6 +2,7 @@ import { page } from '$app/stores'; import type { Column } from '$lib/helpers/types'; import type { Models } from '@appwrite.io/console'; import { derived, writable } from 'svelte/store'; +import { IconChartBar, IconCloudUpload, IconCog } from '@appwrite.io/pink-icons-svelte'; export const database = derived(page, ($page) => $page.data.database as Models.Database); export const showCreate = writable(false); @@ -29,3 +30,9 @@ export const customRetainingOptions = [ { label: 'Weeks', value: 7, max: 4 }, { label: 'Months', value: 30, max: 12 } ]; + +export const databaseSubNavigationItems = [ + { title: 'Backups', href: 'backups', icon: IconCloudUpload }, + { title: 'Usage', href: 'usage', icon: IconChartBar }, + { title: 'Settings', href: 'settings', icon: IconCog } +]; diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/subNavigation.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/subNavigation.svelte index 26ee8f530..8ab8b314e 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/subNavigation.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/subNavigation.svelte @@ -1,10 +1,18 @@ + {confirmDeletionLabel}> {#if selectedColumns.length === 1}

    Are you sure you want to delete {selectedKeys[0]} from @@ -98,19 +104,12 @@ {#if requiresTwoWayConfirm} - {@const column = getAsRelationship(selectedColumns[0])}

    This is a two way relationship and the corresponding relationship will also be deleted.

    This action is irreversible.

    -
      - - Delete relationship between {column.key} to - {column.twoWayKey} - -
    {/if}
    diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/layout/emptySheet.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/layout/emptySheet.svelte index 6268608b4..7b7f1c7da 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/layout/emptySheet.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/layout/emptySheet.svelte @@ -19,6 +19,8 @@ expandTabs } from '../store'; import SpreadsheetContainer from './spreadsheet.svelte'; + import { onDestroy, onMount } from 'svelte'; + import { debounce } from '$lib/helpers/debounce'; type Mode = 'rows' | 'rows-filtered' | 'indexes'; @@ -47,7 +49,9 @@ let spreadsheetContainer: HTMLElement; let headerElement: HTMLElement | null = null; - let dynamicOverlayHeight = $state('70.5vh'); + + let resizeObserver: ResizeObserver; + let dynamicOverlayHeight = $state('60.5vh'); const baseColProps = { draggable: false, resizable: false }; @@ -70,7 +74,21 @@ } }; - updateOverlayHeight(); + // the first render is in a pretty quick succession, delay helps! + const debouncedUpdateOverlayHeight = debounce(() => updateOverlayHeight(), 250); + + onMount(async () => { + if (spreadsheetContainer) { + resizeObserver = new ResizeObserver(debouncedUpdateOverlayHeight); + resizeObserver.observe(spreadsheetContainer); + } + }); + + onDestroy(() => { + if (resizeObserver) { + resizeObserver.disconnect(); + } + }); const getCustomColumns = (): Column[] => customColumns.map((col: Column) => ({ @@ -141,8 +159,6 @@ const emptyCells = $derived(($isSmallViewport ? 14 : 17) + (!$expandTabs ? 2 : 0)); - -
    import type { Snippet } from 'svelte'; import { Button, Form } from '$lib/elements/forms'; - import { Badge, Divider, Layout, Sheet, Typography } from '@appwrite.io/pink-svelte'; + import { Badge, Divider, Layout, Sheet, Tag, Typography } from '@appwrite.io/pink-svelte'; + import { Copy } from '$lib/components'; let { show = $bindable(false), @@ -10,12 +11,22 @@ submit, children = null, footer = null, - titleBadge = null + titleBadge = null, + topAction = null }: { show: boolean; title: string; titleBadge?: string; closeOnBlur?: boolean; + topAction?: + | { + text: string; + value: string; + show?: boolean; + mode?: 'copy-tag' | 'plaintext'; + onClick?: () => string | Promise; + } + | undefined; submit?: | { text: string; @@ -26,6 +37,8 @@ children?: Snippet; footer?: Snippet | null; } = $props(); + + let copyText = $state(undefined);
    @@ -37,6 +50,24 @@ {#if titleBadge} {/if} + + {#if topAction && topAction.text && topAction.show} + {#if topAction.mode === 'copy-tag'} + + + {topAction.text} + + + {:else} + + {/if} + {/if}
    diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/cell/edit.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/cell/edit.svelte index e50ca76c6..4f1689ea3 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/cell/edit.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/cell/edit.svelte @@ -10,11 +10,13 @@ row = $bindable(null), onChange = null, onRevert = null, + noInlineEdit = false, openSideSheet = null, onRowStructureUpdate = null }: { row: Models.Row; column: Columns; + noInlineEdit?: boolean; openSideSheet?: () => void; onChange?: (row: Models.DefaultRow) => void; onRevert?: (row: Models.DefaultRow) => void; @@ -27,6 +29,11 @@ onMount(() => { original = structuredClone(row); + if (noInlineEdit) { + openSideSheet?.(); + return; + } + const trigger = wrapperEl.querySelector('button.input') as HTMLButtonElement; if (trigger) { trigger.click(); @@ -62,5 +69,5 @@ fromSpreadsheet label={undefined} bind:formValues={row} - on:click={openSideSheet} /> + on:click={() => openSideSheet?.()} />
    diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/boolean.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/boolean.svelte index dca9d9688..ce43af5df 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/boolean.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/boolean.svelte @@ -14,39 +14,19 @@ optionalText = undefined; } - const onChange = (event: CustomEvent) => { - if (limited) { - value = event.detail as boolean; - } - }; + $: options = [ + !column.required && { label: 'NULL', value: null }, + { label: limited ? 'true' : 'True', value: true }, + { label: limited ? 'false' : 'False', value: false } + ].filter(Boolean); -{#if limited} - -{:else} - -{/if} + diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/integer.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/integer.svelte index 2d80ba6cf..23e19cd3b 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/integer.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/integer.svelte @@ -1,6 +1,7 @@ row?.[name]) .filter((value) => value != null && typeof value === 'string' && value !== ''); - const displayValues = !editing - ? values - : values.map((value) => (value.length > 5 ? value.slice(0, 5) + '...' : value)); - let label: string; if (!values.length) { label = row.$id; } else { - label = `${row.$id} (${displayValues.join(' | ')})`; + label = `${values.join(' | ')} (...${row.$id.slice(-5)})`; } return { @@ -183,7 +178,7 @@ $: totalCount = relatedList?.length ?? 0; - $: options = generateOptions(loadingRelationships, rowList?.rows, column, editing); + $: options = generateOptions(loadingRelationships, rowList?.rows, column); $: hasItems = totalCount > 0; diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte index c659808fd..9baf79697 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte @@ -168,7 +168,7 @@
    {:else if $table.columns?.length && work}
    - + {#each $table.columns as column} {@const label = column.key} {@const options = getOptions(index)} + {@const onlyId = names.length === 1 && name === '$id'} {@const disabled = - (!!names[index] && names.length > index + 1) || hasExhaustedOptions} + !onlyId && + ((!!names[index] && names.length > index + 1) || + hasExhaustedOptions)} - - {#each menuItems as item, index (index)} - {#if item.divider} -
    - -
    - {:else if shouldShow(item)} - item.action && handleSelect(item.action, hide)}> - {item.label} - - {/if} - {/each} -
    +
    + + {#each menuItems as item, index (index)} + {#if item.divider} + {@const isLastDivider = index === menuItems.length - 2} +
    + +
    + {:else if shouldShow(item)} + item.action && handleSelect(item.action, hide)}> + {item.label} + + {/if} + {/each} +
    +
    + + diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte index f9e62c919..5db4b40e6 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte @@ -11,7 +11,13 @@ import { type Models, Query } from '@appwrite.io/console'; import { type ComponentType, onDestroy, onMount } from 'svelte'; import type { PageData } from './$types'; - import { isRelationship, isRelationshipToMany, isString } from './rows/store'; + import { + buildRowUrl, + buildWildcardColumnsQuery, + isRelationship, + isRelationshipToMany, + isString + } from './rows/store'; import { columns, table, @@ -81,6 +87,7 @@ import { hash } from '$lib/helpers/string'; import { formatNumberWithCommas } from '$lib/helpers/numbers'; import { chunks } from '$lib/helpers/array'; + import { mapToQueryParams } from '$lib/components/filters/store'; export let data: PageData; export let showRowCreateSheet: { @@ -100,15 +107,6 @@ const minimumWidth = 168; const emptyCellsLimit = $isSmallViewport ? 12 : 18; - const SYSTEM_KEYS = new Set([ - '$tableId', - '$databaseId', - '$permissions', - '$createdAt', - '$updatedAt', - '$id', - '$sequence' - ]); /* TODO: should be fixed at the sdk level! */ let selectedRows = []; let spreadsheetContainer: SpreadsheetContainer; @@ -311,26 +309,31 @@ async function sort(query: string | null) { $spreadsheetLoading = true; - const url = new URL(page.url); + const parsedQueries = data.parsedQueries; - if (query === null) { + if (parsedQueries.size > 0) { + for (const [tagValue, queryString] of parsedQueries.entries()) { + if (queryString.includes('orderAsc') || queryString.includes('orderDesc')) { + parsedQueries.delete(tagValue); + } + } + } + + if (query !== null) { + const { attribute, method } = JSON.parse(query); + const tagValue = { + tag: `${attribute} ${method}`, + value: attribute + }; + + parsedQueries.set(tagValue, query); + } + + if (parsedQueries.size === 0) { url.searchParams.delete('query'); } else { - // compatible with `load` func! - const { attribute, method } = JSON.parse(query); - url.searchParams.set( - 'query', - JSON.stringify([ - [ - { - tag: `${attribute} ${method}`, - value: attribute - }, - query - ] - ]) - ); + url.searchParams.set('query', mapToQueryParams(parsedQueries)); } // save > navigate > restore! @@ -462,6 +465,12 @@ } } + function openSideSheetForRelationsToMany(tableId: string, rows: string | Models.Row[]) { + $databaseRelatedRowSheetOptions.tableId = tableId; + $databaseRelatedRowSheetOptions.rows = rows; + $databaseRelatedRowSheetOptions.show = true; + } + async function onSelectSheetOption( action: HeaderCellAction | RowCellAction, columnId: string, @@ -525,6 +534,21 @@ $rowPermissionSheet.show = true; } + if (action === 'copy-url') { + try { + await copy(buildRowUrl(row.$id)); + addNotification({ + type: 'success', + message: 'Row url copied' + }); + } catch (e) { + addNotification({ + type: 'error', + message: e.message + }); + } + } + if (action === 'copy-json') { const stringified = JSON.stringify(row, null, 2); try { @@ -555,16 +579,11 @@ async function updateRowContents(row: Models.Row) { try { - const onlyData = Object.fromEntries( - Object.entries(row).filter(([key]) => !SYSTEM_KEYS.has(key)) - ); - - // TODO | BUG: related rows still have `system` columns atm! await sdk.forProject(page.params.region, page.params.project).tablesDB.updateRow({ databaseId, tableId: $table.$id, rowId: row.$id, - data: onlyData, + data: row, permissions: row.$permissions }); @@ -598,6 +617,9 @@ return false; } + const parsedQueries = data.parsedQueries; + const filterQueries = parsedQueries.size ? data.parsedQueries.values() : []; + $paginatedRowsLoading = true; const loadedRows = await sdk .forProject(page.params.region, page.params.project) @@ -607,7 +629,9 @@ queries: [ getCorrectOrderQuery(), Query.limit(SPREADSHEET_PAGE_LIMIT), - Query.offset(pageToOffset(pageNumber, SPREADSHEET_PAGE_LIMIT)) + Query.offset(pageToOffset(pageNumber, SPREADSHEET_PAGE_LIMIT)), + ...filterQueries /* filter queries */, + ...buildWildcardColumnsQuery($table) ] }); @@ -633,7 +657,8 @@ queries: [ getCorrectOrderQuery(), Query.limit(SPREADSHEET_PAGE_LIMIT), - Query.offset(pageToOffset(targetPageNum, SPREADSHEET_PAGE_LIMIT)) + Query.offset(pageToOffset(targetPageNum, SPREADSHEET_PAGE_LIMIT)), + ...buildWildcardColumnsQuery($table) ] }); @@ -821,6 +846,7 @@ >{row.$id} {:else if columnId === '$createdAt' || columnId === '$updatedAt'} {:else if columnId === 'actions'} @@ -875,18 +901,10 @@ {/if} {:else} {@const itemsNum = row[columnId]?.length} - { - $databaseRelatedRowSheetOptions.show = true; - $databaseRelatedRowSheetOptions.rows = - row[columnId]; - $databaseRelatedRowSheetOptions.tableId = columnId; - }}> - Items - + Items {/if} {:else} {@const value = row[columnId]} @@ -936,11 +954,20 @@ {row} column={rowColumn} onRowStructureUpdate={updateRowContents} + noInlineEdit={isRelationshipToMany(rowColumn)} onChange={(row) => paginatedRows.update(index, row)} onRevert={(row) => paginatedRows.update(index, row)} openSideSheet={() => { close(); /* closes the editor */ - onSelectSheetOption('update', null, 'row', row); + + if (isRelationshipToMany(rowColumn)) { + openSideSheetForRelationsToMany( + columnId, + row[columnId] + ); + } else { + onSelectSheetOption('update', null, 'row', row); + } }} /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/usage/[[period]]/+page.svelte index 8ae2d9073..84c6ff2b7 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/usage/[[period]]/+page.svelte @@ -1,14 +1,8 @@ - - - - - - + + diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/+page.ts b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/+page.ts index ea95a462d..01a7a633b 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/+page.ts @@ -34,6 +34,14 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) => Query.limit(limit), Query.offset(offset), Query.orderDesc(''), + Query.select([ + 'buildSize', + 'sourceSize', + 'totalSize', + 'buildDuration', + 'status', + 'type' + ]), ...parsedQueries.values() ] }) diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte index 2ba91a968..07a2da2c4 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte @@ -25,8 +25,8 @@
    - Add the following nameservers on your DNS provider. Note that DNS changes may - take time to propagate fully. + Add the following nameservers on your DNS provider. Note that changes may take + up to 48 hours to propagate fully.
    diff --git a/src/routes/(console)/project-[region]-[project]/messaging/userTargetsModal.svelte b/src/routes/(console)/project-[region]-[project]/messaging/userTargetsModal.svelte index adb1fd09a..8478762f1 100644 --- a/src/routes/(console)/project-[region]-[project]/messaging/userTargetsModal.svelte +++ b/src/routes/(console)/project-[region]-[project]/messaging/userTargetsModal.svelte @@ -21,9 +21,6 @@ let totalResults = 0; let userResultsById: Record>> = {}; // use a hash map so we can quickly look up a user by id let selected: Record = {}; - let selectedSize = 0; - let selectedUsers = 0; - let hasSelection = false; function reset() { offset = 0; @@ -38,6 +35,7 @@ async function request() { if (!show) return; + const queries = [Query.limit(5), Query.offset(offset)]; if (providerType === MessagingProviderType.Email) { @@ -52,44 +50,43 @@ }); totalResults = response.total; - userResultsById = {}; - response.users.forEach((user) => { - if (providerType !== null) { - user.targets = user.targets.filter( - (target) => target.providerType === providerType - ); - } - userResultsById = { - ...userResultsById, - [user.$id]: user - }; - }); + + userResultsById = Object.fromEntries( + response.users.map((user) => { + const filteredUser = + providerType !== null + ? { + ...user, + targets: user.targets.filter( + (target) => target.providerType === providerType + ) + } + : user; + return [user.$id, filteredUser]; + }) + ); } - function onUserSelection(event: CustomEvent, userId: string) { + function onUserSelection(event: CustomEvent, userId: string) { const user = userResultsById[userId]; + const shouldSelect = event.detail === 'indeterminate' || event.detail === true; - if (event.detail) { - user.targets.forEach((target) => { - selected = { - ...selected, - [target.$id]: target - }; - }); - } else { - user.targets.forEach((target) => { - const { [target.$id]: _, ...rest } = selected; - selected = rest; - }); - } + const updatedSelected = { ...selected }; + + user.targets.forEach((target) => { + if (shouldSelect) { + updatedSelected[target.$id] = target; + } else { + delete updatedSelected[target.$id]; + } + }); + + selected = updatedSelected; } function onTargetSelection(event: CustomEvent, target: Models.Target) { if (event.detail) { - selected = { - ...selected, - [target.$id]: target - }; + selected = { ...selected, [target.$id]: target }; } else { const { [target.$id]: _, ...rest } = selected; selected = rest; @@ -107,19 +104,35 @@ request(); } - $: { - selectedSize = 0; - const users = new Set(); - for (const s in selected) { - const target = selected[s]; - users.add(target.userId); - selectedSize++; - } - selectedUsers = users.size; - } - + $: selectedTargets = Object.values(selected); + $: selectedSize = selectedTargets.length; + $: selectedUsers = new Set(selectedTargets.map((target) => target.userId)).size; $: hasSelection = selectedSize > 0; + $: parentStates = Object.fromEntries( + Object.entries(userResultsById).map(([userId, user]) => { + const selectedCount = user.targets.filter((target) => selected[target.$id]).length; + const totalCount = user.targets.length; + + let state: boolean | 'indeterminate'; + if (selectedCount === 0) { + state = false; + } else if (selectedCount === totalCount) { + state = true; + } else { + state = 'indeterminate'; + } + + return [userId, state]; + }) + ); + + $: targetSelectionStates = Object.fromEntries( + Object.values(userResultsById) + .flatMap((user) => user.targets) + .map((target) => [target.$id, !!selected[target.$id]]) + ); + $: if (show) { selected = targetsById; } @@ -140,25 +153,19 @@ ).length} 0 && selectedCount === user.targets.length} + checked={parentStates[userId]} on:change={(event) => onUserSelection(event, userId)}> {#each user.targets as target} onTargetSelection(event, target)}>
    diff --git a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte index 24b82ae7b..31fc89017 100644 --- a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte @@ -243,7 +243,7 @@ Executions - Calculated for all functions that are executed in all projects in your project. + Calculated for all functions that are executed in this project. {#if executions} {@const current = formatNum(executionsTotal)} diff --git a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts index 4afa9181a..e5e1ee5a6 100644 --- a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts @@ -1,4 +1,4 @@ -import type { Aggregation, Invoice } from '$lib/sdk/billing'; +import type { AggregationTeam, Invoice, InvoiceUsage } from '$lib/sdk/billing'; import { accumulateUsage } from '$lib/sdk/usage'; import { sdk } from '$lib/stores/sdk'; import { Query } from '@appwrite.io/console'; @@ -11,7 +11,7 @@ export const load: PageLoad = async ({ params, parent }) => { let startDate: string = organization.billingCurrentInvoiceDate; let endDate: string = organization.billingNextInvoiceDate; let currentInvoice: Invoice = undefined; - let currentAggregation: Aggregation = undefined; + let currentAggregation: AggregationTeam = undefined; if (invoice) { currentInvoice = await sdk.forConsole.billing.getInvoice(organization.$id, invoice); @@ -22,6 +22,15 @@ export const load: PageLoad = async ({ params, parent }) => { startDate = currentInvoice.from; endDate = currentInvoice.to; + } else { + try { + currentAggregation = await sdk.forConsole.billing.getAggregation( + organization.$id, + organization.billingAggregationId + ); + } catch (e) { + // ignore error if no aggregation found + } } const [invoices, usage] = await Promise.all([ @@ -29,10 +38,24 @@ export const load: PageLoad = async ({ params, parent }) => { sdk.forProject(region, project).project.getUsage({ startDate, endDate }) ]); - if (invoice) { - usage.usersTotal = currentAggregation.usageUsers; - usage.executionsTotal = currentAggregation.usageExecutions; - usage.filesStorageTotal = currentAggregation.usageStorage; + if (currentAggregation) { + let projectSpecificData = null; + if (currentAggregation.breakdown) { + projectSpecificData = currentAggregation.breakdown.find((p) => p.$id === project); + } + + if (projectSpecificData) { + const executionsResource = projectSpecificData.resources?.find?.( + (r: InvoiceUsage) => r.resourceId === 'executions' + ); + if (executionsResource) { + usage.executionsTotal = executionsResource.value || usage.executionsTotal; + } + } else { + usage.usersTotal = currentAggregation.usageUsers; + usage.executionsTotal = currentAggregation.usageExecutions; + usage.filesStorageTotal = currentAggregation.usageStorage; + } } usage.users = accumulateUsage(usage.users, usage.usersTotal); diff --git a/src/routes/(console)/project-[region]-[project]/sites/+page.svelte b/src/routes/(console)/project-[region]-[project]/sites/+page.svelte index 7cbb99660..caa180049 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/sites/+page.svelte @@ -11,14 +11,12 @@ import { isServiceLimited } from '$lib/stores/billing'; import { organization } from '$lib/stores/organization'; import { canWriteSites } from '$lib/stores/roles.js'; - import { Card, Icon, Layout, Typography } from '@appwrite.io/pink-svelte'; + import { Icon, Layout } from '@appwrite.io/pink-svelte'; import { Button } from '$lib/elements/forms'; import { app } from '$lib/stores/app'; import CreateSiteModal from './createSiteModal.svelte'; import EmptyLight from './(images)/empty-sites-light.svg'; import EmptyDark from './(images)/empty-sites-dark.svg'; - import EmptyLightMobile from './(images)/empty-sites-light-mobile.svg'; - import EmptyDarkMobile from './(images)/empty-sites-dark-mobile.svg'; import Grid from './grid.svelte'; import { IconPlus } from '@appwrite.io/pink-icons-svelte'; import { columns } from './store'; @@ -28,15 +26,10 @@ import { invalidate } from '$app/navigation'; import { Dependencies } from '$lib/constants'; import { sdk } from '$lib/stores/sdk'; - import { isSmallViewport } from '$lib/stores/viewport'; - import { addNotification } from '$lib/stores/notifications'; - import { isOnWaitlistSites, joinWaitlistSites } from '$lib/helpers/waitlist'; - import { user } from '$lib/stores/user'; export let data; let show = false; - let isOnWaitlist = isOnWaitlistSites($user); $: $registerCommands([ { @@ -57,118 +50,51 @@ onMount(() => { return sdk.forConsole.client.subscribe('console', (response) => { - if (response.events.includes(`sites.*`)) { + if (response.events.includes('sites.*')) { invalidate(Dependencies.SITES); } }); }); - - $: isDark = $app.themeInUse === 'dark'; - $: imgSrc = isDark - ? $isSmallViewport - ? EmptyDarkMobile - : EmptyDark - : $isSmallViewport - ? EmptyLightMobile - : EmptyLight; - $: imgClass = $isSmallViewport ? 'mobile' : 'desktop'; - - function addToWaitlist() { - joinWaitlistSites($user); - addNotification({ - type: 'success', - title: 'Waitlist joined', - message: "We'll let you know as soon as Appwrite Sites is ready for you." - }); - - isOnWaitlist = true; - } - {#if data.sitesLive} - - - - - - - {#if $canWriteSites} - - {/if} - + + + - {#if data.siteList.total} - {#if data.view === View.Grid} - - {:else} - + + + {#if $canWriteSites} + {/if} - - {:else if data.search} - + + + {#if data.siteList.total} + {#if data.view === View.Grid} + {:else} - (show = true)}> - +
    {/if} + + {:else if data.search} + {:else} - - - - - - {#if isOnWaitlist} - - You've successfully joined the Sites waitlist - - - - We can't wait for you to try out Sites on Cloud. You will get access - soon. - - {:else} - - - Appwrite Sites is in high demand - - -
    - - To ensure a smooth experience for everyone, we’re rolling out - access gradually. Join the waitlist and be one of the first to - deploy with Sites. - -
    - -
    - -
    -
    - {/if} -
    -
    -
    + (show = true)}> + {/if} diff --git a/src/routes/(console)/project-[region]-[project]/sites/+page.ts b/src/routes/(console)/project-[region]-[project]/sites/+page.ts index e1cc8f1b6..6e711b2d5 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/sites/+page.ts @@ -1,12 +1,9 @@ -import { Query, type Models } from '@appwrite.io/console'; import { sdk } from '$lib/stores/sdk'; -import { getLimit, getPage, getSearch, getView, pageToOffset, View } from '$lib/helpers/load'; +import { Query } from '@appwrite.io/console'; import { CARD_LIMIT, Dependencies } from '$lib/constants'; -import { flags } from '$lib/flags'; - -export const load = async ({ url, depends, route, params, parent }) => { - const data = await parent(); +import { getLimit, getPage, getSearch, getView, pageToOffset, View } from '$lib/helpers/load'; +export const load = async ({ url, depends, route, params }) => { depends(Dependencies.SITES); const page = getPage(url); const search = getSearch(url); @@ -14,22 +11,7 @@ export const load = async ({ url, depends, route, params, parent }) => { const offset = pageToOffset(page, limit); const view = getView(url, route, View.Grid, View.Grid); - if (!flags.showSites(data)) { - return { - sitesLive: false, - offset, - limit, - search, - view, - siteList: { - total: 0, - sites: [] - } as Models.SiteList - }; - } - return { - sitesLive: true, offset, limit, search, diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/+page.ts b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/+page.ts index 1af6eb759..a675b8806 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/+page.ts @@ -12,14 +12,16 @@ export const load = async ({ params, depends, parent }) => { const [deploymentList, prodReadyDeployments, proxyRuleList] = await Promise.all([ sdk.forProject(params.region, params.project).sites.listDeployments({ siteId: params.site, - queries: [Query.limit(4), Query.orderDesc('')] + queries: [Query.limit(4), Query.orderDesc(''), Query.select(['status', 'type'])] }), sdk.forProject(params.region, params.project).sites.listDeployments({ siteId: params.site, queries: [ Query.equal('status', 'ready'), Query.equal('activate', true), - Query.orderDesc('') + Query.limit(1), + Query.orderDesc(''), + Query.select(['buildDuration', 'totalSize', 'sourceSize', 'buildSize', 'type']) ] }), sdk.forProject(params.region, params.project).proxy.listRules({ diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/+page.ts b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/+page.ts index 72c5a16c2..38e7807a7 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/+page.ts @@ -22,6 +22,14 @@ export const load = async ({ params, depends, url, route, parent }) => { Query.limit(limit), Query.offset(offset), Query.orderDesc(''), + Query.select([ + 'buildSize', + 'sourceSize', + 'totalSize', + 'buildDuration', + 'status', + 'type' + ]), ...parsedQueries.values() ] }),