Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: use new org daily stat endpoint (#39357)

Kevin Grüneberg5a886be0c2c7
diff --git a/apps/studio/components/interfaces/Organization/Usage/Activity.tsx b/apps/studio/components/interfaces/Organization/Usage/Activity.tsx
index f80c6923fb6..1c943dd901a 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Activity.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Activity.tsx
@@ -1,7 +1,8 @@
import { DataPoint } from 'data/analytics/constants'
-import { PricingMetric, useOrgDailyStatsQuery } from 'data/analytics/org-daily-stats-query'
+import { PricingMetric, type OrgDailyUsageResponse } from 'data/analytics/org-daily-stats-query'
import type { OrgSubscription } from 'data/subscriptions/types'
import UsageSection from './UsageSection/UsageSection'
+import { dailyUsageToDataPoints } from './Usage.utils'
export interface ActivityProps {
orgSlug: string
@@ -10,6 +11,8 @@ export interface ActivityProps {
endDate: string | undefined
subscription: OrgSubscription | undefined
currentBillingCycleSelected: boolean
+ orgDailyStats: OrgDailyUsageResponse | undefined
+ isLoadingOrgDailyStats: boolean
}
const Activity = ({
@@ -19,97 +22,59 @@ const Activity = ({
startDate,
endDate,
currentBillingCycleSelected,
+ orgDailyStats,
+ isLoadingOrgDailyStats,
}: ActivityProps) => {
- const { data: mauData, isLoading: isLoadingMauData } = useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.MONTHLY_ACTIVE_USERS,
- interval: '1d',
- startDate,
- endDate,
- })
-
- const { data: mauSSOData, isLoading: isLoadingMauSSOData } = useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.MONTHLY_ACTIVE_SSO_USERS,
- interval: '1d',
- startDate,
- endDate,
- })
-
- const { data: assetTransformationsData, isLoading: isLoadingAssetTransformationsData } =
- useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.STORAGE_IMAGES_TRANSFORMED,
- interval: '1d',
- startDate,
- endDate,
- })
-
- const { data: funcInvocationsData, isLoading: isLoadingFuncInvocationsData } =
- useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.FUNCTION_INVOCATIONS,
- interval: '1d',
- startDate,
- endDate,
- })
-
- const { data: realtimeMessagesData, isLoading: isLoadingRealtimeMessagesData } =
- useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.REALTIME_MESSAGE_COUNT,
- interval: '1d',
- startDate,
- endDate,
- })
-
- const { data: realtimeConnectionsData, isLoading: isLoadingRealtimeConnectionsData } =
- useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.REALTIME_PEAK_CONNECTIONS,
- interval: '1d',
- startDate,
- endDate,
- })
-
const chartMeta: {
[key: string]: { data: DataPoint[]; margin: number; isLoading: boolean }
} = {
[PricingMetric.MONTHLY_ACTIVE_USERS]: {
- data: mauData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.MONTHLY_ACTIVE_USERS
+ ),
margin: 18,
- isLoading: isLoadingMauData,
+ isLoading: isLoadingOrgDailyStats,
},
[PricingMetric.MONTHLY_ACTIVE_SSO_USERS]: {
- data: mauSSOData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.MONTHLY_ACTIVE_SSO_USERS
+ ),
margin: 20,
- isLoading: isLoadingMauSSOData,
+ isLoading: isLoadingOrgDailyStats,
},
[PricingMetric.STORAGE_IMAGES_TRANSFORMED]: {
- data: assetTransformationsData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.STORAGE_IMAGES_TRANSFORMED
+ ),
margin: 0,
- isLoading: isLoadingAssetTransformationsData,
+ isLoading: isLoadingOrgDailyStats,
},
[PricingMetric.FUNCTION_INVOCATIONS]: {
- data: funcInvocationsData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.FUNCTION_INVOCATIONS
+ ),
margin: 26,
- isLoading: isLoadingFuncInvocationsData,
+ isLoading: isLoadingOrgDailyStats,
},
[PricingMetric.REALTIME_MESSAGE_COUNT]: {
- data: realtimeMessagesData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.REALTIME_MESSAGE_COUNT
+ ),
margin: 38,
- isLoading: isLoadingRealtimeMessagesData,
+ isLoading: isLoadingOrgDailyStats,
},
[PricingMetric.REALTIME_PEAK_CONNECTIONS]: {
- data: realtimeConnectionsData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.REALTIME_PEAK_CONNECTIONS
+ ),
margin: 0,
- isLoading: isLoadingRealtimeConnectionsData,
+ isLoading: isLoadingOrgDailyStats,
},
}
diff --git a/apps/studio/components/interfaces/Organization/Usage/Compute.tsx b/apps/studio/components/interfaces/Organization/Usage/Compute.tsx
index 778c3d117d8..9fc71678877 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Compute.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Compute.tsx
@@ -1,44 +1,34 @@
import { BarChart2 } from 'lucide-react'
import { useMemo } from 'react'
-import AlertError from 'components/ui/AlertError'
import Panel from 'components/ui/Panel'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { DataPoint } from 'data/analytics/constants'
-import { useOrgDailyComputeStatsQuery } from 'data/analytics/org-daily-compute-stats-query'
-import { ComputeUsageMetric, computeUsageMetricLabel } from 'data/analytics/org-daily-stats-query'
-import type { OrgSubscription } from 'data/subscriptions/types'
+import {
+ ComputeUsageMetric,
+ computeUsageMetricLabel,
+ type OrgDailyUsageResponse,
+} from 'data/analytics/org-daily-stats-query'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { DOCS_URL } from 'lib/constants'
import { SectionContent } from './SectionContent'
import { Attribute, AttributeColor } from './Usage.constants'
import UsageBarChart from './UsageBarChart'
+import { dailyUsageToDataPoints } from './Usage.utils'
export interface ComputeProps {
- orgSlug: string
- projectRef?: string
- startDate: string | undefined
- endDate: string | undefined
- subscription: OrgSubscription | undefined
+ orgDailyStats: OrgDailyUsageResponse | undefined
+ isLoadingOrgDailyStats: boolean
}
-const Compute = ({ orgSlug, projectRef, startDate, endDate }: ComputeProps) => {
+const Compute = ({ orgDailyStats, isLoadingOrgDailyStats }: ComputeProps) => {
const allAttributeKeys = Object.values(ComputeUsageMetric).map((it) => it.toLowerCase())
- const {
- data: egressData,
- isLoading,
- error,
- isSuccess,
- } = useOrgDailyComputeStatsQuery({
- orgSlug,
- projectRef,
- startDate,
- endDate,
- })
const { billingAll } = useIsFeatureEnabled(['billing:all'])
- const chartData: DataPoint[] = egressData?.data ?? []
+ const chartData: DataPoint[] = dailyUsageToDataPoints(orgDailyStats, (metric) =>
+ metric.toString().startsWith('COMPUTE')
+ )
const COMPUTE_TO_COLOR: Record<ComputeUsageMetric, AttributeColor> = {
[ComputeUsageMetric.COMPUTE_HOURS_BRANCH]: 'blue',
@@ -97,11 +87,9 @@ const Compute = ({ orgSlug, projectRef, startDate, endDate }: ComputeProps) => {
: [],
}}
>
- {isLoading && <GenericSkeletonLoader />}
-
- {error != null && <AlertError subject="Failed to retrieve usage data" error={error} />}
+ {isLoadingOrgDailyStats && <GenericSkeletonLoader />}
- {isSuccess && (
+ {!isLoadingOrgDailyStats && (
<>
<div className="space-y-1">
{chartData.length > 0 && (
@@ -135,9 +123,7 @@ const Compute = ({ orgSlug, projectRef, startDate, endDate }: ComputeProps) => {
<p className="text-sm text-foreground-light">The data refreshes every hour.</p>
</div>
- {isLoading ? (
- <GenericSkeletonLoader />
- ) : chartData.length > 0 && notAllValuesZero ? (
+ {chartData.length > 0 && notAllValuesZero ? (
<UsageBarChart
name={`Compute Hours usage`}
unit={'hours'}
diff --git a/apps/studio/components/interfaces/Organization/Usage/Egress.tsx b/apps/studio/components/interfaces/Organization/Usage/Egress.tsx
index 0ce4d8e2d9e..68e6e111dc2 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Egress.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Egress.tsx
@@ -1,55 +1,45 @@
import { DataPoint } from 'data/analytics/constants'
-import { PricingMetric, useOrgDailyStatsQuery } from 'data/analytics/org-daily-stats-query'
+import {
+ PricingMetric,
+ useOrgDailyStatsQuery,
+ type OrgDailyUsageResponse,
+} from 'data/analytics/org-daily-stats-query'
import type { OrgSubscription } from 'data/subscriptions/types'
import UsageSection from './UsageSection/UsageSection'
+import { dailyUsageToDataPoints } from './Usage.utils'
export interface EgressProps {
orgSlug: string
projectRef?: string
- startDate: string | undefined
- endDate: string | undefined
subscription: OrgSubscription | undefined
currentBillingCycleSelected: boolean
+ orgDailyStats: OrgDailyUsageResponse | undefined
+ isLoadingOrgDailyStats: boolean
}
const Egress = ({
orgSlug,
projectRef,
subscription,
- startDate,
- endDate,
currentBillingCycleSelected,
+ orgDailyStats,
+ isLoadingOrgDailyStats,
}: EgressProps) => {
- const { data: egressData, isLoading: isLoadingDbEgressData } = useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.EGRESS,
- interval: '1d',
- startDate,
- endDate,
- })
-
- const { data: cachedEgressData, isLoading: isLoadingCachedEgress } = useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.CACHED_EGRESS,
- interval: '1d',
- startDate,
- endDate,
- })
-
const chartMeta: {
[key: string]: { data: DataPoint[]; margin: number; isLoading: boolean }
} = {
[PricingMetric.EGRESS]: {
- data: egressData?.data ?? [],
+ data: dailyUsageToDataPoints(orgDailyStats, (metric) => metric === PricingMetric.EGRESS),
margin: 16,
- isLoading: isLoadingDbEgressData,
+ isLoading: isLoadingOrgDailyStats,
},
[PricingMetric.CACHED_EGRESS]: {
- data: cachedEgressData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.CACHED_EGRESS
+ ),
margin: 16,
- isLoading: isLoadingCachedEgress,
+ isLoading: isLoadingOrgDailyStats,
},
}
diff --git a/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx b/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx
index 22368daeb62..812a7a80068 100644
--- a/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx
@@ -1,55 +1,40 @@
import { DataPoint } from 'data/analytics/constants'
-import { PricingMetric, useOrgDailyStatsQuery } from 'data/analytics/org-daily-stats-query'
+import {
+ PricingMetric,
+ useOrgDailyStatsQuery,
+ type OrgDailyUsageResponse,
+} from 'data/analytics/org-daily-stats-query'
import type { OrgSubscription } from 'data/subscriptions/types'
import UsageSection from './UsageSection/UsageSection'
+import { dailyUsageToDataPoints } from './Usage.utils'
export interface SizeAndCountsProps {
orgSlug: string
projectRef?: string
- startDate: string | undefined
- endDate: string | undefined
subscription: OrgSubscription | undefined
currentBillingCycleSelected: boolean
+ orgDailyStats: OrgDailyUsageResponse | undefined
+ isLoadingOrgDailyStats: boolean
}
const SizeAndCounts = ({
orgSlug,
projectRef,
- startDate,
- endDate,
subscription,
currentBillingCycleSelected,
+ orgDailyStats,
+ isLoadingOrgDailyStats,
}: SizeAndCountsProps) => {
- const { data: dbSizeData, isLoading: isLoadingDbSizeData } = useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.DATABASE_SIZE,
- interval: '1d',
- startDate,
- endDate,
- })
-
- const { data: storageSizeData, isLoading: isLoadingStorageSizeData } = useOrgDailyStatsQuery({
- orgSlug,
- projectRef,
- metric: PricingMetric.STORAGE_SIZE,
- interval: '1d',
- startDate,
- endDate,
- })
-
const chartMeta: {
[key: string]: { data: DataPoint[]; margin: number; isLoading: boolean }
} = {
- [PricingMetric.DATABASE_SIZE]: {
- isLoading: isLoadingDbSizeData,
- margin: 14,
- data: dbSizeData?.data ?? [],
- },
[PricingMetric.STORAGE_SIZE]: {
- isLoading: isLoadingStorageSizeData,
+ isLoading: isLoadingOrgDailyStats,
margin: 14,
- data: storageSizeData?.data ?? [],
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.STORAGE_SIZE
+ ),
},
}
diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx b/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx
index d80405ead4c..7f8471d2c65 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx
@@ -80,7 +80,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
key: PricingMetric.EGRESS,
attributes: [
{ key: EgressType.AUTH, name: 'Auth Egress', color: 'yellow' },
- { key: EgressType.DATABASE, name: 'Database Egress', color: 'green' },
+ { key: EgressType.REST, name: 'PostgREST Egress', color: 'green' },
{ key: EgressType.STORAGE, name: 'Storage Egress', color: 'blue' },
{ key: EgressType.REALTIME, name: 'Realtime Egress', color: 'orange' },
{ key: EgressType.FUNCTIONS, name: 'Functions Egress', color: 'purple' },
@@ -90,11 +90,9 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
name: 'Egress',
unit: 'bytes',
description:
- subscription?.cached_egress_enabled === true
- ? 'Contains any outgoing traffic including Database, Storage, Realtime, Auth, API, Edge Functions, Pooler and Log Drains.\nBilling is based on the total sum of uncached egress in GB throughout your billing period.\nEgress via cache hits is billed separately.'
- : 'Contains any outgoing traffic including Database, Storage, Realtime, Auth, API, Edge Functions, Pooler and Log Drains.\nBilling is based on the total sum of uncached egress in GB throughout your billing period.',
+ 'Contains any outgoing traffic including Database, Storage, Realtime, Auth, API, Edge Functions, Pooler and Log Drains.\nBilling is based on the total sum of uncached egress in GB throughout your billing period.\nEgress via cache hits is billed separately.',
chartDescription:
- 'The breakdown of different egress types is inclusive of cached egress, even though it is billed separately. The data refreshes every 24 hours.',
+ 'The breakdown of different egress types is inclusive of cached egress, even though it is billed separately. The data refreshes every hour.',
links: [
{
name: 'Documentation',
@@ -102,10 +100,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
},
],
},
- ]
-
- if (subscription?.cached_egress_enabled) {
- egressAttributes.push({
+ {
anchor: 'cachedEgress',
key: PricingMetric.CACHED_EGRESS,
attributes: [{ key: PricingMetric.CACHED_EGRESS.toLowerCase(), color: 'white' }],
@@ -113,15 +108,15 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
unit: 'bytes',
description:
'Contains any outgoing traffic that is served from a cache hit. Includes API, Storage and Edge Functions.\nBilling is based on the total sum of cached egress in GB throughout your billing period.',
- chartDescription: 'The data refreshes every 24 hours.',
+ chartDescription: 'The data refreshes every hour.',
links: [
{
name: 'Documentation',
url: `${DOCS_URL}/guides/platform/manage-your-usage/egress`,
},
],
- })
- }
+ },
+ ]
return [
{
@@ -151,7 +146,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
url: `${DOCS_URL}/guides/platform/database-size`,
},
],
- chartDescription: 'The data refreshes every 24 hours.',
+ chartDescription: 'The data refreshes every hour.',
additionalInfo: (usage?: OrgUsageResponse) => {
const usageMeta = usage?.usages.find(
(x) => x.metric === PricingMetric.DATABASE_SIZE
@@ -224,7 +219,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
unit: 'bytes',
description:
'Sum of all objects in your storage buckets.\nBilling is prorated down to the hour and will be displayed GB-Hrs.',
- chartDescription: 'The data refreshes every 24 hours.',
+ chartDescription: 'The data refreshes every hour.',
links: [
{
name: 'Storage',
@@ -308,7 +303,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
unit: 'absolute',
description:
'Every serverless function invocation independent of response status is counted.\nBilling is based on the sum of all invocations throughout your billing period.',
- chartDescription: 'The data refreshes every 24 hours.',
+ chartDescription: 'The data refreshes every hour.',
links: [
{
name: 'Edge Functions',
@@ -324,7 +319,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
unit: 'absolute',
description:
"Count of messages going through Realtime. Includes database changes, broadcast and presence. \nUsage example: If you do a database change and 5 clients listen to that change via Realtime, that's 5 messages. If you broadcast a message and 4 clients listen to that, that's 5 messages (1 message sent, 4 received).\nBilling is based on the total amount of messages throughout your billing period.",
- chartDescription: 'The data refreshes every 24 hours.',
+ chartDescription: 'The data refreshes every hour.',
links: [
{
name: 'Realtime Quotas',
@@ -343,7 +338,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
unit: 'absolute',
description:
'Total number of successful connections. Connections attempts are not counted towards usage.\nBilling is based on the maximum amount of concurrent peak connections throughout your billing period.',
- chartDescription: 'The data refreshes every 24 hours.',
+ chartDescription: 'The data refreshes every hour.',
links: [
{
name: 'Realtime Quotas',
diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.tsx b/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
index ed63dd7ac53..7d9aee83ae9 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
@@ -4,12 +4,18 @@ import Link from 'next/link'
import { useEffect, useMemo, useState } from 'react'
import { useParams } from 'common'
-import { ScaffoldContainer, ScaffoldHeader, ScaffoldTitle } from 'components/layouts/Scaffold'
+import {
+ ScaffoldContainer,
+ ScaffoldHeader,
+ ScaffoldSection,
+ ScaffoldTitle,
+} from 'components/layouts/Scaffold'
import AlertError from 'components/ui/AlertError'
import DateRangePicker from 'components/ui/DateRangePicker'
import NoPermission from 'components/ui/NoPermission'
import { OrganizationProjectSelector } from 'components/ui/OrganizationProjectSelector'
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
+import { useOrgDailyStatsQuery } from 'data/analytics/org-daily-stats-query'
import { OrgProject } from 'data/projects/org-projects-infinite-query'
import { useProjectDetailQuery } from 'data/projects/project-detail-query'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
@@ -104,6 +110,18 @@ export const Usage = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dateRange, subscription])
+ const {
+ data: orgDailyStats,
+ error: orgDailyStatsError,
+ isLoading: isLoadingOrgDailyStats,
+ isError: isErrorOrgDailyStats,
+ } = useOrgDailyStatsQuery({
+ orgSlug: slug,
+ projectRef,
+ startDate,
+ endDate,
+ })
+
useEffect(() => {
if (projectRef && isSuccessProjectDetail) {
setSelectedProjectRefInputValue(projectRef)
@@ -242,6 +260,17 @@ export const Usage = () => {
</ScaffoldContainer>
</div>
+ {isErrorOrgDailyStats && (
+ <ScaffoldContainer>
+ <ScaffoldSection isFullWidth className="pb-0">
+ <AlertError
+ error={orgDailyStatsError}
+ subject="Failed to retrieve usage statistics for organization"
+ />
+ </ScaffoldSection>
+ </ScaffoldContainer>
+ )}
+
{selectedProjectRef ? (
<ScaffoldContainer className="mt-5">
<Admonition
@@ -282,31 +311,25 @@ export const Usage = () => {
/>
{subscription?.plan.id !== 'free' && (
- <Compute
- orgSlug={slug as string}
- projectRef={selectedProjectRef}
- subscription={subscription}
- startDate={startDate}
- endDate={endDate}
- />
+ <Compute orgDailyStats={orgDailyStats} isLoadingOrgDailyStats={isLoadingOrgDailyStats} />
)}
<Egress
orgSlug={slug as string}
projectRef={selectedProjectRef}
subscription={subscription}
- startDate={startDate}
- endDate={endDate}
currentBillingCycleSelected={currentBillingCycleSelected}
+ orgDailyStats={orgDailyStats}
+ isLoadingOrgDailyStats={isLoadingOrgDailyStats}
/>
<SizeAndCounts
orgSlug={slug as string}
projectRef={selectedProjectRef}
subscription={subscription}
- startDate={startDate}
- endDate={endDate}
currentBillingCycleSelected={currentBillingCycleSelected}
+ orgDailyStats={orgDailyStats}
+ isLoadingOrgDailyStats={isLoadingOrgDailyStats}
/>
<Activity
@@ -316,6 +339,8 @@ export const Usage = () => {
startDate={startDate}
endDate={endDate}
currentBillingCycleSelected={currentBillingCycleSelected}
+ orgDailyStats={orgDailyStats}
+ isLoadingOrgDailyStats={isLoadingOrgDailyStats}
/>
</>
)
diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.utils.test.ts b/apps/studio/components/interfaces/Organization/Usage/Usage.utils.test.ts
new file mode 100644
index 00000000000..38ce31dc1de
--- /dev/null
+++ b/apps/studio/components/interfaces/Organization/Usage/Usage.utils.test.ts
@@ -0,0 +1,250 @@
+import { describe, it, expect } from 'vitest'
+import { dailyUsageToDataPoints } from './Usage.utils'
+import { PricingMetric } from 'data/analytics/org-daily-stats-query'
+import type { OrgDailyUsageResponse } from 'data/analytics/org-daily-stats-query'
+
+describe('dailyUsageToDataPoints', () => {
+ it('returns empty array when dailyUsage is undefined', () => {
+ const result = dailyUsageToDataPoints(undefined, () => true)
+ expect(result).toEqual([])
+ })
+
+ it('returns empty array when usages array is empty', () => {
+ const dailyUsage: OrgDailyUsageResponse = {
+ usages: [],
+ }
+ const result = dailyUsageToDataPoints(dailyUsage, () => true)
+ expect(result).toEqual([])
+ })
+
+ it('transforms single usage entry correctly', () => {
+ const dailyUsage: OrgDailyUsageResponse = {
+ usages: [
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.EGRESS,
+ usage: 15,
+ usage_original: 15 * 1e9,
+ breakdown: null,
+ },
+ ],
+ }
+
+ const result = dailyUsageToDataPoints(dailyUsage, () => true)
+
+ expect(result).toHaveLength(1)
+ expect(result[0]).toEqual({
+ period_start: '2025-10-01',
+ periodStartFormatted: '01 Oct',
+ egress: 15 * 1e9,
+ })
+ })
+
+ it('groups multiple metrics by date correctly', () => {
+ const dailyUsage: OrgDailyUsageResponse = {
+ usages: [
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.EGRESS,
+ usage: 1000000,
+ usage_original: 1000000,
+ breakdown: null,
+ },
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.DATABASE_SIZE,
+ usage: 5000000,
+ usage_original: 5000000,
+ breakdown: null,
+ },
+ ],
+ }
+
+ const result = dailyUsageToDataPoints(dailyUsage, () => true)
+
+ expect(result).toHaveLength(1)
+ expect(result[0]).toEqual({
+ period_start: '2025-10-01',
+ periodStartFormatted: '01 Oct',
+ egress: 1000000,
+ database_size: 5000000,
+ })
+ })
+
+ it('creates separate data points for different dates', () => {
+ const dailyUsage: OrgDailyUsageResponse = {
+ usages: [
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.EGRESS,
+ usage: 1000000,
+ usage_original: 1000000,
+ breakdown: null,
+ },
+ {
+ date: '2025-10-02',
+ metric: PricingMetric.EGRESS,
+ usage: 2000000,
+ usage_original: 2000000,
+ breakdown: null,
+ },
+ ],
+ }
+
+ const result = dailyUsageToDataPoints(dailyUsage, () => true)
+
+ expect(result).toHaveLength(2)
+ expect(result[0]).toEqual({
+ period_start: '2025-10-01',
+ periodStartFormatted: '01 Oct',
+ egress: 1000000,
+ })
+ expect(result[1]).toEqual({
+ period_start: '2025-10-02',
+ periodStartFormatted: '02 Oct',
+ egress: 2000000,
+ })
+ })
+
+ it('includes breakdown data when present', () => {
+ const dailyUsage: OrgDailyUsageResponse = {
+ usages: [
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.EGRESS,
+ usage: 1000000,
+ usage_original: 1000000,
+ breakdown: {
+ egress_rest: 400000,
+ egress_realtime: 300000,
+ egress_storage: 200000,
+ egress_supavisor: 100000,
+ egress_function: 0,
+ egress_graphql: 0,
+ egress_logdrain: 0,
+ },
+ },
+ ],
+ }
+
+ const result = dailyUsageToDataPoints(dailyUsage, () => true)
+
+ expect(result).toHaveLength(1)
+ expect(result[0]).toEqual({
+ period_start: '2025-10-01',
+ periodStartFormatted: '01 Oct',
+ egress: 1000000,
+ egress_rest: 400000,
+ egress_realtime: 300000,
+ egress_storage: 200000,
+ egress_supavisor: 100000,
+ egress_function: 0,
+ egress_graphql: 0,
+ egress_logdrain: 0,
+ })
+ })
+
+ it('handles complex scenario with multiple dates, metrics, and breakdowns', () => {
+ const dailyUsage: OrgDailyUsageResponse = {
+ usages: [
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.EGRESS,
+ usage: 1000000,
+ usage_original: 1000000,
+ breakdown: {
+ egress_rest: 600000,
+ egress_realtime: 400000,
+ egress_storage: 0,
+ egress_supavisor: 0,
+ egress_function: 0,
+ egress_graphql: 0,
+ egress_logdrain: 0,
+ },
+ },
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.DATABASE_SIZE,
+ usage: 5000000,
+ usage_original: 5000000,
+ breakdown: null,
+ },
+ {
+ date: '2025-10-02',
+ metric: PricingMetric.EGRESS,
+ usage: 1500000,
+ usage_original: 1500000,
+ breakdown: {
+ egress_rest: 900000,
+ egress_realtime: 600000,
+ egress_storage: 0,
+ egress_supavisor: 0,
+ egress_function: 0,
+ egress_graphql: 0,
+ egress_logdrain: 0,
+ },
+ },
+ {
+ date: '2025-10-02',
+ metric: PricingMetric.STORAGE_SIZE,
+ usage: 2000000,
+ usage_original: 2000000,
+ breakdown: null,
+ },
+ ],
+ }
+
+ const result = dailyUsageToDataPoints(dailyUsage, () => true)
+
+ expect(result).toHaveLength(2)
+ expect(result[0]).toEqual({
+ period_start: '2025-10-01',
+ periodStartFormatted: '01 Oct',
+ egress: 1000000,
+ egress_rest: 600000,
+ egress_realtime: 400000,
+ egress_storage: 0,
+ egress_supavisor: 0,
+ egress_function: 0,
+ egress_graphql: 0,
+ egress_logdrain: 0,
+ database_size: 5000000,
+ })
+ expect(result[1]).toEqual({
+ period_start: '2025-10-02',
+ periodStartFormatted: '02 Oct',
+ egress: 1500000,
+ egress_rest: 900000,
+ egress_realtime: 600000,
+ egress_storage: 0,
+ egress_supavisor: 0,
+ egress_function: 0,
+ egress_graphql: 0,
+ egress_logdrain: 0,
+ storage_size: 2000000,
+ })
+ })
+
+ it('handles zero usage values', () => {
+ const dailyUsage: OrgDailyUsageResponse = {
+ usages: [
+ {
+ date: '2025-10-01',
+ metric: PricingMetric.EGRESS,
+ usage: 0,
+ usage_original: 0,
+ breakdown: null,
+ },
+ ],
+ }
+
+ const result = dailyUsageToDataPoints(dailyUsage, () => true)
+
+ expect(result).toHaveLength(1)
+ expect(result[0]).toEqual({
+ period_start: '2025-10-01',
+ periodStartFormatted: '01 Oct',
+ egress: 0,
+ })
+ })
+})
diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.utils.ts b/apps/studio/components/interfaces/Organization/Usage/Usage.utils.ts
index 73feec66168..67ad4cc1c1a 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Usage.utils.ts
+++ b/apps/studio/components/interfaces/Organization/Usage/Usage.utils.ts
@@ -1,4 +1,8 @@
+import dayjs from 'dayjs'
+import { groupBy } from 'lodash'
+
import { DataPoint } from 'data/analytics/constants'
+import type { OrgDailyUsageResponse, PricingMetric } from 'data/analytics/org-daily-stats-query'
import type { OrgSubscription } from 'data/subscriptions/types'
// [Joshen] This is just for development to generate some test data for chart rendering
@@ -92,3 +96,38 @@ const formatBytesPrecision = (bytes: any) => {
return parseFloat((bytes / Math.pow(k, i)).toFixed(3)) + ' ' + unit
}
+
+export function dailyUsageToDataPoints(
+ dailyUsage: OrgDailyUsageResponse | undefined,
+ includeMetric: (metric: PricingMetric) => boolean
+): DataPoint[] {
+ if (!dailyUsage || !dailyUsage.usages.length) return []
+
+ const groupedByDate = groupBy(
+ dailyUsage.usages.filter((it) => includeMetric(it.metric as PricingMetric)),
+ 'date'
+ )
+
+ const dataPoints: DataPoint[] = []
+
+ Object.entries(groupedByDate).forEach(([date, usages]) => {
+ const dataPoint: DataPoint = {
+ period_start: date,
+ periodStartFormatted: dayjs(date).format('DD MMM'),
+ }
+
+ for (const usage of usages) {
+ dataPoint[usage.metric.toLowerCase()] = usage.usage_original
+
+ if (usage.breakdown) {
+ for (const [key, value] of Object.entries(usage.breakdown)) {
+ dataPoint[key.toLowerCase()] = value
+ }
+ }
+ }
+
+ dataPoints.push(dataPoint)
+ })
+
+ return dataPoints
+}
diff --git a/apps/studio/data/analytics/constants.ts b/apps/studio/data/analytics/constants.ts
index 225ac288287..8cbd7c413ec 100644
--- a/apps/studio/data/analytics/constants.ts
+++ b/apps/studio/data/analytics/constants.ts
@@ -1,6 +1,4 @@
export type DataPoint = {
- id?: string
- loopId?: number | string
period_start: string
periodStartFormatted?: string
} & {
diff --git a/apps/studio/data/analytics/keys.ts b/apps/studio/data/analytics/keys.ts
index 17e8d7ce14c..3a1037c3057 100644
--- a/apps/studio/data/analytics/keys.ts
+++ b/apps/studio/data/analytics/keys.ts
@@ -77,42 +77,15 @@ export const analyticsKeys = {
},
] as const,
- orgDailyComputeStats: (
- orgSlug: string | undefined,
- {
- startDate,
- endDate,
- projectRef,
- }: {
- startDate?: string
- endDate?: string
- projectRef?: string
- }
- ) =>
- [
- 'organizations',
- orgSlug,
- 'daily-stats-compute',
- {
- startDate: isoDateStringToDate(startDate),
- endDate: isoDateStringToDate(endDate),
- projectRef,
- },
- ] as const,
-
orgDailyStats: (
orgSlug: string | undefined,
{
- metric,
startDate,
endDate,
- interval,
projectRef,
}: {
- metric?: string
startDate?: string
endDate?: string
- interval?: string
projectRef?: string
}
) =>
@@ -121,10 +94,8 @@ export const analyticsKeys = {
orgSlug,
'daily-stats',
{
- metric,
startDate: isoDateStringToDate(startDate),
endDate: isoDateStringToDate(endDate),
- interval,
projectRef,
},
] as const,
diff --git a/apps/studio/data/analytics/org-daily-compute-stats-query.ts b/apps/studio/data/analytics/org-daily-compute-stats-query.ts
deleted file mode 100644
index 1cd459ebcb5..00000000000
--- a/apps/studio/data/analytics/org-daily-compute-stats-query.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { useQuery, UseQueryOptions } from '@tanstack/react-query'
-import dayjs from 'dayjs'
-
-import { get, handleError } from 'data/fetchers'
-import type { ResponseError } from 'types'
-import type { AnalyticsData } from './constants'
-import { analyticsKeys } from './keys'
-
-export type OrgDailyComputeStatsVariables = {
- // API parameters
- orgSlug?: string
- startDate?: string
- endDate?: string
- projectRef?: string
- // Client specific
- dateFormat?: string
- modifier?: (x: number) => number
-}
-
-export async function getOrgDailyComputeStats(
- { orgSlug, startDate, endDate, projectRef }: OrgDailyComputeStatsVariables,
- signal?: AbortSignal
-) {
- if (!orgSlug) throw new Error('Org slug is required')
- if (!startDate) throw new Error('Start date is required')
- if (!endDate) throw new Error('End date is required')
-
- let endpoint = `/platform/organizations/{slug}/daily-stats/compute?&startDate=${encodeURIComponent(
- startDate
- )}&endDate=${encodeURIComponent(endDate)}`
-
- if (projectRef) endpoint += `&projectRef=${projectRef}`
-
- const { data, error } = await get('/platform/organizations/{slug}/daily-stats/compute', {
- params: { path: { slug: orgSlug }, query: { projectRef, startDate, endDate } },
- signal,
- })
- if (error) handleError(error)
- return data as AnalyticsData
-}
-
-export type OrgDailyComputeStatsData = Awaited<ReturnType<typeof getOrgDailyComputeStats>>
-export type OrgDailyComputeStatsError = ResponseError
-
-export const useOrgDailyComputeStatsQuery = <TData = OrgDailyComputeStatsData>(
- { orgSlug, startDate, endDate, projectRef, dateFormat = 'DD MMM' }: OrgDailyComputeStatsVariables,
- {
- enabled = true,
- ...options
- }: UseQueryOptions<OrgDailyComputeStatsData, OrgDailyComputeStatsError, TData> = {}
-) =>
- useQuery<OrgDailyComputeStatsData, OrgDailyComputeStatsError, TData>(
- analyticsKeys.orgDailyComputeStats(orgSlug, { startDate, endDate, projectRef }),
- ({ signal }) => getOrgDailyComputeStats({ orgSlug, startDate, endDate, projectRef }, signal),
- {
- enabled:
- enabled &&
- typeof orgSlug !== 'undefined' &&
- typeof startDate !== 'undefined' &&
- typeof endDate !== 'undefined',
-
- select(data) {
- return {
- ...data,
- data: data.data.map((x) => {
- return {
- ...x,
- periodStartFormatted: dayjs(x.period_start).format(dateFormat),
- }
- }),
- } as TData
- },
- staleTime: 1000 * 60 * 60, // default good for an hour for now
- ...options,
- }
- )
diff --git a/apps/studio/data/analytics/org-daily-stats-query.ts b/apps/studio/data/analytics/org-daily-stats-query.ts
index 6a6e24f1ade..db4fd96f2ac 100644
--- a/apps/studio/data/analytics/org-daily-stats-query.ts
+++ b/apps/studio/data/analytics/org-daily-stats-query.ts
@@ -1,19 +1,18 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
-import dayjs from 'dayjs'
+import type { components } from 'api-types'
import { get, handleError } from 'data/fetchers'
-import type { AnalyticsData } from './constants'
+import { ResponseError } from 'types'
import { analyticsKeys } from './keys'
export enum EgressType {
- DATABASE = 'egress_database',
+ REST = 'egress_rest',
AUTH = 'egress_auth',
STORAGE = 'egress_storage',
REALTIME = 'egress_realtime',
FUNCTIONS = 'egress_functions',
SUPAVISOR = 'egress_supavisor',
LOGDRAIN = 'egress_logdrain',
- UNIFIED = 'egress',
}
// [Joshen] Get this from common package instead of API and dashboard having one copy each
@@ -113,33 +112,27 @@ export const computeUsageMetricLabel = (computeUsageMetric: ComputeUsageMetric)
export type OrgDailyStatsVariables = {
// API parameters
orgSlug?: string
- metric?: PricingMetric
startDate?: string
endDate?: string
- interval?: string
projectRef?: string
- // Client specific
- dateFormat?: string
- modifier?: (x: number) => number
}
+export type OrgDailyUsageResponse = components['schemas']['OrgDailyUsageResponse']
+
export async function getOrgDailyStats(
- { orgSlug, metric, startDate, endDate, interval = '1d', projectRef }: OrgDailyStatsVariables,
+ { orgSlug, startDate, endDate, projectRef }: OrgDailyStatsVariables,
signal?: AbortSignal
) {
if (!orgSlug) throw new Error('Org slug is required')
- if (!metric) throw new Error('Metric is required')
if (!startDate) throw new Error('Start date is required')
if (!endDate) throw new Error('Start date is required')
- const { data, error } = await get('/platform/organizations/{slug}/daily-stats', {
+ const { data, error } = await get('/platform/organizations/{slug}/usage/daily', {
params: {
path: { slug: orgSlug },
query: {
- metric,
- startDate,
- endDate,
- interval,
+ start: startDate,
+ end: endDate,
projectRef,
},
},
@@ -148,52 +141,25 @@ export async function getOrgDailyStats(
if (error) handleError(error)
- return data as unknown as AnalyticsData
+ return data
}
export type OrgDailyStatsData = Awaited<ReturnType<typeof getOrgDailyStats>>
-export type OrgDailyStatsError = unknown
+export type OrgDailyStatsError = ResponseError
export const useOrgDailyStatsQuery = <TData = OrgDailyStatsData>(
- {
- orgSlug,
- metric,
- startDate,
- endDate,
- interval = '1d',
- projectRef,
- dateFormat = 'DD MMM',
- modifier,
- }: OrgDailyStatsVariables,
+ { orgSlug, startDate, endDate, projectRef }: OrgDailyStatsVariables,
{ enabled = true, ...options }: UseQueryOptions<OrgDailyStatsData, OrgDailyStatsError, TData> = {}
) =>
useQuery<OrgDailyStatsData, OrgDailyStatsError, TData>(
- analyticsKeys.orgDailyStats(orgSlug, { metric, startDate, endDate, interval, projectRef }),
- ({ signal }) =>
- getOrgDailyStats({ orgSlug, metric, startDate, endDate, interval, projectRef }, signal),
+ analyticsKeys.orgDailyStats(orgSlug, { startDate, endDate, projectRef }),
+ ({ signal }) => getOrgDailyStats({ orgSlug, startDate, endDate, projectRef }, signal),
{
enabled:
enabled &&
typeof orgSlug !== 'undefined' &&
- typeof metric !== 'undefined' &&
typeof startDate !== 'undefined' &&
typeof endDate !== 'undefined',
-
- select(data) {
- return {
- ...data,
- data: data.data.map((x) => {
- return {
- ...x,
- [metric as string]:
- modifier !== undefined
- ? modifier(Number(x[metric as string]))
- : Number(x[metric as string]),
- periodStartFormatted: dayjs(x.period_start).format(dateFormat),
- }
- }),
- } as TData
- },
staleTime: 1000 * 60 * 60, // default good for an hour for now
...options,
}
diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.ts
index e15025b4759..6bfe7cfbaa4 100644
--- a/packages/api-types/types/api.d.ts
+++ b/packages/api-types/types/api.d.ts
@@ -1972,19 +1972,40 @@ export interface components {
jwt_exp: number | null
mailer_allow_unverified_email_sign_ins: boolean | null
mailer_autoconfirm: boolean | null
+ mailer_notifications_email_changed_enabled: boolean | null
+ mailer_notifications_identity_linked_enabled: boolean | null
+ mailer_notifications_identity_unlinked_enabled: boolean | null
+ mailer_notifications_mfa_factor_enrolled_enabled: boolean | null
+ mailer_notifications_mfa_factor_unenrolled_enabled: boolean | null
+ mailer_notifications_password_changed_enabled: boolean | null
+ mailer_notifications_phone_changed_enabled: boolean | null
mailer_otp_exp: number
mailer_otp_length: number | null
mailer_secure_email_change_enabled: boolean | null
mailer_subjects_confirmation: string | null
mailer_subjects_email_change: string | null
+ mailer_subjects_email_changed_notification: string | null
+ mailer_subjects_identity_linked_notification: string | null
+ mailer_subjects_identity_unlinked_notification: string | null
mailer_subjects_invite: string | null
mailer_subjects_magic_link: string | null
+ mailer_subjects_mfa_factor_enrolled_notification: string | null
+ mailer_subjects_mfa_factor_unenrolled_notification: string | null
+ mailer_subjects_password_changed_notification: string | null
+ mailer_subjects_phone_changed_notification: string | null
mailer_subjects_reauthentication: string | null
mailer_subjects_recovery: string | null
mailer_templates_confirmation_content: string | null
mailer_templates_email_change_content: string | null
+ mailer_templates_email_changed_notification_content: string | null
+ mailer_templates_identity_linked_notification_content: string | null
+ mailer_templates_identity_unlinked_notification_content: string | null
mailer_templates_invite_content: string | null
mailer_templates_magic_link_content: string | null
+ mailer_templates_mfa_factor_enrolled_notification_content: string | null
+ mailer_templates_mfa_factor_unenrolled_notification_content: string | null
+ mailer_templates_password_changed_notification_content: string | null
+ mailer_templates_phone_changed_notification_content: string | null
mailer_templates_reauthentication_content: string | null
mailer_templates_recovery_content: string | null
mfa_max_enrolled_factors: number | null
@@ -3332,19 +3353,40 @@ export interface components {
jwt_exp?: number | null
mailer_allow_unverified_email_sign_ins?: boolean | null
mailer_autoconfirm?: boolean | null
+ mailer_notifications_email_changed_enabled?: boolean | null
+ mailer_notifications_identity_linked_enabled?: boolean | null
+ mailer_notifications_identity_unlinked_enabled?: boolean | null
+ mailer_notifications_mfa_factor_enrolled_enabled?: boolean | null
+ mailer_notifications_mfa_factor_unenrolled_enabled?: boolean | null
+ mailer_notifications_password_changed_enabled?: boolean | null
+ mailer_notifications_phone_changed_enabled?: boolean | null
mailer_otp_exp?: number
mailer_otp_length?: number | null
mailer_secure_email_change_enabled?: boolean | null
mailer_subjects_confirmation?: string | null
mailer_subjects_email_change?: string | null
+ mailer_subjects_email_changed_notification?: string | null
+ mailer_subjects_identity_linked_notification?: string | null
+ mailer_subjects_identity_unlinked_notification?: string | null
mailer_subjects_invite?: string | null
mailer_subjects_magic_link?: string | null
+ mailer_subjects_mfa_factor_enrolled_notification?: string | null
+ mailer_subjects_mfa_factor_unenrolled_notification?: string | null
+ mailer_subjects_password_changed_notification?: string | null
+ mailer_subjects_phone_changed_notification?: string | null
mailer_subjects_reauthentication?: string | null
mailer_subjects_recovery?: string | null
mailer_templates_confirmation_content?: string | null
mailer_templates_email_change_content?: string | null
+ mailer_templates_email_changed_notification_content?: string | null
+ mailer_templates_identity_linked_notification_content?: string | null
+ mailer_templates_identity_unlinked_notification_content?: string | null
mailer_templates_invite_content?: string | null
mailer_templates_magic_link_content?: string | null
+ mailer_templates_mfa_factor_enrolled_notification_content?: string | null
+ mailer_templates_mfa_factor_unenrolled_notification_content?: string | null
+ mailer_templates_password_changed_notification_content?: string | null
+ mailer_templates_phone_changed_notification_content?: string | null
mailer_templates_reauthentication_content?: string | null
mailer_templates_recovery_content?: string | null
mfa_max_enrolled_factors?: number | null
diff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.ts
index c9740d003ab..924e77e68b3 100644
--- a/packages/api-types/types/platform.d.ts
+++ b/packages/api-types/types/platform.d.ts
@@ -1679,6 +1679,23 @@ export interface paths {
patch?: never
trace?: never
}
+ '/platform/organizations/{slug}/usage/daily': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ /** Gets daily aggregated usage stats */
+ get: operations['OrgUsageController_getDailyOrgUsage']
+ put?: never
+ post?: never
+ delete?: never
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
'/platform/organizations/cloud-marketplace': {
parameters: {
query?: never
@@ -3124,6 +3141,63 @@ export interface paths {
patch?: never
trace?: never
}
+ '/platform/projects/{ref}/privatelink/associations': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ /** Get AWS accounts attached to PrivateLink share for the project. */
+ get: operations['ProjectPrivateLinkController_getPrivateLink']
+ put?: never
+ post?: never
+ delete?: never
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
+ '/platform/projects/{ref}/privatelink/associations/aws-account': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ get?: never
+ put?: never
+ /**
+ * Add AWS account to PrivateLink share for the project
+ * @description Add an AWS account to the project's PrivateLink configuration. Creates middleware entry and manages AWS resources.
+ */
+ post: operations['ProjectPrivateLinkController_addAwsAccountToPrivateLink']
+ delete?: never
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
+ '/platform/projects/{ref}/privatelink/associations/aws-account/{aws_account_id}': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ get?: never
+ put?: never
+ post?: never
+ /**
+ * Remove AWS account from PrivateLink share for the project
+ * @description Removes an AWS account from the project's PrivateLink configuration. Cleans up associated AWS resources.
+ */
+ delete: operations['ProjectPrivateLinkController_removeAwsAccountFromPrivateLink']
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
'/platform/projects/{ref}/resize': {
parameters: {
query?: never
@@ -4411,6 +4485,10 @@ export interface components {
scope?: 'V0'
token_alias: string
}
+ AddAwsAccountToPrivateLinkBody: {
+ account_name?: string
+ aws_account_id: string
+ }
AnalyticsResponse: {
error?:
| string
@@ -5849,6 +5927,35 @@ export interface components {
max_rows: number
role_claim_key: string
}
+ GetPrivateLinkResponse: {
+ private_link_associations: {
+ account_name?: string
+ aws_account_id: string
+ /**
+ * Format: date-time
+ * @description The time and date at which the AWS Resource Share Association was requested from Supabase. `null` means that the association was not yet requested while the PrivateLink Association is pending.
+ */
+ shared_at: string | null
+ /**
+ * @description
+ * - `CREATING`: The PrivateLink resources and the Association are in the process of being created. The PrivateLink Share cannot be accepted yet.
+ * - `READY`: The PrivateLink resources have been created and the PrivateLink Share can be accepted for the duration of 12h after sharing. See `shared_at`.
+ * - `ASSOCIATION_REQUEST_EXPIRED`: The PrivateLink Share has not been accepted within the 12h time limit. This association can now be deleted.
+ * - `ASSOCIATION_ACCEPTED`: The PrivateLink Share was successfully accepted.
+ * - `CREATION_FAILED`: The PrivateLink resources failed to create. This likely means something went wrong on Supabase's and and support should be contacted.
+ * - `DELETING`: The PrivateLink resources and the Association are in the process of being deleted. The PrivateLink Share cannot be accepted yet.
+ *
+ * @enum {string}
+ */
+ status:
+ | 'CREATING'
+ | 'READY'
+ | 'ASSOCIATION_REQUEST_EXPIRED'
+ | 'ASSOCIATION_ACCEPTED'
+ | 'CREATION_FAILED'
+ | 'DELETING'
+ }[]
+ }
GetProjectByFlyExtensionIdResponse: {
ref: string
}
@@ -6385,19 +6492,40 @@ export interface components {
JWT_EXP: number
MAILER_ALLOW_UNVERIFIED_EMAIL_SIGN_INS: boolean
MAILER_AUTOCONFIRM: boolean
+ MAILER_NOTIFICATIONS_EMAIL_CHANGED_ENABLED: boolean
+ MAILER_NOTIFICATIONS_IDENTITY_LINKED_ENABLED: boolean
+ MAILER_NOTIFICATIONS_IDENTITY_UNLINKED_ENABLED: boolean
+ MAILER_NOTIFICATIONS_MFA_FACTOR_ENROLLED_ENABLED: boolean
+ MAILER_NOTIFICATIONS_MFA_FACTOR_UNENROLLED_ENABLED: boolean
+ MAILER_NOTIFICATIONS_PASSWORD_CHANGED_ENABLED: boolean
+ MAILER_NOTIFICATIONS_PHONE_CHANGED_ENABLED: boolean
MAILER_OTP_EXP: number
MAILER_OTP_LENGTH: number
MAILER_SECURE_EMAIL_CHANGE_ENABLED: boolean
MAILER_SUBJECTS_CONFIRMATION: string
MAILER_SUBJECTS_EMAIL_CHANGE: string
+ MAILER_SUBJECTS_EMAIL_CHANGED_NOTIFICATION: string
+ MAILER_SUBJECTS_IDENTITY_LINKED_NOTIFICATION: string
+ MAILER_SUBJECTS_IDENTITY_UNLINKED_NOTIFICATION: string
MAILER_SUBJECTS_INVITE: string
MAILER_SUBJECTS_MAGIC_LINK: string
+ MAILER_SUBJECTS_MFA_FACTOR_ENROLLED_NOTIFICATION: string
+ MAILER_SUBJECTS_MFA_FACTOR_UNENROLLED_NOTIFICATION: string
+ MAILER_SUBJECTS_PASSWORD_CHANGED_NOTIFICATION: string
+ MAILER_SUBJECTS_PHONE_CHANGED_NOTIFICATION: string
MAILER_SUBJECTS_REAUTHENTICATION: string
MAILER_SUBJECTS_RECOVERY: string
MAILER_TEMPLATES_CONFIRMATION_CONTENT: string
MAILER_TEMPLATES_EMAIL_CHANGE_CONTENT: string
+ MAILER_TEMPLATES_EMAIL_CHANGED_NOTIFICATION_CONTENT: string
+ MAILER_TEMPLATES_IDENTITY_LINKED_NOTIFICATION_CONTENT: string
+ MAILER_TEMPLATES_IDENTITY_UNLINKED_NOTIFICATION_CONTENT: string
MAILER_TEMPLATES_INVITE_CONTENT: string
MAILER_TEMPLATES_MAGIC_LINK_CONTENT: string
+ MAILER_TEMPLATES_MFA_FACTOR_ENROLLED_NOTIFICATION_CONTENT: string
+ MAILER_TEMPLATES_MFA_FACTOR_UNENROLLED_NOTIFICATION_CONTENT: string
+ MAILER_TEMPLATES_PASSWORD_CHANGED_NOTIFICATION_CONTENT: string
+ MAILER_TEMPLATES_PHONE_CHANGED_NOTIFICATION_CONTENT: string
MAILER_TEMPLATES_REAUTHENTICATION_CONTENT: string
MAILER_TEMPLATES_RECOVERY_CONTENT: string
MFA_ALLOW_LOW_AAL: boolean
@@ -7035,6 +7163,69 @@ export interface components {
slug: string
usage_billing_enabled: boolean
}
+ OrgDailyUsageResponse: {
+ usages: {
+ breakdown: {
+ egress_function: number
+ egress_graphql: number
+ egress_logdrain: number
+ egress_realtime: number
+ egress_rest: number
+ egress_storage: number
+ egress_supavisor: number
+ } | null
+ date: string
+ /** @enum {string} */
+ metric:
+ | 'EGRESS'
+ | 'CACHED_EGRESS'
+ | 'DATABASE_SIZE'
+ | 'STORAGE_SIZE'
+ | 'MONTHLY_ACTIVE_USERS'
+ | 'MONTHLY_ACTIVE_SSO_USERS'
+ | 'FUNCTION_INVOCATIONS'
+ | 'FUNCTION_CPU_MILLISECONDS'
+ | 'STORAGE_IMAGES_TRANSFORMED'
+ | 'REALTIME_MESSAGE_COUNT'
+ | 'REALTIME_PEAK_CONNECTIONS'
+ | 'DISK_SIZE_GB_HOURS_GP3'
+ | 'DISK_SIZE_GB_HOURS_IO2'
+ | 'AUTH_MFA_PHONE'
+ | 'AUTH_MFA_WEB_AUTHN'
+ | 'LOG_DRAIN_EVENTS'
+ | 'MONTHLY_ACTIVE_THIRD_PARTY_USERS'
+ | 'DISK_THROUGHPUT_GP3'
+ | 'DISK_IOPS_GP3'
+ | 'DISK_IOPS_IO2'
+ | 'COMPUTE_HOURS_BRANCH'
+ | 'COMPUTE_HOURS_XS'
+ | 'COMPUTE_HOURS_SM'
+ | 'COMPUTE_HOURS_MD'
+ | 'COMPUTE_HOURS_L'
+ | 'COMPUTE_HOURS_XL'
+ | 'COMPUTE_HOURS_2XL'
+ | 'COMPUTE_HOURS_4XL'
+ | 'COMPUTE_HOURS_8XL'
+ | 'COMPUTE_HOURS_12XL'
+ | 'COMPUTE_HOURS_16XL'
+ | 'COMPUTE_HOURS_24XL'
+ | 'COMPUTE_HOURS_24XL_OPTIMIZED_CPU'
+ | 'COMPUTE_HOURS_24XL_OPTIMIZED_MEMORY'
+ | 'COMPUTE_HOURS_24XL_HIGH_MEMORY'
+ | 'COMPUTE_HOURS_48XL'
+ | 'COMPUTE_HOURS_48XL_OPTIMIZED_CPU'
+ | 'COMPUTE_HOURS_48XL_OPTIMIZED_MEMORY'
+ | 'COMPUTE_HOURS_48XL_HIGH_MEMORY'
+ | 'CUSTOM_DOMAIN'
+ | 'PITR_7'
+ | 'PITR_14'
+ | 'PITR_28'
+ | 'IPV4'
+ | 'LOG_DRAIN'
+ usage: number
+ usage_original: number
+ }[]
+ }
OrgDocumentUrlResponse: {
fileUrl: string
}
@@ -9187,19 +9378,40 @@ export interface components {
JWT_EXP?: number | null
MAILER_ALLOW_UNVERIFIED_EMAIL_SIGN_INS?: boolean | null
MAILER_AUTOCONFIRM?: boolean | null
+ MAILER_NOTIFICATIONS_EMAIL_CHANGED_ENABLED?: boolean | null
+ MAILER_NOTIFICATIONS_IDENTITY_LINKED_ENABLED?: boolean | null
+ MAILER_NOTIFICATIONS_IDENTITY_UNLINKED_ENABLED?: boolean | null
+ MAILER_NOTIFICATIONS_MFA_FACTOR_ENROLLED_ENABLED?: boolean | null
+ MAILER_NOTIFICATIONS_MFA_FACTOR_UNENROLLED_ENABLED?: boolean | null
+ MAILER_NOTIFICATIONS_PASSWORD_CHANGED_ENABLED?: boolean | null
+ MAILER_NOTIFICATIONS_PHONE_CHANGED_ENABLED?: boolean | null
MAILER_OTP_EXP?: number
MAILER_OTP_LENGTH?: number | null
MAILER_SECURE_EMAIL_CHANGE_ENABLED?: boolean | null
MAILER_SUBJECTS_CONFIRMATION?: string | null
MAILER_SUBJECTS_EMAIL_CHANGE?: string | null
+ MAILER_SUBJECTS_EMAIL_CHANGED_NOTIFICATION?: string | null
+ MAILER_SUBJECTS_IDENTITY_LINKED_NOTIFICATION?: string | null
+ MAILER_SUBJECTS_IDENTITY_UNLINKED_NOTIFICATION?: string | null
MAILER_SUBJECTS_INVITE?: string | null
MAILER_SUBJECTS_MAGIC_LINK?: string | null
+ MAILER_SUBJECTS_MFA_FACTOR_ENROLLED_NOTIFICATION?: string | null
+ MAILER_SUBJECTS_MFA_FACTOR_UNENROLLED_NOTIFICATION?: string | null
+ MAILER_SUBJECTS_PASSWORD_CHANGED_NOTIFICATION?: string | null
+ MAILER_SUBJECTS_PHONE_CHANGED_NOTIFICATION?: string | null
MAILER_SUBJECTS_REAUTHENTICATION?: string | null
MAILER_SUBJECTS_RECOVERY?: string | null
MAILER_TEMPLATES_CONFIRMATION_CONTENT?: string | null
MAILER_TEMPLATES_EMAIL_CHANGE_CONTENT?: string | null
+ MAILER_TEMPLATES_EMAIL_CHANGED_NOTIFICATION_CONTENT?: string | null
+ MAILER_TEMPLATES_IDENTITY_LINKED_NOTIFICATION_CONTENT?: string | null
+ MAILER_TEMPLATES_IDENTITY_UNLINKED_NOTIFICATION_CONTENT?: string | null
MAILER_TEMPLATES_INVITE_CONTENT?: string | null
MAILER_TEMPLATES_MAGIC_LINK_CONTENT?: string | null
+ MAILER_TEMPLATES_MFA_FACTOR_ENROLLED_NOTIFICATION_CONTENT?: string | null
+ MAILER_TEMPLATES_MFA_FACTOR_UNENROLLED_NOTIFICATION_CONTENT?: string | null
+ MAILER_TEMPLATES_PASSWORD_CHANGED_NOTIFICATION_CONTENT?: string | null
+ MAILER_TEMPLATES_PHONE_CHANGED_NOTIFICATION_CONTENT?: string | null
MAILER_TEMPLATES_REAUTHENTICATION_CONTENT?: string | null
MAILER_TEMPLATES_RECOVERY_CONTENT?: string | null
MFA_ALLOW_LOW_AAL?: boolean | null
@@ -10320,6 +10532,13 @@ export interface operations {
| 'magic-link'
| 'recovery'
| 'reauthentication'
+ | 'password-changed-notification'
+ | 'email-changed-notification'
+ | 'phone-changed-notification'
+ | 'mfa-factor-enrolled-notification'
+ | 'mfa-factor-unenrolled-notification'
+ | 'identity-linked-notification'
+ | 'identity-unlinked-notification'
}
cookie?: never
}
@@ -15437,6 +15656,61 @@ export interface operations {
}
}
}
+ OrgUsageController_getDailyOrgUsage: {
+ parameters: {
+ query?: {
+ apikey?: string
+ end?: string
+ project_ref?: string
+ start?: string
+ }
+ header?: never
+ path: {
+ /** @description Organization slug */
+ slug: string
+ }
+ cookie?: never
+ }
+ requestBody?: never
+ responses: {
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content: {
+ 'application/json': components['schemas']['OrgDailyUsageResponse']
+ }
+ }
+ /** @description Unauthorized */
+ 401: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Forbidden action */
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Rate limit exceeded */
+ 429: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to get usage stats */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
OrganizationsController_createAwsBilledOrganization: {
parameters: {
query?: never
@@ -21484,7 +21758,6 @@ export interface operations {
| 'total_func_invocations'
| 'total_func_cpu_time_ms'
endDate: string
- interval?: string
startDate: string
}
header?: never
@@ -22472,6 +22745,173 @@ export interface operations {
}
}
}
+ ProjectPrivateLinkController_getPrivateLink: {
+ parameters: {
+ query?: never
+ header?: never
+ path: {
+ /** @description Project ref */
+ ref: string
+ }
+ cookie?: never
+ }
+ requestBody?: never
+ responses: {
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content: {
+ 'application/json': components['schemas']['GetPrivateLinkResponse']
+ }
+ }
+ /** @description Unauthorized */
+ 401: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Forbidden action */
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Rate limit exceeded */
+ 429: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to retrieve AWS accounts from privateLink middleware */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
+ ProjectPrivateLinkController_addAwsAccountToPrivateLink: {
+ parameters: {
+ query?: never
+ header?: never
+ path: {
+ /** @description Project ref */
+ ref: string
+ }
+ cookie?: never
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['AddAwsAccountToPrivateLinkBody']
+ }
+ }
+ responses: {
+ /** @description Scheduled AWS PrivateLink resources to be created. */
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description AWS PrivateLink is not available for the current billing plan. */
+ 400: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Unauthorized */
+ 401: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Forbidden action */
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Rate limit exceeded */
+ 429: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to add AWS account to PrivateLink share */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
+ ProjectPrivateLinkController_removeAwsAccountFromPrivateLink: {
+ parameters: {
+ query?: never
+ header?: never
+ path: {
+ aws_account_id: string
+ /** @description Project ref */
+ ref: string
+ }
+ cookie?: never
+ }
+ requestBody?: never
+ responses: {
+ /** @description Scheduled AWS PrivateLink resources to be removed. */
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Invalid AWS account ID format or association does not have a valid status for deletion. */
+ 400: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Unauthorized */
+ 401: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Forbidden action */
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Rate limit exceeded */
+ 429: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to remove AWS account from PrivateLink share */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
ResizeController_resizeDatabase: {
parameters: {
query?: never