Skip to content

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

feat: more charts, use functions.combined-stats (#38128)

Ziinc2049e75c1d50
diff --git a/apps/studio/components/ui/Charts/StackedBarChart.tsx b/apps/studio/components/ui/Charts/StackedBarChart.tsx
index ac12386f3b2..4d362d9b25d 100644
--- a/apps/studio/components/ui/Charts/StackedBarChart.tsx
+++ b/apps/studio/components/ui/Charts/StackedBarChart.tsx
@@ -80,7 +80,17 @@ const StackedBarChart: React.FC<Props> = ({
const resolvedHighlightedValue =
focusDataIndex !== null ? data[focusDataIndex]?.[yAxisKey] : highlightedValue
- if (!data || data.length === 0) return <NoDataPlaceholder size={size} />
+ if (!data || data.length === 0) {
+ return (
+ <NoDataPlaceholder
+ description="It may take up to 24 hours for data to refresh"
+ size={size}
+ attribute={title}
+ format={format}
+ />
+ )
+ }
+
const stackColorScales = genStackColorScales(stackColors)
return (
<div className="w-full">
diff --git a/apps/studio/data/analytics/functions-combined-stats-query.ts b/apps/studio/data/analytics/functions-combined-stats-query.ts
new file mode 100644
index 00000000000..edb4c095162
--- /dev/null
+++ b/apps/studio/data/analytics/functions-combined-stats-query.ts
@@ -0,0 +1,70 @@
+import { useQuery, UseQueryOptions } from '@tanstack/react-query'
+import { operations } from 'api-types'
+import { get, handleError } from 'data/fetchers'
+import { analyticsKeys } from './keys'
+
+export type FunctionsCombinedStatsVariables = {
+ projectRef?: string
+ functionId?: string
+ interval?: operations['FunctionsLogsController_getCombinedStats']['parameters']['query']['interval']
+}
+
+export type FunctionsCombinedStatsResponse = any
+
+export async function getFunctionsCombinedStats(
+ { projectRef, functionId, interval }: FunctionsCombinedStatsVariables,
+ signal?: AbortSignal
+) {
+ if (!projectRef) {
+ throw new Error('projectRef is required')
+ }
+ if (!functionId) {
+ throw new Error('functionId is required')
+ }
+ if (!interval) {
+ throw new Error('interval is required')
+ }
+
+ const { data, error } = await get(
+ '/platform/projects/{ref}/analytics/endpoints/functions.combined-stats',
+ {
+ params: {
+ path: {
+ ref: projectRef,
+ },
+ query: {
+ function_id: functionId,
+ interval,
+ },
+ },
+ signal,
+ }
+ )
+
+ if (error) handleError(error)
+
+ return data
+}
+
+export type FunctionsCombinedStatsData = Awaited<ReturnType<typeof getFunctionsCombinedStats>>
+export type FunctionsCombinedStatsError = unknown
+
+export const useFunctionsCombinedStatsQuery = <TData = FunctionsCombinedStatsData>(
+ { projectRef, functionId, interval }: FunctionsCombinedStatsVariables,
+ {
+ enabled = true,
+ ...options
+ }: UseQueryOptions<FunctionsCombinedStatsData, FunctionsCombinedStatsError, TData> = {}
+) =>
+ useQuery<FunctionsCombinedStatsData, FunctionsCombinedStatsError, TData>(
+ analyticsKeys.functionsCombinedStats(projectRef, { functionId, interval }),
+ ({ signal }) => getFunctionsCombinedStats({ projectRef, functionId, interval }, signal),
+ {
+ enabled:
+ enabled &&
+ typeof projectRef !== 'undefined' &&
+ typeof functionId !== 'undefined' &&
+ typeof interval !== 'undefined',
+ ...options,
+ }
+ )
diff --git a/apps/studio/data/analytics/keys.ts b/apps/studio/data/analytics/keys.ts
index fa77be8e2c4..17e8d7ce14c 100644
--- a/apps/studio/data/analytics/keys.ts
+++ b/apps/studio/data/analytics/keys.ts
@@ -1,5 +1,24 @@
export const analyticsKeys = {
// logs/reports endpoints
+ functionsCombinedStats: (
+ projectRef: string | undefined,
+ {
+ interval,
+ functionId,
+ }: {
+ functionId: string | undefined
+ interval: string | undefined
+ }
+ ) =>
+ [
+ 'projects',
+ projectRef,
+ 'functions-combined-stats',
+ {
+ interval,
+ functionId,
+ },
+ ] as const,
functionsInvStats: (
projectRef: string | undefined,
{
diff --git a/apps/studio/pages/project/[ref]/functions/[functionSlug]/index.tsx b/apps/studio/pages/project/[ref]/functions/[functionSlug]/index.tsx
index dc375da3456..dc9cd65fb22 100644
--- a/apps/studio/pages/project/[ref]/functions/[functionSlug]/index.tsx
+++ b/apps/studio/pages/project/[ref]/functions/[functionSlug]/index.tsx
@@ -1,6 +1,7 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useParams } from 'common'
import dayjs, { Dayjs } from 'dayjs'
+import maxBy from 'lodash/maxBy'
import meanBy from 'lodash/meanBy'
import sumBy from 'lodash/sumBy'
import { useRouter } from 'next/router'
@@ -13,13 +14,9 @@ import AreaChart from 'components/ui/Charts/AreaChart'
import StackedBarChart from 'components/ui/Charts/StackedBarChart'
import NoPermission from 'components/ui/NoPermission'
import {
- FunctionsReqStatsVariables,
- useFunctionsReqStatsQuery,
-} from 'data/analytics/functions-req-stats-query'
-import {
- FunctionsResourceUsageVariables,
- useFunctionsResourceUsageQuery,
-} from 'data/analytics/functions-resource-usage-query'
+ FunctionsCombinedStatsVariables,
+ useFunctionsCombinedStatsQuery,
+} from 'data/analytics/functions-combined-stats-query'
import { useEdgeFunctionQuery } from 'data/edge-functions/edge-function-query'
import { useFillTimeseriesSorted } from 'hooks/analytics/useFillTimeseriesSorted'
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
@@ -31,6 +28,7 @@ import {
Button,
WarningIcon,
} from 'ui'
+import { useFlag } from 'common'
const CHART_INTERVALS: ChartIntervals[] = [
{
@@ -47,6 +45,13 @@ const CHART_INTERVALS: ChartIntervals[] = [
startUnit: 'hour',
format: 'MMM D, h:mma',
},
+ {
+ key: '3hr',
+ label: '3 hours',
+ startValue: 3,
+ startUnit: 'hour',
+ format: 'MMM D, h:mma',
+ },
{
key: '1day',
label: '1 day',
@@ -54,18 +59,12 @@ const CHART_INTERVALS: ChartIntervals[] = [
startUnit: 'hour',
format: 'MMM D, h:mma',
},
- // {
- // key: '7day',
- // label: '7 days',
- // startValue: 7,
- // startUnit: 'day',
- // format: 'MMM D',
- // },
]
const PageLayout: NextPageWithLayout = () => {
const router = useRouter()
const { ref: projectRef, functionSlug } = useParams()
+ const newChartsEnabled = useFlag('newEdgeFunctionOverviewCharts')
const [interval, setInterval] = useState<string>('15min')
const selectedInterval = CHART_INTERVALS.find((i) => i.key === interval) || CHART_INTERVALS[1]
const { data: selectedFunction } = useEdgeFunctionQuery({
@@ -73,26 +72,16 @@ const PageLayout: NextPageWithLayout = () => {
slug: functionSlug,
})
const id = selectedFunction?.id
- const reqStatsResult = useFunctionsReqStatsQuery({
+ const combinedStatsResults = useFunctionsCombinedStatsQuery({
projectRef,
functionId: id,
- interval: selectedInterval.key as FunctionsReqStatsVariables['interval'],
+ interval: selectedInterval.key as FunctionsCombinedStatsVariables['interval'],
})
- const resourceUsageResult = useFunctionsResourceUsageQuery({
- projectRef,
- functionId: id,
- interval: selectedInterval.key as FunctionsResourceUsageVariables['interval'],
- })
-
- const reqStatsData = useMemo(() => {
- const result = reqStatsResult.data?.result
+ const combinedStatsData = useMemo(() => {
+ const result = combinedStatsResults.data?.result
return result || []
- }, [reqStatsResult.data])
-
- const resourceUsageData = useMemo(() => {
- return resourceUsageResult.data?.result || []
- }, [resourceUsageResult.data])
+ }, [combinedStatsResults.data])
const [startDate, endDate]: [Dayjs, Dayjs] = useMemo(() => {
const start = dayjs()
@@ -104,39 +93,30 @@ const PageLayout: NextPageWithLayout = () => {
}, [selectedInterval])
const {
- data: execTimeChartData,
- error: execTimeError,
- isError: isErrorExecTime,
+ data: combinedStatsChartData,
+ error: combinedStatsError,
+ isError: isErrorCombinedStats,
} = useFillTimeseriesSorted(
- reqStatsData,
+ combinedStatsData,
'timestamp',
- ['avg_execution_time'],
- 0,
- startDate.toISOString(),
- endDate.toISOString()
- )
-
- const {
- data: invocationsChartData,
- error: invocationsError,
- isError: isErrorInvocations,
- } = useFillTimeseriesSorted(
- reqStatsData,
- 'timestamp',
- ['count', 'success_count', 'redirect_count', 'client_err_count', 'server_err_count'],
- 0,
- startDate.toISOString(),
- endDate.toISOString()
- )
-
- const {
- data: resourceUsageChartData,
- error: resourceUsageError,
- isError: isErrorResourceUsage,
- } = useFillTimeseriesSorted(
- resourceUsageData,
- 'timestamp',
- ['avg_cpu_time_used', 'avg_memory_used'],
+ [
+ 'requests_count',
+ 'log_count',
+ 'log_info_count',
+ 'log_warn_count',
+ 'log_error_count',
+ 'success_count',
+ 'redirect_count',
+ 'client_err_count',
+ 'server_err_count',
+ 'avg_cpu_time_used',
+ 'avg_memory_used',
+ 'avg_execution_time',
+ 'max_execution_time',
+ 'avg_heap_memory_used',
+ 'avg_external_memory_used',
+ 'max_cpu_time_used',
+ ],
0,
startDate.toISOString(),
endDate.toISOString()
@@ -151,7 +131,7 @@ const PageLayout: NextPageWithLayout = () => {
}
return (
- <div className="px-6 w-full pt-6">
+ <div className="px-6 w-full py-6">
<div className="space-y-6">
<div className="flex flex-row items-center gap-2">
<div className="flex items-center">
@@ -188,45 +168,65 @@ const PageLayout: NextPageWithLayout = () => {
<ReportWidget
title="Execution time"
tooltip="Average execution time of function invocations"
- data={execTimeChartData}
- isLoading={reqStatsResult.isLoading}
+ data={combinedStatsChartData}
+ isLoading={combinedStatsResults.isLoading}
renderer={(props) => {
- return isErrorExecTime ? (
+ return isErrorCombinedStats ? (
<Alert_Shadcn_ variant="warning">
<WarningIcon />
<AlertTitle_Shadcn_>Failed to reterieve execution time</AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>{execTimeError.message}</AlertDescription_Shadcn_>
+ <AlertDescription_Shadcn_>
+ {combinedStatsError.message}
+ </AlertDescription_Shadcn_>
</Alert_Shadcn_>
) : (
- <AreaChart
- className="w-full"
- xAxisKey="timestamp"
- customDateFormat={selectedInterval.format}
- yAxisKey="avg_execution_time"
- data={props.data}
- format="ms"
- highlightedValue={meanBy(props.data, 'avg_execution_time')}
- />
+ <div className="space-y-8">
+ <AreaChart
+ title="Average execution time"
+ className="w-full"
+ xAxisKey="timestamp"
+ customDateFormat={selectedInterval.format}
+ yAxisKey="avg_execution_time"
+ data={props.data}
+ format="ms"
+ highlightedValue={meanBy(props.data, 'avg_execution_time')}
+ />
+ {newChartsEnabled && (
+ <AreaChart
+ title="Max execution time"
+ className="w-full"
+ xAxisKey="timestamp"
+ customDateFormat={selectedInterval.format}
+ yAxisKey="max_execution_time"
+ data={props.data}
+ format="ms"
+ highlightedValue={
+ maxBy(props.data, 'max_execution_time')?.max_execution_time
+ }
+ />
+ )}
+ </div>
)
}}
/>
<ReportWidget
title="Invocations"
- data={invocationsChartData}
- isLoading={reqStatsResult.isLoading}
+ tooltip="Requests made to a function are considered invocations, and each invocation may have worker logs."
+ data={combinedStatsChartData}
+ isLoading={combinedStatsResults.isLoading}
renderer={(props) => {
- if (isErrorInvocations) {
+ if (isErrorCombinedStats) {
return (
<Alert_Shadcn_ variant="warning">
<WarningIcon />
<AlertTitle_Shadcn_>Failed to reterieve invocations</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
- {invocationsError.message}
+ {combinedStatsError.message}
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)
} else {
- const data = props.data
+ const requestData = props.data
.map((d: any) => [
{
status: '2xx',
@@ -251,22 +251,63 @@ const PageLayout: NextPageWithLayout = () => {
])
.flat()
+ const logsData = props.data
+ .map((d: any) => [
+ {
+ status: 'error',
+ count: d.log_error_count,
+ timestamp: d.timestamp,
+ },
+ {
+ status: 'info',
+ count: d.log_info_count,
+ timestamp: d.timestamp,
+ },
+ {
+ status: 'warn',
+ count: d.log_warn_count,
+ timestamp: d.timestamp,
+ },
+ ])
+ .flat()
+
return (
- <StackedBarChart
- className="w-full"
- xAxisKey="timestamp"
- yAxisKey="count"
- stackKey="status"
- data={data}
- highlightedValue={sumBy(data, 'count')}
- customDateFormat={selectedInterval.format}
- stackColors={['brand', 'slate', 'yellow', 'red']}
- onBarClick={() => {
- router.push(
- `/project/${projectRef}/functions/${functionSlug}/invocations?its=${startDate.toISOString()}`
- )
- }}
- />
+ <div className="space-y-8">
+ <StackedBarChart
+ title="Invocation Requests"
+ className="w-full"
+ xAxisKey="timestamp"
+ yAxisKey="count"
+ stackKey="status"
+ data={requestData}
+ highlightedValue={sumBy(requestData, 'count')}
+ customDateFormat={selectedInterval.format}
+ stackColors={['brand', 'slate', 'yellow', 'red']}
+ onBarClick={() => {
+ router.push(
+ `/project/${projectRef}/functions/${functionSlug}/invocations?its=${startDate.toISOString()}`
+ )
+ }}
+ />
+ {newChartsEnabled && (
+ <StackedBarChart
+ title="Worker Logs"
+ className="w-full"
+ xAxisKey="timestamp"
+ yAxisKey="count"
+ stackKey="status"
+ data={logsData}
+ highlightedValue={sumBy(logsData, 'count')}
+ customDateFormat={selectedInterval.format}
+ stackColors={['red', 'brand', 'yellow']}
+ onBarClick={() => {
+ router.push(
+ `/project/${projectRef}/functions/${functionSlug}/logs?its=${startDate.toISOString()}`
+ )
+ }}
+ />
+ )}
+ </div>
)
}
}}
@@ -274,54 +315,105 @@ const PageLayout: NextPageWithLayout = () => {
<ReportWidget
title="CPU time"
tooltip="Average CPU time usage for the function"
- data={resourceUsageChartData}
- isLoading={resourceUsageResult.isLoading}
+ data={combinedStatsChartData}
+ isLoading={combinedStatsResults.isLoading}
renderer={(props) => {
- return isErrorResourceUsage ? (
+ return isErrorCombinedStats ? (
<Alert_Shadcn_ variant="warning">
<WarningIcon />
<AlertTitle_Shadcn_>Failed to retrieve CPU time</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
- {resourceUsageError.message}
+ {combinedStatsError.message}
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
) : (
- <AreaChart
- className="w-full"
- xAxisKey="timestamp"
- customDateFormat={selectedInterval.format}
- yAxisKey="avg_cpu_time_used"
- data={props.data}
- format="ms"
- highlightedValue={meanBy(props.data, 'avg_cpu_time_used')}
- />
+ <div className="space-y-8">
+ <AreaChart
+ title="Average CPU Time"
+ className="w-full"
+ xAxisKey="timestamp"
+ customDateFormat={selectedInterval.format}
+ yAxisKey="avg_cpu_time_used"
+ data={props.data}
+ format="ms"
+ highlightedValue={meanBy(props.data, 'avg_cpu_time_used')}
+ />
+ {newChartsEnabled && (
+ <AreaChart
+ title="Max CPU Time"
+ className="w-full"
+ xAxisKey="timestamp"
+ customDateFormat={selectedInterval.format}
+ yAxisKey="max_cpu_time_used"
+ data={props.data}
+ format="ms"
+ highlightedValue={maxBy(props.data, 'max_cpu_time_used')?.max_cpu_time_used}
+ />
+ )}
+ </div>
)
}}
/>
<ReportWidget
title="Memory"
tooltip="Average memory usage for the function"
- data={resourceUsageChartData}
- isLoading={resourceUsageResult.isLoading}
+ data={combinedStatsChartData}
+ isLoading={combinedStatsResults.isLoading}
renderer={(props) => {
- return isErrorResourceUsage ? (
- <Alert_Shadcn_ variant="warning">
- <WarningIcon />
- <AlertTitle_Shadcn_>Failed to retrieve memory usage</AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- {resourceUsageError.message}
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- ) : (
- <AreaChart
- className="w-full"
- xAxisKey="timestamp"
- customDateFormat={selectedInterval.format}
- yAxisKey="avg_memory_used"
- data={props.data}
- format="MB"
- highlightedValue={meanBy(props.data, 'avg_memory_used')}
- />
+ if (isErrorCombinedStats) {
+ return (
+ <Alert_Shadcn_ variant="warning">
+ <WarningIcon />
+ <AlertTitle_Shadcn_>Failed to retrieve memory usage</AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ {combinedStatsError.message}
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+ )
+ }
+
+ const memoryData = props.data
+ .map((d: any) => [
+ {
+ type: 'heap',
+ count: d.avg_heap_memory_used,
+ timestamp: d.timestamp,
+ },
+ {
+ type: 'external',
+ count: d.avg_external_memory_used,
+ timestamp: d.timestamp,
+ },
+ ])
+ .flat()
+
+ return (
+ <div className="space-y-8">
+ <AreaChart
+ title="Average Memory Usage"
+ className="w-full"
+ xAxisKey="timestamp"
+ customDateFormat={selectedInterval.format}
+ yAxisKey="avg_memory_used"
+ data={props.data}
+ format="MB"
+ highlightedValue={meanBy(props.data, 'avg_memory_used')}
+ />
+ {newChartsEnabled && (
+ <StackedBarChart
+ title="Average Memory Usage by Type"
+ className="w-full"
+ xAxisKey="timestamp"
+ yAxisKey="count"
+ stackKey="type"
+ format="MB"
+ data={memoryData}
+ highlightedValue={sumBy(memoryData, 'count')}
+ customDateFormat={selectedInterval.format}
+ stackColors={['blue', 'brand']}
+ />
+ )}
+ </div>
)
}}
/>
diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.ts
index 87bbc37c9df..a74db70f9e5 100644
--- a/packages/api-types/types/api.d.ts
+++ b/packages/api-types/types/api.d.ts
@@ -570,6 +570,24 @@ export interface paths {
patch?: never
trace?: never
}
+ '/v1/projects/{ref}/cli/login-role': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ get?: never
+ put?: never
+ /** [Beta] Create a login role for CLI with temporary password */
+ post: operations['v1-create-login-role']
+ /** [Beta] Delete existing login roles used by CLI */
+ delete: operations['v1-delete-login-roles']
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
'/v1/projects/{ref}/config/auth': {
parameters: {
query?: never
@@ -1255,7 +1273,8 @@ export interface paths {
delete?: never
options?: never
head?: never
- patch?: never
+ /** [Alpha] Updates project's network restrictions by adding or removing CIDRs */
+ patch: operations['v1-patch-network-restrictions']
trace?: never
}
'/v1/projects/{ref}/network-restrictions/apply': {
@@ -1494,6 +1513,23 @@ export interface paths {
patch?: never
trace?: never
}
+ '/v1/projects/{ref}/storage/buckets/{id}/objects': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ get?: never
+ put?: never
+ /** Gets list of objects with the given bucket */
+ post: operations['v1-list-storage-objects']
+ delete?: never
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
'/v1/projects/{ref}/types/typescript': {
parameters: {
query?: never
@@ -2104,6 +2140,12 @@ export interface components {
domains?: string[]
metadata_url?: string
metadata_xml?: string
+ /** @enum {string} */
+ name_id_format?:
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
/**
* @description What type of provider will be created
* @enum {string}
@@ -2134,9 +2176,24 @@ export interface components {
id: string
metadata_url?: string
metadata_xml?: string
+ /** @enum {string} */
+ name_id_format?:
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}
updated_at?: string
}
+ CreateRoleBody: {
+ read_only: boolean
+ }
+ CreateRoleResponse: {
+ password: string
+ role: string
+ /** Format: int64 */
+ ttl_seconds: number
+ }
CreateSecretBody: {
/**
* @description Secret name must not start with the SUPABASE_ prefix.
@@ -2248,9 +2305,19 @@ export interface components {
id: string
metadata_url?: string
metadata_xml?: string
+ /** @enum {string} */
+ name_id_format?:
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}
updated_at?: string
}
+ DeleteRolesResponse: {
+ /** @enum {string} */
+ message: 'ok'
+ }
DeployFunctionResponse: {
/** Format: int64 */
created_at?: number
@@ -2357,6 +2424,12 @@ export interface components {
id: string
metadata_url?: string
metadata_xml?: string
+ /** @enum {string} */
+ name_id_format?:
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}
updated_at?: string
}
@@ -2543,6 +2616,12 @@ export interface components {
id: string
metadata_url?: string
metadata_xml?: string
+ /** @enum {string} */
+ name_id_format?:
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}
updated_at?: string
}[]
@@ -2557,11 +2636,23 @@ export interface components {
type: string
}[]
}
+ NetworkRestrictionsPatchRequest: {
+ add?: {
+ dbAllowedCidrs?: string[]
+ dbAllowedCidrsV6?: string[]
+ }
+ remove?: {
+ dbAllowedCidrs?: string[]
+ dbAllowedCidrsV6?: string[]
+ }
+ }
NetworkRestrictionsRequest: {
dbAllowedCidrs?: string[]
dbAllowedCidrsV6?: string[]
}
NetworkRestrictionsResponse: {
+ /** Format: date-time */
+ applied_at?: string
/** @description At any given point in time, this is the config that the user has requested be applied to their project. The `status` field indicates if it has been applied to the project, or is pending. When an updated config is received, the applied config is moved to `old_config`. */
config: {
dbAllowedCidrs?: string[]
@@ -2576,6 +2667,34 @@ export interface components {
}
/** @enum {string} */
status: 'stored' | 'applied'
+ /** Format: date-time */
+ updated_at?: string
+ }
+ NetworkRestrictionsV2Response: {
+ /** Format: date-time */
+ applied_at?: string
+ /** @description At any given point in time, this is the config that the user has requested be applied to their project. The `status` field indicates if it has been applied to the project, or is pending. When an updated config is received, the applied config is moved to `old_config`. */
+ config: {
+ dbAllowedCidrs?: {
+ address: string
+ /** @enum {string} */
+ type: 'v4' | 'v6'
+ }[]
+ }
+ /** @enum {string} */
+ entitlement: 'disallowed' | 'allowed'
+ /** @description Populated when a new config has been received, but not registered as successfully applied to a project. */
+ old_config?: {
+ dbAllowedCidrs?: {
+ address: string
+ /** @enum {string} */
+ type: 'v4' | 'v6'
+ }[]
+ }
+ /** @enum {string} */
+ status: 'stored' | 'applied'
+ /** Format: date-time */
+ updated_at?: string
}
OAuthRevokeTokenBody: {
/** Format: uuid */
@@ -3227,6 +3346,12 @@ export interface components {
domains?: string[]
metadata_url?: string
metadata_xml?: string
+ /** @enum {string} */
+ name_id_format?:
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}
UpdateProviderResponse: {
created_at?: string
@@ -3252,6 +3377,12 @@ export interface components {
id: string
metadata_url?: string
metadata_xml?: string
+ /** @enum {string} */
+ name_id_format?:
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
+ | 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
+ | 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
}
updated_at?: string
}
@@ -3437,6 +3568,43 @@ export interface components {
name?: string
version: string
}[]
+ V1ListStorageObjectsBody: {
+ options?: {
+ limit?: number
+ offset?: number
+ search?: string
+ sort_by?: string
+ /** @enum {string} */
+ sort_order?: 'asc' | 'desc'
+ }
+ path?: string
+ }
+ V1ListStorageObjectsResponse: {
+ items: {
+ bucket_id: string
+ buckets: {
+ allowed_mime_types?: string[]
+ created_at: string
+ file_size_limit?: number
+ id: string
+ name: string
+ owner: string
+ public: boolean
+ /** @enum {string} */
+ type?: 'STANDARD' | 'ANALYTICS'
+ updated_at: string
+ }
+ created_at: string
+ id: string
+ last_accessed_at: string
+ metadata: {
+ [key: string]: unknown
+ }
+ name: string
+ owner: string
+ updated_at: string
+ }[]
+ }
V1OrganizationMemberResponse: {
email?: string
mfa_enabled: boolean
@@ -5077,6 +5245,80 @@ export interface operations {
}
}
}
+ 'v1-create-login-role': {
+ parameters: {
+ query?: never
+ header?: never
+ path: {
+ /** @description Project ref */
+ ref: string
+ }
+ cookie?: never
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['CreateRoleBody']
+ }
+ }
+ responses: {
+ 201: {
+ headers: {
+ [name: string]: unknown
+ }
+ content: {
+ 'application/json': components['schemas']['CreateRoleResponse']
+ }
+ }
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to create login role */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
+ 'v1-delete-login-roles': {
+ 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']['DeleteRolesResponse']
+ }
+ }
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to delete login roles */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
'v1-get-auth-service-config': {
parameters: {
query?: never
@@ -7170,6 +7412,45 @@ export interface operations {
}
}
}
+ 'v1-patch-network-restrictions': {
+ parameters: {
+ query?: never
+ header?: never
+ path: {
+ /** @description Project ref */
+ ref: string
+ }
+ cookie?: never
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['NetworkRestrictionsPatchRequest']
+ }
+ }
+ responses: {
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content: {
+ 'application/json': components['schemas']['NetworkRestrictionsV2Response']
+ }
+ }
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to update project network restrictions */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
'v1-update-network-restrictions': {
parameters: {
query?: never
@@ -7823,6 +8104,47 @@ export interface operations {
}
}
}
+ 'v1-list-storage-objects': {
+ parameters: {
+ query?: never
+ header?: never
+ path: {
+ /** @description Storage bucket id */
+ id: string
+ /** @description Project ref */
+ ref: string
+ }
+ cookie?: never
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['V1ListStorageObjectsBody']
+ }
+ }
+ responses: {
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content: {
+ 'application/json': components['schemas']['V1ListStorageObjectsResponse']
+ }
+ }
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to get list of objects with the given bucket */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
'v1-generate-typescript-types': {
parameters: {
query?: {
diff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.ts
index c6fb1f2f00d..d831af5c864 100644
--- a/packages/api-types/types/platform.d.ts
+++ b/packages/api-types/types/platform.d.ts
@@ -6620,6 +6620,7 @@ export interface components {
offset: number
}
projects: {
+ cloud_provider: string
databases: {
cloud_provider: string
disk_last_modified_at?: string
@@ -6668,6 +6669,7 @@ export interface components {
/** @enum {string} */
type: 'PRIMARY' | 'READ_REPLICA'
}[]
+ inserted_at: string
is_branch: boolean
name: string
ref: string
@@ -9244,7 +9246,7 @@ export interface components {
folder_id?: (null | (string | null)) | null
id: string
name: string
- owner_id: number
+ owner_id?: number
project_id?: number
/** @enum {string} */
type: 'sql' | 'report' | 'log_sql'
@@ -13253,6 +13255,10 @@ export interface operations {
search?: string
/** @description Sort order for projects */
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
+ /** @description A comma-separated list of project statuses to filter by.
+ *
+ * The following values are supported: `ACTIVE_HEALTHY`, `INACTIVE`. */
+ statuses?: string
}
header?: never
path: {