The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): private apps ui (#43382)
kemal.eartha9a1326b92e2
diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.constants.ts b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.constants.tsnew file mode 100644index 00000000000..5dbcf8f52fa--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.constants.ts@@ -0,0 +1,403 @@+export interface Permission {+ id: string+ label: string+ description: string+ group: 'organization' | 'project'+}++export const PERMISSIONS: Permission[] = [+ // Organization permissions+ {+ id: 'organizations_read',+ label: 'organizations_read',+ description: 'View organization details',+ group: 'organization',+ },+ {+ id: 'organizations_create',+ label: 'organizations_create',+ description: 'Create organizations',+ group: 'organization',+ },+ {+ id: 'organization_admin_read',+ label: 'organization_admin_read',+ description: 'View organization admin settings',+ group: 'organization',+ },+ {+ id: 'organization_admin_write',+ label: 'organization_admin_write',+ description: 'Manage organization admin settings',+ group: 'organization',+ },+ {+ id: 'members_read',+ label: 'members_read',+ description: 'View organization members',+ group: 'organization',+ },+ {+ id: 'members_write',+ label: 'members_write',+ description: 'Manage organization members',+ group: 'organization',+ },+ {+ id: 'organization_projects_read',+ label: 'organization_projects_read',+ description: 'View organization projects',+ group: 'organization',+ },+ {+ id: 'organization_projects_create',+ label: 'organization_projects_create',+ description: 'Create projects in organization',+ group: 'organization',+ },+ {+ id: 'snippets_read',+ label: 'snippets_read',+ description: 'View SQL snippets',+ group: 'organization',+ },+ {+ id: 'analytics_usage_read',+ label: 'analytics_usage_read',+ description: 'View usage analytics',+ group: 'organization',+ },+ // Project permissions+ {+ id: 'projects_read',+ label: 'projects_read',+ description: 'View project details',+ group: 'project',+ },+ {+ id: 'project_admin_read',+ label: 'project_admin_read',+ description: 'View project admin settings',+ group: 'project',+ },+ {+ id: 'project_admin_write',+ label: 'project_admin_write',+ description: 'Manage project admin settings',+ group: 'project',+ },+ {+ id: 'action_runs_read',+ label: 'action_runs_read',+ description: 'View action runs',+ group: 'project',+ },+ {+ id: 'action_runs_write',+ label: 'action_runs_write',+ description: 'Manage action runs',+ group: 'project',+ },+ {+ id: 'advisors_read',+ label: 'advisors_read',+ description: 'View advisor recommendations',+ group: 'project',+ },+ {+ id: 'analytics_logs_read',+ label: 'analytics_logs_read',+ description: 'View analytics logs',+ group: 'project',+ },+ {+ id: 'api_gateway_keys_read',+ label: 'api_gateway_keys_read',+ description: 'View API gateway keys',+ group: 'project',+ },+ {+ id: 'api_gateway_keys_write',+ label: 'api_gateway_keys_write',+ description: 'Manage API gateway keys',+ group: 'project',+ },+ {+ id: 'auth_config_read',+ label: 'auth_config_read',+ description: 'View auth configuration',+ group: 'project',+ },+ {+ id: 'auth_config_write',+ label: 'auth_config_write',+ description: 'Manage auth settings',+ group: 'project',+ },+ {+ id: 'auth_signing_keys_read',+ label: 'auth_signing_keys_read',+ description: 'View auth signing keys',+ group: 'project',+ },+ {+ id: 'auth_signing_keys_write',+ label: 'auth_signing_keys_write',+ description: 'Manage auth signing keys',+ group: 'project',+ },+ { id: 'backups_read', label: 'backups_read', description: 'View backups', group: 'project' },+ { id: 'backups_write', label: 'backups_write', description: 'Manage backups', group: 'project' },+ {+ id: 'branching_development_read',+ label: 'branching_development_read',+ description: 'View development branches',+ group: 'project',+ },+ {+ id: 'branching_development_create',+ label: 'branching_development_create',+ description: 'Create development branches',+ group: 'project',+ },+ {+ id: 'branching_development_write',+ label: 'branching_development_write',+ description: 'Manage development branches',+ group: 'project',+ },+ {+ id: 'branching_development_delete',+ label: 'branching_development_delete',+ description: 'Delete development branches',+ group: 'project',+ },+ {+ id: 'branching_production_read',+ label: 'branching_production_read',+ description: 'View production branches',+ group: 'project',+ },+ {+ id: 'branching_production_create',+ label: 'branching_production_create',+ description: 'Create production branches',+ group: 'project',+ },+ {+ id: 'branching_production_write',+ label: 'branching_production_write',+ description: 'Manage production branches',+ group: 'project',+ },+ {+ id: 'branching_production_delete',+ label: 'branching_production_delete',+ description: 'Delete production branches',+ group: 'project',+ },+ {+ id: 'custom_domain_read',+ label: 'custom_domain_read',+ description: 'View custom domain settings',+ group: 'project',+ },+ {+ id: 'custom_domain_write',+ label: 'custom_domain_write',+ description: 'Manage custom domain',+ group: 'project',+ },+ {+ id: 'data_api_config_read',+ label: 'data_api_config_read',+ description: 'View Data API configuration',+ group: 'project',+ },+ {+ id: 'data_api_config_write',+ label: 'data_api_config_write',+ description: 'Manage Data API settings',+ group: 'project',+ },+ {+ id: 'database_read',+ label: 'database_read',+ description: 'Read database data',+ group: 'project',+ },+ {+ id: 'database_write',+ label: 'database_write',+ description: 'Write database data',+ group: 'project',+ },+ {+ id: 'database_config_read',+ label: 'database_config_read',+ description: 'View database configuration',+ group: 'project',+ },+ {+ id: 'database_config_write',+ label: 'database_config_write',+ description: 'Manage database settings',+ group: 'project',+ },+ {+ id: 'database_migrations_read',+ label: 'database_migrations_read',+ description: 'View database migrations',+ group: 'project',+ },+ {+ id: 'database_migrations_write',+ label: 'database_migrations_write',+ description: 'Run database migrations',+ group: 'project',+ },+ {+ id: 'database_pooling_config_read',+ label: 'database_pooling_config_read',+ description: 'View connection pooling settings',+ group: 'project',+ },+ {+ id: 'database_pooling_config_write',+ label: 'database_pooling_config_write',+ description: 'Manage connection pooling',+ group: 'project',+ },+ {+ id: 'database_ssl_config_read',+ label: 'database_ssl_config_read',+ description: 'View SSL configuration',+ group: 'project',+ },+ {+ id: 'database_ssl_config_write',+ label: 'database_ssl_config_write',+ description: 'Manage SSL settings',+ group: 'project',+ },+ {+ id: 'database_webhooks_config_read',+ label: 'database_webhooks_config_read',+ description: 'View database webhooks',+ group: 'project',+ },+ {+ id: 'database_webhooks_config_write',+ label: 'database_webhooks_config_write',+ description: 'Manage database webhooks',+ group: 'project',+ },+ {+ id: 'edge_functions_read',+ label: 'edge_functions_read',+ description: 'View Edge Functions',+ group: 'project',+ },+ {+ id: 'edge_functions_write',+ label: 'edge_functions_write',+ description: 'Deploy and manage Edge Functions',+ group: 'project',+ },+ {+ id: 'edge_functions_secrets_read',+ label: 'edge_functions_secrets_read',+ description: 'View Edge Function secrets',+ group: 'project',+ },+ {+ id: 'edge_functions_secrets_write',+ label: 'edge_functions_secrets_write',+ description: 'Manage Edge Function secrets',+ group: 'project',+ },+ {+ id: 'infra_add_ons_read',+ label: 'infra_add_ons_read',+ description: 'View infrastructure add-ons',+ group: 'project',+ },+ {+ id: 'infra_add_ons_write',+ label: 'infra_add_ons_write',+ description: 'Manage infrastructure add-ons',+ group: 'project',+ },+ {+ id: 'infra_disk_config_read',+ label: 'infra_disk_config_read',+ description: 'View disk configuration',+ group: 'project',+ },+ {+ id: 'infra_disk_config_write',+ label: 'infra_disk_config_write',+ description: 'Manage disk settings',+ group: 'project',+ },+ {+ id: 'infra_read_replicas_read',+ label: 'infra_read_replicas_read',+ description: 'View read replicas',+ group: 'project',+ },+ {+ id: 'infra_read_replicas_write',+ label: 'infra_read_replicas_write',+ description: 'Manage read replicas',+ group: 'project',+ },+ {+ id: 'project_snippets_read',+ label: 'project_snippets_read',+ description: 'View project SQL snippets',+ group: 'project',+ },+ {+ id: 'project_snippets_write',+ label: 'project_snippets_write',+ description: 'Manage project SQL snippets',+ group: 'project',+ },+ {+ id: 'storage_read',+ label: 'storage_read',+ description: 'Read storage objects',+ group: 'project',+ },+ {+ id: 'storage_write',+ label: 'storage_write',+ description: 'Write storage objects',+ group: 'project',+ },+ {+ id: 'storage_config_read',+ label: 'storage_config_read',+ description: 'View storage configuration',+ group: 'project',+ },+ {+ id: 'storage_config_write',+ label: 'storage_config_write',+ description: 'Manage storage settings',+ group: 'project',+ },+ {+ id: 'vanity_subdomain_read',+ label: 'vanity_subdomain_read',+ description: 'View vanity subdomain settings',+ group: 'project',+ },+ {+ id: 'vanity_subdomain_write',+ label: 'vanity_subdomain_write',+ description: 'Manage vanity subdomain',+ group: 'project',+ },+]diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.types.ts b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.types.tsnew file mode 100644index 00000000000..9764f074cd7--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.types.ts@@ -0,0 +1 @@+export type AppsSort = 'created_at:asc' | 'created_at:desc'diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.utils.test.ts b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.utils.test.tsnew file mode 100644index 00000000000..57dadb6f801--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.utils.test.ts@@ -0,0 +1,56 @@+import { describe, expect, it, vi } from 'vitest'+import type { PrivateApp } from '../PrivateApps.types'+import type { AppsSort } from './Apps.types'+import { handleSortChange, sortApps } from './Apps.utils'++describe('handleSortChange', () => {+ it('toggles from asc to desc when clicking the same column', () => {+ const setSort = vi.fn()+ handleSortChange('created_at:asc', 'created_at', setSort)+ expect(setSort).toHaveBeenCalledWith('created_at:desc')+ })++ it('toggles from desc to asc when clicking the same column', () => {+ const setSort = vi.fn()+ handleSortChange('created_at:desc', 'created_at', setSort)+ expect(setSort).toHaveBeenCalledWith('created_at:asc')+ })++ it('defaults to asc when switching to a different column', () => {+ const setSort = vi.fn()+ handleSortChange('created_at:desc', 'name', setSort)+ expect(setSort).toHaveBeenCalledWith('name:asc')+ })+})++const makeApp = (id: string, created_at: string): PrivateApp =>+ ({+ id,+ name: id,+ created_at,+ description: '',+ }) as unknown as PrivateApp++describe('sortApps', () => {+ const apps = [+ makeApp('b', '2024-01-02T00:00:00Z'),+ makeApp('a', '2024-01-01T00:00:00Z'),+ makeApp('c', '2024-01-03T00:00:00Z'),+ ]++ it('sorts in ascending order', () => {+ const sorted = sortApps(apps, 'created_at:asc' as AppsSort)+ expect(sorted.map((a) => a.id)).toEqual(['a', 'b', 'c'])+ })++ it('sorts in descending order', () => {+ const sorted = sortApps(apps, 'created_at:desc' as AppsSort)+ expect(sorted.map((a) => a.id)).toEqual(['c', 'b', 'a'])+ })++ it('does not mutate the original array', () => {+ const original = [...apps]+ sortApps(apps, 'created_at:asc' as AppsSort)+ expect(apps).toEqual(original)+ })+})diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.utils.ts b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.utils.tsnew file mode 100644index 00000000000..e987adc45ee--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/Apps.utils.ts@@ -0,0 +1,23 @@+import type { PrivateApp } from '../PrivateApps.types'+import type { AppsSort } from './Apps.types'++export function handleSortChange(+ currentSort: AppsSort,+ column: string,+ setSort: (s: AppsSort) => void+) {+ const [currentCol, currentOrder] = currentSort.split(':')+ if (currentCol === column) {+ setSort(`${column}:${currentOrder === 'asc' ? 'desc' : 'asc'}` as AppsSort)+ } else {+ setSort(`${column}:asc` as AppsSort)+ }+}++export function sortApps(apps: PrivateApp[], sort: AppsSort): PrivateApp[] {+ const [, order] = sort.split(':')+ return [...apps].sort((a, b) => {+ const diff = new Date(a.created_at).getTime() - new Date(b.created_at).getTime()+ return order === 'asc' ? diff : -diff+ })+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsList.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsList.tsxnew file mode 100644index 00000000000..fef5325357e--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsList.tsx@@ -0,0 +1,114 @@+import { usePlatformAppDeleteMutation } from 'data/platform-apps/platform-app-delete-mutation'+import { usePlatformAppInstallationDeleteMutation } from 'data/platform-apps/platform-app-installation-delete-mutation'+import { AppWindow, Plus } from 'lucide-react'+import { useMemo, useState } from 'react'+import { toast } from 'sonner'+import { Button } from 'ui'+import { EmptyStatePresentational } from 'ui-patterns'++import { PrivateApp, usePrivateApps } from '../../PrivateAppsContext'+import { PromoteInstallationModal } from '../../Installations/PromoteInstallationModal'+import type { AppsSort } from '../Apps.types'+import { handleSortChange, sortApps } from '../Apps.utils'+import { DeleteAppModal } from '../DeleteAppModal'+import { ViewAppSheet } from '../ViewAppSheet/ViewAppSheet'+import { AppsListLoading } from './AppsListLoading'+import { AppsListTable } from './AppsListTable'++interface AppsListProps {+ onCreateApp: () => void+}++export function AppsList({ onCreateApp }: AppsListProps) {+ const { apps, isLoading, slug, installations, removeInstallation, removeInstallationsByAppId } =+ usePrivateApps()++ const { mutate: deleteApp, isPending: isDeleting } = usePlatformAppDeleteMutation({+ onSuccess: (_, vars) => {+ toast.success(`Deleted app`)+ removeInstallationsByAppId(vars.appId)+ if (appToDelete?.id === vars.appId) setAppToDelete(undefined)+ },+ })++ const { mutate: deleteInstallation } = usePlatformAppInstallationDeleteMutation({+ onSuccess: (_, vars) => {+ removeInstallation(vars.installationId)+ if (appToDelete && slug) deleteApp({ slug, appId: appToDelete.id })+ },+ })++ const [sort, setSort] = useState<AppsSort>('created_at:desc')+ const [viewApp, setViewApp] = useState<PrivateApp | undefined>()+ const [appToDelete, setAppToDelete] = useState<PrivateApp | undefined>()+ const [appToPromote, setAppToPromote] = useState<PrivateApp | undefined>()++ const onSortChange = (column: string) => handleSortChange(sort, column, setSort)++ const sortedApps = useMemo(() => sortApps(apps, sort), [apps, sort])+ const installedAppIds = useMemo(+ () => new Set(installations.map((i) => i.app_id)),+ [installations]+ )+ const currentInstallation = installations[0]++ function handleDelete() {+ if (!appToDelete || !slug) return+ const installation = installations.find((i) => i.app_id === appToDelete.id)+ if (installation) {+ deleteInstallation({ slug, installationId: installation.id })+ } else {+ deleteApp({ slug, appId: appToDelete.id })+ }+ }++ return (+ <>+ {isLoading ? (+ <AppsListLoading />+ ) : apps.length === 0 ? (+ <EmptyStatePresentational+ icon={AppWindow}+ title="No private apps yet"+ description="Create a private app to generate scoped access tokens for your organization."+ >+ <Button type="primary" icon={<Plus size={14} />} onClick={onCreateApp}>+ Create app+ </Button>+ </EmptyStatePresentational>+ ) : (+ <AppsListTable+ sortedApps={sortedApps}+ sort={sort}+ installedAppIds={installedAppIds}+ onSortChange={onSortChange}+ onViewApp={setViewApp}+ onDeleteApp={setAppToDelete}+ onPromoteApp={setAppToPromote}+ />+ )}++ <ViewAppSheet+ app={viewApp ?? null}+ visible={viewApp !== undefined}+ onClose={() => setViewApp(undefined)}+ onDeleted={() => setViewApp(undefined)}+ />++ <DeleteAppModal+ app={appToDelete ?? null}+ visible={appToDelete !== undefined}+ onClose={() => setAppToDelete(undefined)}+ onConfirm={handleDelete}+ isLoading={isDeleting}+ />++ <PromoteInstallationModal+ appToPromote={appToPromote}+ currentInstallation={currentInstallation}+ onClose={() => setAppToPromote(undefined)}+ onSuccess={() => setAppToPromote(undefined)}+ />+ </>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsListLoading.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsListLoading.tsxnew file mode 100644index 00000000000..cc11ea87bf8--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsListLoading.tsx@@ -0,0 +1,30 @@+import { Card, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui'++export function AppsListLoading() {+ return (+ <Card>+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead className="max-w-xs">Name</TableHead>+ <TableHead className="w-48">Created</TableHead>+ <TableHead />+ </TableRow>+ </TableHeader>+ <TableBody>+ {Array.from({ length: 3 }).map((_, i) => (+ <TableRow key={i}>+ <TableCell>+ <div className="h-4 w-32 bg-surface-300 rounded animate-pulse" />+ </TableCell>+ <TableCell>+ <div className="h-4 w-24 bg-surface-300 rounded animate-pulse" />+ </TableCell>+ <TableCell />+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </Card>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsListTable.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsListTable.tsxnew file mode 100644index 00000000000..d395f642af2--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsListTable.tsx@@ -0,0 +1,113 @@+import dayjs from 'dayjs'+import { ArrowUpCircle, Key, MoreVertical, Trash } from 'lucide-react'+import {+ Badge,+ Button,+ Card,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableHeadSort,+ TableRow,+} from 'ui'+import { TimestampInfo } from 'ui-patterns/TimestampInfo'+import type { PrivateApp } from '../../PrivateAppsContext'+import type { AppsSort } from '../Apps.types'++interface AppsListTableProps {+ sortedApps: PrivateApp[]+ sort: AppsSort+ installedAppIds: Set<string>+ onSortChange: (column: string) => void+ onViewApp: (app: PrivateApp) => void+ onDeleteApp: (app: PrivateApp) => void+ onPromoteApp: (app: PrivateApp) => void+}++export function AppsListTable({+ sortedApps,+ sort,+ installedAppIds,+ onSortChange,+ onViewApp,+ onDeleteApp,+ onPromoteApp,+}: AppsListTableProps) {+ return (+ <Card>+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>Name</TableHead>+ <TableHead className="w-48">+ <TableHeadSort column="created_at" currentSort={sort} onSortChange={onSortChange}>+ Created+ </TableHeadSort>+ </TableHead>+ <TableHead className="w-10" />+ </TableRow>+ </TableHeader>+ <TableBody>+ {sortedApps.map((app) => {+ const isInstalled = installedAppIds.has(app.id)+ return (+ <TableRow key={app.id}>+ <TableCell>+ <div className="flex items-center gap-2">+ <p className="text-left max-w-[48ch] truncate">{app.name}</p>+ {isInstalled && (+ <Badge variant="success" className="uppercase">+ Installed+ </Badge>+ )}+ </div>+ </TableCell>+ <TableCell>+ <TimestampInfo+ utcTimestamp={app.created_at}+ label={dayjs(app.created_at).fromNow()}+ className="text-sm text-foreground-light whitespace-nowrap"+ />+ </TableCell>+ <TableCell className="text-right">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button type="default" icon={<MoreVertical size={14} />} className="w-7" />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" side="bottom" className="w-44">+ <DropdownMenuItem className="gap-x-2" onClick={() => onViewApp(app)}>+ <Key size={14} />+ View permissions+ </DropdownMenuItem>+ {!isInstalled && (+ <DropdownMenuItem className="gap-x-2" onClick={() => onPromoteApp(app)}>+ <ArrowUpCircle size={14} />+ Promote to installed+ </DropdownMenuItem>+ )}+ <DropdownMenuSeparator />+ <DropdownMenuItem+ className="!text-destructive gap-x-2"+ onClick={() => onDeleteApp(app)}+ >+ <Trash size={14} />+ Delete+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </TableCell>+ </TableRow>+ )+ })}+ </TableBody>+ </Table>+ </Card>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/CreateAppSheet/CreateAppSheet.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/CreateAppSheet/CreateAppSheet.tsxnew file mode 100644index 00000000000..ebb0cefa032--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/CreateAppSheet/CreateAppSheet.tsx@@ -0,0 +1,424 @@+import type { components } from 'api-types'+import { usePlatformAppCreateMutation } from 'data/platform-apps/platform-app-create-mutation'+import { usePlatformAppDeleteMutation } from 'data/platform-apps/platform-app-delete-mutation'+import { usePlatformAppInstallationCreateMutation } from 'data/platform-apps/platform-app-installation-create-mutation'+import { usePlatformAppSigningKeyCreateMutation } from 'data/platform-apps/platform-app-signing-key-create-mutation'+import { useCopyToClipboard } from 'hooks/ui/useCopyToClipboard'+import { Copy, Download, Key, Plus, RotateCcw, X } from 'lucide-react'+import { useEffect, useRef, useState } from 'react'+import { toast } from 'sonner'+import {+ Button,+ Checkbox_Shadcn_,+ Command_Shadcn_,+ CommandEmpty_Shadcn_,+ CommandGroup_Shadcn_,+ CommandInput_Shadcn_,+ CommandItem_Shadcn_,+ CommandList_Shadcn_,+ Input_Shadcn_,+ Popover_Shadcn_,+ PopoverContent_Shadcn_,+ PopoverTrigger_Shadcn_,+ ScrollArea,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ WarningIcon,+} from 'ui'+import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'+import { FormLayout } from 'ui-patterns/form/Layout/FormLayout'++import { usePrivateApps } from '../../PrivateAppsContext'+import { PERMISSIONS } from '../Apps.constants'+import { CreateAppSheetStep } from './CreateAppSheetStep'++type CreatePlatformAppResponse = components['schemas']['CreatePlatformAppResponse']+type CreatePlatformAppSigningKeyResponse =+ components['schemas']['CreatePlatformAppSigningKeyResponse']++interface CreateAppSheetProps {+ visible: boolean+ onClose: () => void+ onCreated: (app: CreatePlatformAppResponse) => void+}++export function CreateAppSheet({ visible, onClose, onCreated }: CreateAppSheetProps) {+ const { slug, installations, addInstallation } = usePrivateApps()+ const { copy } = useCopyToClipboard()++ const [name, setName] = useState('')+ const [selectedPermissions, setSelectedPermissions] = useState<string[]>([])+ const [permissionSearchOpen, setPermissionSearchOpen] = useState(false)+ const [createdApp, setCreatedApp] = useState<CreatePlatformAppResponse | null>(null)+ const [generatedKey, setGeneratedKey] = useState<CreatePlatformAppSigningKeyResponse | null>(null)+ const [keyCopied, setKeyCopied] = useState(false)+ const [showCloseConfirm, setShowCloseConfirm] = useState(false)+ const step3Ref = useRef<HTMLDivElement>(null)++ const { mutate: deleteApp, isPending: isDeleting } = usePlatformAppDeleteMutation({+ onSuccess: () => handleClose(),+ })++ const { mutate: installApp } = usePlatformAppInstallationCreateMutation({+ onSuccess: (data) => {+ if (data) addInstallation(data, 'all')+ },+ })++ const { mutate: createSigningKey, isPending: isCreatingKey } =+ usePlatformAppSigningKeyCreateMutation({+ onSuccess: (keyData, vars) => {+ if (keyData) setGeneratedKey(keyData)+ if (installations.length === 0 && slug) {+ installApp({ slug, app_id: vars.appId })+ }+ },+ })++ const { mutate: createApp, isPending: isCreatingApp } = usePlatformAppCreateMutation({+ onSuccess: (data) => {+ toast.success(`App "${data.name}" created`)+ setCreatedApp(data)+ createSigningKey({ slug: slug!, appId: data.id })+ },+ })++ function reset() {+ setName('')+ setSelectedPermissions([])+ setPermissionSearchOpen(false)+ setCreatedApp(null)+ setGeneratedKey(null)+ setKeyCopied(false)+ }++ function handleClose() {+ reset()+ onClose()+ }++ function handleRequestClose() {+ setShowCloseConfirm(true)+ }++ function handleCreate() {+ if (!slug) return+ createApp({+ slug,+ name: name.trim(),+ permissions:+ selectedPermissions as components['schemas']['CreatePlatformAppBody']['permissions'],+ })+ }++ function toggle(id: string) {+ setSelectedPermissions((prev) =>+ prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id]+ )+ }++ const canCreate = name.trim().length > 0 && selectedPermissions.length > 0+ const isLoading = isCreatingApp || isCreatingKey || isDeleting+ const keyRevealed = generatedKey !== null++ useEffect(() => {+ if (generatedKey) {+ step3Ref.current?.scrollIntoView({ behavior: 'smooth', block: 'start' })+ }+ }, [generatedKey])++ return (+ <>+ <Sheet+ open={visible}+ onOpenChange={(open) => {+ if (!open) handleRequestClose()+ }}+ >+ <SheetContent+ showClose={false}+ size="default"+ className="!min-w-[600px] flex flex-col h-full gap-0"+ >+ <SheetHeader>+ <SheetTitle>Create private app</SheetTitle>+ <SheetDescription className="sr-only">+ Create a private app to generate scoped access tokens for your organization.+ </SheetDescription>+ </SheetHeader>++ <ScrollArea className="flex-1 max-h-[calc(100vh-116px)]">+ <div className="px-5 sm:px-6 py-6">+ <CreateAppSheetStep+ number={1}+ title="App details"+ description="The first app you create will be automatically installed."+ disabled={keyRevealed}+ >+ <FormLayout label="Name" id="app-name">+ <Input_Shadcn_+ id="app-name"+ placeholder="My integration"+ value={name}+ onChange={(e) => setName(e.target.value)}+ disabled={isLoading}+ />+ </FormLayout>+ </CreateAppSheetStep>++ <CreateAppSheetStep+ number={2}+ title="Permissions"+ description="Select the permissions this app requires."+ disabled={keyRevealed}+ >+ <div className="space-y-4">+ <div className="flex justify-between items-center">+ <span className="text-sm">Configure permissions</span>+ <div className="flex items-center gap-2">+ {selectedPermissions.length > 0 && (+ <Button+ type="default"+ size="tiny"+ className="p-1"+ icon={<RotateCcw size={16} />}+ onClick={() => setSelectedPermissions([])}+ disabled={isLoading}+ />+ )}+ <Popover_Shadcn_+ open={permissionSearchOpen}+ onOpenChange={setPermissionSearchOpen}+ modal+ >+ <PopoverTrigger_Shadcn_ asChild>+ <Button+ type="default"+ size="tiny"+ icon={<Plus size={14} />}+ disabled={isLoading}+ >+ Add permission+ </Button>+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="w-[400px] p-0" align="end">+ <Command_Shadcn_>+ <CommandInput_Shadcn_ placeholder="Search permissions..." />+ <CommandList_Shadcn_>+ <CommandEmpty_Shadcn_>No permissions found.</CommandEmpty_Shadcn_>+ <CommandGroup_Shadcn_ className="[&>div]:text-left">+ <div className="max-h-[210px] overflow-y-auto">+ {PERMISSIONS.filter((p) => p.group === 'project').map((perm) => (+ <CommandItem_Shadcn_+ key={perm.id}+ value={`${perm.id} ${perm.label}`}+ onSelect={() => toggle(perm.id)}+ className="text-foreground"+ >+ <div className="flex items-center gap-3 w-full">+ <Checkbox_Shadcn_+ checked={selectedPermissions.includes(perm.id)}+ onCheckedChange={() => toggle(perm.id)}+ onClick={(e) => e.stopPropagation()}+ />+ <Key size={12} className="text-foreground-lighter" />+ <span className="font-medium text-foreground">+ {perm.label}+ </span>+ </div>+ </CommandItem_Shadcn_>+ ))}+ </div>+ </CommandGroup_Shadcn_>+ </CommandList_Shadcn_>+ </Command_Shadcn_>+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>+ </div>+ </div>++ {selectedPermissions.length === 0 ? (+ <div className="text-center py-8 border border-dashed border-border rounded-lg">+ <p className="text-sm text-foreground-light">+ No permissions configured yet.+ </p>+ </div>+ ) : (+ <div className="border border-border rounded-lg">+ {selectedPermissions.map((id, index) => {+ const perm = PERMISSIONS.find((p) => p.id === id)+ return (+ <div key={id}>+ <div className="flex items-center gap-3 p-3">+ <div className="flex-1">+ <p className="text-sm font-medium">{perm?.label}</p>+ {perm?.description && (+ <p className="text-xs text-foreground-lighter">+ {perm.description}+ </p>+ )}+ </div>+ <Button+ type="text"+ size="tiny"+ className="p-1"+ icon={<X size={16} />}+ disabled={isLoading}+ onClick={() =>+ setSelectedPermissions((prev) => prev.filter((p) => p !== id))+ }+ />+ </div>+ {index < selectedPermissions.length - 1 && (+ <div className="border-t border-border" />+ )}+ </div>+ )+ })}+ </div>+ )}++ <div className="w-full flex gap-x-2 items-center">+ <WarningIcon />+ <span className="text-xs text-foreground-lighter">+ Once you've set these permissions, you cannot edit them.+ </span>+ </div>+ </div>+ </CreateAppSheetStep>++ <div ref={step3Ref}>+ <CreateAppSheetStep+ number={3}+ title="Signing key"+ description={+ isCreatingKey+ ? 'Generating your signing key...'+ : keyRevealed+ ? 'This is the only time you can view this key. Copy or download it and store it securely.'+ : "A signing key will be generated automatically when you create the app. You'll only be able to view it once."+ }+ isLast+ disabled={createdApp === null && !isLoading}+ >+ {isCreatingKey && (+ <p className="text-sm text-foreground-light animate-pulse">+ Generating signing key...+ </p>+ )}+ {keyRevealed && (+ <div className="space-y-2">+ <div className="flex items-center justify-between">+ <h3 className="text-sm font-medium">Private key</h3>+ <div className="flex items-center gap-2">+ <Button+ type="default"+ size="tiny"+ icon={<Copy size={12} />}+ onClick={() => copy(generatedKey.private_key, { withToast: true })}+ >+ Copy+ </Button>+ <Button+ type="default"+ size="tiny"+ icon={<Download size={12} />}+ onClick={() => {+ const blob = new Blob([generatedKey.private_key], {+ type: 'text/plain',+ })+ const url = URL.createObjectURL(blob)+ const a = document.createElement('a')+ a.href = url+ a.download = `${createdApp?.name.toLowerCase().replace(/\s+/g, '-')}-private-key.pem`+ a.click()+ URL.revokeObjectURL(url)+ }}+ >+ Download+ </Button>+ </div>+ </div>+ <textarea+ readOnly+ value={generatedKey.private_key}+ rows={8}+ className="w-full rounded-md border border-control bg-surface-200 px-3 py-2 text-xs font-mono resize-none focus:outline-none"+ />+ <label className="flex items-center gap-3 cursor-pointer bg-warning-200 border border-warning-400 rounded-md px-3 py-2">+ <Checkbox_Shadcn_+ id="key-copied"+ checked={keyCopied}+ onCheckedChange={(v) => setKeyCopied(Boolean(v))}+ />+ <span className="text-sm text-warning cursor-pointer select-none">+ I have copied the key and stored it securely+ </span>+ </label>+ </div>+ )}+ </CreateAppSheetStep>+ </div>+ </div>+ </ScrollArea>++ <SheetFooter className="!justify-end w-full mt-auto py-4 border-t">+ <div className="flex gap-2">+ <Button type="default" onClick={handleRequestClose} disabled={isLoading}>+ Cancel+ </Button>+ {keyRevealed ? (+ <Button+ type="primary"+ disabled={!keyCopied}+ onClick={() => {+ onCreated(createdApp!)+ handleClose()+ }}+ >+ Done+ </Button>+ ) : (+ <Button+ type="primary"+ disabled={!canCreate}+ loading={isLoading}+ onClick={handleCreate}+ >+ Create app+ </Button>+ )}+ </div>+ </SheetFooter>+ </SheetContent>+ </Sheet>++ <ConfirmationModal+ variant="destructive"+ visible={showCloseConfirm}+ title="Close without saving?"+ confirmLabel="Close"+ confirmLabelLoading="Closing..."+ onCancel={() => setShowCloseConfirm(false)}+ onConfirm={() => {+ setShowCloseConfirm(false)+ if (createdApp && slug) {+ deleteApp({ slug, appId: createdApp.id })+ } else {+ handleClose()+ }+ }}+ >+ <p className="text-sm text-foreground-light py-2">+ {createdApp+ ? 'The app will be deleted and your signing key will be permanently lost.'+ : 'Any progress you have made will be lost.'}+ </p>+ </ConfirmationModal>+ </>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/CreateAppSheet/CreateAppSheetStep.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/CreateAppSheet/CreateAppSheetStep.tsxnew file mode 100644index 00000000000..c7a3fd3cd67--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/CreateAppSheet/CreateAppSheetStep.tsx@@ -0,0 +1,43 @@+import { PropsWithChildren } from 'react'++interface StepProps {+ number: number+ title: string+ description: string+ isLast?: boolean+ disabled?: boolean+}++export function CreateAppSheetStep({+ number,+ title,+ description,+ isLast = false,+ disabled = false,+ children,+}: PropsWithChildren<StepProps>) {+ return (+ <div+ className={`flex items-start gap-6 self-stretch transition-opacity ${disabled ? 'opacity-40 pointer-events-none' : ''}`}+ >+ <div className="relative self-stretch shrink-0 w-6">+ <div className="absolute inset-0 flex items-start justify-center">+ {!isLast && (+ <div+ aria-hidden+ className="absolute left-[calc(50%-1px)] w-px bg-border opacity-60 h-full"+ />+ )}+ <div className="relative z-10 flex font-mono text-xs items-center justify-center min-w-6 w-6 h-6 border border-default rounded-md bg-surface-100 text-foreground-light">+ {number}+ </div>+ </div>+ </div>+ <div className={`w-full ${isLast ? '' : 'pb-10'}`}>+ <p className="text-sm font-medium text-foreground mb-1">{title}</p>+ <p className="text-sm text-foreground-light mb-4">{description}</p>+ {children}+ </div>+ </div>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/DeleteAppModal.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/DeleteAppModal.tsxnew file mode 100644index 00000000000..9cd2354204a--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/DeleteAppModal.tsx@@ -0,0 +1,41 @@+import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'+import { PrivateApp } from '../PrivateAppsContext'++interface DeleteAppModalProps {+ app: PrivateApp | null+ visible: boolean+ isLoading?: boolean+ onClose: () => void+ onConfirm: () => void+}++export function DeleteAppModal({+ app,+ visible,+ isLoading,+ onClose,+ onConfirm,+}: DeleteAppModalProps) {+ return (+ <ConfirmationModal+ variant="destructive"+ visible={visible}+ title={`Delete "${app?.name}"`}+ confirmLabel="Delete app"+ confirmLabelLoading="Deleting..."+ loading={isLoading}+ onCancel={onClose}+ onConfirm={onConfirm}+ alert={{+ title: 'This action cannot be undone',+ description:+ 'Deleting this app will invalidate any tokens generated using its private key. All installations will also be removed.',+ }}+ >+ <p className="text-sm text-foreground-light">+ Are you sure you want to delete <strong>{app?.name}</strong>? This will also remove all+ installations associated with this app.+ </p>+ </ConfirmationModal>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheet.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheet.tsxnew file mode 100644index 00000000000..6eed924a032--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheet.tsx@@ -0,0 +1,94 @@+import { usePlatformAppDeleteMutation } from 'data/platform-apps/platform-app-delete-mutation'+import { usePlatformAppQuery } from 'data/platform-apps/platform-app-query'+import { X } from 'lucide-react'+import { useState } from 'react'+import { toast } from 'sonner'+import { Button, cn, ScrollArea, Sheet, SheetContent, SheetHeader } from 'ui'++import { PrivateApp, usePrivateApps } from '../../PrivateAppsContext'+import { PERMISSIONS, type Permission } from '../Apps.constants'+import { DeleteAppModal } from '../DeleteAppModal'+import { ViewAppSheetDangerZone } from './ViewAppSheetDangerZone'+import { ViewAppSheetInfo } from './ViewAppSheetInfo'+import { ViewAppSheetPermissions } from './ViewAppSheetPermissions'++interface ViewAppSheetProps {+ app: PrivateApp | null+ visible: boolean+ onClose: () => void+ onDeleted: () => void+}++export function ViewAppSheet({ app, visible, onClose, onDeleted }: ViewAppSheetProps) {+ const { slug, installations, removeInstallationsByAppId } = usePrivateApps()+ const isInstalled = installations.some((i) => i.app_id === app?.id)+ const [showDeleteModal, setShowDeleteModal] = useState(false)++ const { data: detail, isLoading: isLoadingDetail } = usePlatformAppQuery(+ { slug, id: app?.id },+ { enabled: visible && app !== null }+ )++ const { mutate: deleteApp, isPending: isDeleting } = usePlatformAppDeleteMutation({+ onSuccess: (_, vars) => {+ toast.success(`Deleted "${app?.name}"`)+ removeInstallationsByAppId(vars.appId)+ setShowDeleteModal(false)+ onClose()+ onDeleted()+ },+ })++ function handleDelete() {+ if (!app || !slug) return+ deleteApp({ slug, appId: app.id })+ }++ const permissions: Permission[] = detail+ ? detail.permissions+ .map((id) => PERMISSIONS.find((p) => p.id === id))+ .filter((p): p is Permission => p !== undefined)+ : []++ return (+ <>+ <Sheet+ open={visible}+ onOpenChange={(open) => {+ if (!open) onClose()+ }}+ >+ <SheetContent+ showClose={false}+ size="default"+ className="!min-w-[600px] flex flex-col h-full gap-0"+ >+ <SheetHeader+ className={cn('flex flex-row justify-between gap-x-4 items-center border-b')}+ >+ <p className="truncate font-medium">{app?.name}</p>+ <Button type="text" icon={<X size={16} />} className="px-1" onClick={onClose} />+ </SheetHeader>++ <ScrollArea className="flex-1 max-h-[calc(100vh-60px)]">+ {app && (+ <div className="flex flex-col gap-0">+ <ViewAppSheetInfo app={app} isInstalled={isInstalled} />+ <ViewAppSheetPermissions permissions={permissions} isLoading={isLoadingDetail} />+ <ViewAppSheetDangerZone onDelete={() => setShowDeleteModal(true)} />+ </div>+ )}+ </ScrollArea>+ </SheetContent>+ </Sheet>++ <DeleteAppModal+ app={app}+ visible={showDeleteModal}+ isLoading={isDeleting}+ onClose={() => setShowDeleteModal(false)}+ onConfirm={handleDelete}+ />+ </>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetDangerZone.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetDangerZone.tsxnew file mode 100644index 00000000000..dd7d4820507--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetDangerZone.tsx@@ -0,0 +1,31 @@+import {+ Alert_Shadcn_,+ AlertDescription_Shadcn_,+ AlertTitle_Shadcn_,+ Button,+ CriticalIcon,+} from 'ui'++interface ViewAppSheetDangerZoneProps {+ onDelete: () => void+}++export function ViewAppSheetDangerZone({ onDelete }: ViewAppSheetDangerZoneProps) {+ return (+ <div className="px-5 sm:px-6 py-6 space-y-3">+ <h3 className="text-sm font-medium text-foreground">Danger Zone</h3>+ <Alert_Shadcn_ variant="destructive">+ <CriticalIcon />+ <AlertTitle_Shadcn_>Delete app</AlertTitle_Shadcn_>+ <AlertDescription_Shadcn_>+ Permanently delete this app and all its installations.+ </AlertDescription_Shadcn_>+ <div className="mt-2">+ <Button type="danger" onClick={onDelete}>+ Delete app+ </Button>+ </div>+ </Alert_Shadcn_>+ </div>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetInfo.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetInfo.tsxnew file mode 100644index 00000000000..bbe2845e9b8--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetInfo.tsx@@ -0,0 +1,78 @@+import { formatDistanceToNow } from 'date-fns'+import {+ Badge,+ Card,+ CardContent,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from 'ui'+import type { PrivateApp } from '../../PrivateAppsContext'++interface ViewAppSheetInfoProps {+ app: PrivateApp+ isInstalled: boolean+}++export function ViewAppSheetInfo({ app, isInstalled }: ViewAppSheetInfoProps) {+ return (+ <div className="px-5 sm:px-6 py-6 space-y-3">+ <h3 className="text-sm font-medium text-foreground">Metadata</h3>+ <Card className="w-full overflow-hidden bg-surface-100">+ <CardContent className="p-0">+ <Table className="table-fixed w-full">+ <TableHeader>+ <TableRow>+ <TableHead className="text-left font-mono uppercase text-xs text-foreground-lighter h-auto py-2 w-[50%]">+ Field+ </TableHead>+ <TableHead className="text-left font-mono uppercase text-xs text-foreground-lighter h-auto py-2 w-[50%]">+ Value+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ <TableRow>+ <TableCell>+ <p className="text-foreground-light truncate">Name</p>+ </TableCell>+ <TableCell>+ <p className="font-medium truncate">{app.name}</p>+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell>+ <p className="text-foreground-light truncate">Created</p>+ </TableCell>+ <TableCell>+ <p className="truncate">+ {formatDistanceToNow(new Date(app.created_at), { addSuffix: true })}+ </p>+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell>+ <p className="text-foreground-light truncate">Status</p>+ </TableCell>+ <TableCell>+ {isInstalled ? (+ <Badge variant="success" className="uppercase">+ Installed+ </Badge>+ ) : (+ <Badge variant="default" className="uppercase">+ Uninstalled+ </Badge>+ )}+ </TableCell>+ </TableRow>+ </TableBody>+ </Table>+ </CardContent>+ </Card>+ </div>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetPermissions.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetPermissions.tsxnew file mode 100644index 00000000000..eb63be23a6d--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Apps/ViewAppSheet/ViewAppSheetPermissions.tsx@@ -0,0 +1,66 @@+import {+ Card,+ CardContent,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from 'ui'+import type { Permission } from '../Apps.constants'++interface ViewAppSheetPermissionsProps {+ permissions: Permission[]+ isLoading: boolean+}++export function ViewAppSheetPermissions({ permissions, isLoading }: ViewAppSheetPermissionsProps) {+ return (+ <div className="px-5 sm:px-6 py-6 space-y-3">+ <h3 className="text-sm font-medium text-foreground">Permissions</h3>+ {isLoading ? (+ <p className="text-sm text-foreground-light py-4">Loading permissions...</p>+ ) : (+ <Card className="w-full overflow-hidden bg-surface-100">+ <CardContent className="p-0">+ <Table className="table-fixed w-full">+ <TableHeader>+ <TableRow>+ <TableHead className="text-left font-mono uppercase text-xs text-foreground-lighter h-auto py-2 w-[50%]">+ Permission+ </TableHead>+ <TableHead className="text-left font-mono uppercase text-xs text-foreground-lighter h-auto py-2 w-[50%]">+ Description+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {permissions.length === 0 ? (+ <TableRow>+ <TableCell colSpan={2}>+ <p className="text-foreground-light text-center py-4">+ No permissions configured+ </p>+ </TableCell>+ </TableRow>+ ) : (+ permissions.map((p) => (+ <TableRow key={p.id}>+ <TableCell>+ <p className="text-sm truncate">{p.label}</p>+ </TableCell>+ <TableCell>+ <p className="text-foreground-light text-sm truncate">{p.description}</p>+ </TableCell>+ </TableRow>+ ))+ )}+ </TableBody>+ </Table>+ </CardContent>+ </Card>+ )}+ </div>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/Installations/PromoteInstallationModal.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/Installations/PromoteInstallationModal.tsxnew file mode 100644index 00000000000..39469bcc106--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/Installations/PromoteInstallationModal.tsx@@ -0,0 +1,86 @@+import { usePlatformAppInstallationCreateMutation } from 'data/platform-apps/platform-app-installation-create-mutation'+import { usePlatformAppInstallationDeleteMutation } from 'data/platform-apps/platform-app-installation-delete-mutation'+import { toast } from 'sonner'+import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'++import { Installation, PrivateApp, usePrivateApps } from '../PrivateAppsContext'++interface PromoteInstallationModalProps {+ appToPromote: PrivateApp | undefined+ currentInstallation: Installation | undefined+ onClose: () => void+ onSuccess: () => void+}++export function PromoteInstallationModal({+ appToPromote,+ currentInstallation,+ onClose,+ onSuccess,+}: PromoteInstallationModalProps) {+ const { slug, apps, addInstallation, removeInstallation } = usePrivateApps()++ const currentApp = apps.find((a) => a.id === currentInstallation?.app_id)++ const { mutate: installApp, isPending: isInstalling } = usePlatformAppInstallationCreateMutation({+ onSuccess: (data) => {+ if (data) addInstallation(data, 'all')+ toast.success(`"${appToPromote?.name}" is now the installed app`)+ onSuccess()+ onClose()+ },+ onError: (error) => {+ toast.error(`Failed to install app: ${error.message}`)+ },+ })++ const { mutate: uninstallApp, isPending: isUninstalling } =+ usePlatformAppInstallationDeleteMutation({+ onSuccess: (_, vars) => {+ removeInstallation(vars.installationId)+ if (!slug || !appToPromote) return+ installApp({ slug, app_id: appToPromote.id })+ },+ onError: (error) => {+ toast.error(`Failed to uninstall current app: ${error.message}`)+ },+ })++ function handleConfirm() {+ if (!slug || !appToPromote) return++ if (currentInstallation) {+ uninstallApp({ slug, installationId: currentInstallation.id })+ } else {+ installApp({ slug, app_id: appToPromote.id })+ }+ }++ const isLoading = isUninstalling || isInstalling++ return (+ <ConfirmationModal+ visible={appToPromote !== undefined}+ title={currentInstallation ? 'Replace installed app?' : `Install "${appToPromote?.name}"?`}+ confirmLabel={currentInstallation ? 'Replace' : 'Install'}+ confirmLabelLoading={currentInstallation ? 'Replacing...' : 'Installing...'}+ onCancel={onClose}+ onConfirm={handleConfirm}+ loading={isLoading}+ >+ <p className="text-sm text-foreground-light py-2">+ {currentInstallation ? (+ <>+ This will replace <strong>{currentApp?.name ?? currentInstallation.app_id}</strong> with{' '}+ <strong>{appToPromote?.name}</strong> as the installed app. Any tokens generated through+ the current installation will stop working.+ </>+ ) : (+ <>+ <strong>{appToPromote?.name}</strong> will be installed for this organization.+ </>+ )}+ </p>+ </ConfirmationModal>+ )+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/PrivateApps.types.ts b/apps/studio/components/interfaces/Organization/PrivateApps/PrivateApps.types.tsnew file mode 100644index 00000000000..219148cc271--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/PrivateApps.types.ts@@ -0,0 +1,7 @@+import type { components } from 'api-types'++export type PrivateApp = components['schemas']['ListPlatformAppsResponse']['apps'][number]+export type Installation = components['schemas']['InstallPlatformAppResponse'] & {+ // Project scope is not yet in the API — tracked locally for the UI+ projectScope: 'all' | string[]+}diff --git a/apps/studio/components/interfaces/Organization/PrivateApps/PrivateAppsContext.tsx b/apps/studio/components/interfaces/Organization/PrivateApps/PrivateAppsContext.tsxnew file mode 100644index 00000000000..3d844c06bf2--- /dev/null+++ b/apps/studio/components/interfaces/Organization/PrivateApps/PrivateAppsContext.tsx@@ -0,0 +1,87 @@+import type { components } from 'api-types'+import { usePlatformAppInstallationsQuery } from 'data/platform-apps/platform-app-installations-query'+import { usePlatformAppsQuery } from 'data/platform-apps/platform-apps-query'+import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'+import { createContext, PropsWithChildren, useContext, useMemo, useState } from 'react'++export type { Installation, PrivateApp } from './PrivateApps.types'+import type { Installation, PrivateApp } from './PrivateApps.types'++interface PrivateAppsContextValue {+ slug: string | undefined+ apps: PrivateApp[]+ isLoading: boolean+ isLoadingInstallations: boolean+ installations: Installation[]+ addInstallation: (+ data: components['schemas']['InstallPlatformAppResponse'],+ projectScope: 'all' | string[]+ ) => void+ removeInstallation: (id: string) => void+ removeInstallationsByAppId: (appId: string) => void+}++const PrivateAppsContext = createContext<PrivateAppsContextValue | null>(null)++export function PrivateAppsProvider({ children }: PropsWithChildren) {+ const { data: org } = useSelectedOrganizationQuery()+ const slug = org?.slug++ const { data: appsData, isLoading } = usePlatformAppsQuery({ slug })+ const {+ data: installationsData,+ isLoading: isLoadingInstallations,+ isError: installationsError,+ } = usePlatformAppInstallationsQuery({ slug }, { retry: false })++ // Local state fallback when GET installations endpoint is unavailable+ const [localInstallations, setLocalInstallations] = useState<Installation[]>([])++ const installations = useMemo<Installation[]>(() => {+ if (!installationsError && installationsData?.installations) {+ return installationsData.installations.map((inst) => ({+ ...(inst as components['schemas']['InstallPlatformAppResponse']),+ projectScope: 'all' as const,+ }))+ }+ return localInstallations+ }, [installationsData, installationsError, localInstallations])++ function addInstallation(+ data: components['schemas']['InstallPlatformAppResponse'],+ projectScope: 'all' | string[]+ ) {+ setLocalInstallations((prev) => [...prev, { ...data, projectScope }])+ }++ function removeInstallation(id: string) {+ setLocalInstallations((prev) => prev.filter((i) => i.id !== id))+ }++ function removeInstallationsByAppId(appId: string) {+ setLocalInstallations((prev) => prev.filter((i) => i.app_id !== appId))+ }++ return (+ <PrivateAppsContext.Provider+ value={{+ slug,+ apps: appsData?.apps ?? [],+ isLoading: isLoading || !slug,+ isLoadingInstallations: isLoadingInstallations || !slug,+ installations,+ addInstallation,+ removeInstallation,+ removeInstallationsByAppId,+ }}+ >+ {children}+ </PrivateAppsContext.Provider>+ )+}++export function usePrivateApps() {+ const ctx = useContext(PrivateAppsContext)+ if (!ctx) throw new Error('usePrivateApps must be used within PrivateAppsProvider')+ return ctx+}diff --git a/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx b/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsxindex 40cb4182717..6733eaaccb4 100644--- a/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx+++ b/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx@@ -1,4 +1,4 @@-import { useParams } from 'common'+import { useFlag, useParams } from 'common'import { useIsPlatformWebhooksEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import type { SidebarSection } from 'components/layouts/AccountLayout/AccountLayout.types'import { WithSidebar } from 'components/layouts/AccountLayout/WithSidebar'@@ -12,6 +12,7 @@ interface OrganizationSettingsMenuItemsProps {showSsoSettings?: booleanshowLegalDocuments?: booleanshowPlatformWebhooks?: boolean+ showPrivateApps?: boolean}interface OrganizationSettingsSectionsProps extends OrganizationSettingsMenuItemsProps {@@ -26,6 +27,7 @@ export const generateOrganizationSettingsMenuItems = ({showSsoSettings = true,showLegalDocuments = true,showPlatformWebhooks = true,+ showPrivateApps = false,}: OrganizationSettingsMenuItemsProps) => [{key: 'general',@@ -87,6 +89,7 @@ export const generateOrganizationSettingsSections = ({showSsoSettings = true,showLegalDocuments = true,showPlatformWebhooks = true,+ showPrivateApps = false,}: OrganizationSettingsSectionsProps): SidebarSection[] => {const isLinkActive = (key: string, href: string) =>key === 'webhooks'@@ -125,6 +128,15 @@ export const generateOrganizationSettingsSections = ({label: 'OAuth Apps',href: `/org/${slug}/apps`,},+ ...(showPrivateApps+ ? [+ {+ key: 'private-apps',+ label: 'Private Apps',+ href: `/org/${slug}/private-apps`,+ },+ ]+ : []),...(showPlatformWebhooks? [{@@ -184,6 +196,7 @@ export const generateOrganizationSettingsSections = ({export function OrganizationSettingsLayout({ children }: PropsWithChildren) {const { slug } = useParams()const showPlatformWebhooks = useIsPlatformWebhooksEnabled()+ const showPrivateApps = useFlag('privateApps')const fullCurrentPath = useCurrentPath()const currentPath = normalizeOrganizationSettingsPath(fullCurrentPath)@@ -204,6 +217,7 @@ export function OrganizationSettingsLayout({ children }: PropsWithChildren) {showSsoSettings,showLegalDocuments,showPlatformWebhooks,+ showPrivateApps,})// Browser titles for org settings routes are set by OrganizationLayout.diff --git a/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsMenu.tsx b/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsMenu.tsxindex ed3efcf288f..03d22d210da 100644--- a/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsMenu.tsx+++ b/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsMenu.tsx@@ -1,4 +1,4 @@-import { useParams } from 'common'+import { useFlag, useParams } from 'common'import { useIsPlatformWebhooksEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import { SubMenu } from 'components/ui/ProductMenu/SubMenu'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'@@ -22,6 +22,7 @@ export function OrganizationSettingsMenu({ onCloseSheet }: OrganizationSettingsMconst pathname = getPathnameWithoutQuery(router.asPath, router.pathname)const currentPath = normalizeOrganizationSettingsPath(pathname)const showPlatformWebhooks = useIsPlatformWebhooksEnabled()+ const showPrivateApps = useFlag('privateApps')const {organizationShowSsoSettings: showSsoSettings,@@ -40,6 +41,7 @@ export function OrganizationSettingsMenu({ onCloseSheet }: OrganizationSettingsMshowSsoSettings,showLegalDocuments,showPlatformWebhooks,+ showPrivateApps,})const page = currentPath.split('/').filter(Boolean).pop()diff --git a/apps/studio/data/platform-apps/keys.ts b/apps/studio/data/platform-apps/keys.tsnew file mode 100644index 00000000000..c69ca5b77b2--- /dev/null+++ b/apps/studio/data/platform-apps/keys.ts@@ -0,0 +1,9 @@+export const platformAppKeys = {+ list: (slug: string | undefined) => ['organizations', slug, 'platform-apps'] as const,+ detail: (slug: string | undefined, id: string | undefined) =>+ ['organizations', slug, 'platform-apps', id] as const,+ signingKeys: (slug: string | undefined, appId: string | undefined) =>+ ['organizations', slug, 'platform-apps', appId, 'signing-keys'] as const,+ installations: (slug: string | undefined) =>+ ['organizations', slug, 'platform-app-installations'] as const,+}diff --git a/apps/studio/data/platform-apps/platform-app-create-mutation.ts b/apps/studio/data/platform-apps/platform-app-create-mutation.tsnew file mode 100644index 00000000000..0417a80a22e--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-create-mutation.ts@@ -0,0 +1,54 @@+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { toast } from 'sonner'++import type { components } from 'api-types'+import { handleError, post } from 'data/fetchers'+import type { ResponseError, UseCustomMutationOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppCreateVariables = {+ slug: string+} & components['schemas']['CreatePlatformAppBody']++export async function createPlatformApp({ slug, ...body }: PlatformAppCreateVariables) {+ const { data, error } = await post('/platform/organizations/{slug}/apps', {+ params: { path: { slug } },+ body,+ })++ if (error) handleError(error)+ return data+}++export type PlatformAppCreateData = Awaited<ReturnType<typeof createPlatformApp>>++export const usePlatformAppCreateMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseCustomMutationOptions<PlatformAppCreateData, ResponseError, PlatformAppCreateVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<PlatformAppCreateData, ResponseError, PlatformAppCreateVariables>({+ mutationFn: (vars) => createPlatformApp(vars),+ async onSuccess(data, variables, context) {+ await queryClient.invalidateQueries({ queryKey: platformAppKeys.list(variables.slug) })+ // Seed the detail cache so ViewAppSheet can show permissions without a separate GET call+ if (data?.id) {+ queryClient.setQueryData(platformAppKeys.detail(variables.slug, data.id), data)+ }+ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to create app: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ })+}diff --git a/apps/studio/data/platform-apps/platform-app-delete-mutation.ts b/apps/studio/data/platform-apps/platform-app-delete-mutation.tsnew file mode 100644index 00000000000..23e5eb584e9--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-delete-mutation.ts@@ -0,0 +1,52 @@+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { del, handleError } from 'data/fetchers'+import { toast } from 'sonner'+import type { ResponseError, UseCustomMutationOptions } from 'types'++import { platformAppKeys } from './keys'++export type PlatformAppDeleteVariables = {+ slug: string+ appId: string+}++export async function deletePlatformApp({ slug, appId }: PlatformAppDeleteVariables) {+ const { data, error } = await del('/platform/organizations/{slug}/apps/{app_id}', {+ params: { path: { slug, app_id: appId } },+ })++ if (error) handleError(error)+ return data+}++export type PlatformAppDeleteData = Awaited<ReturnType<typeof deletePlatformApp>>++export const usePlatformAppDeleteMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseCustomMutationOptions<PlatformAppDeleteData, ResponseError, PlatformAppDeleteVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<PlatformAppDeleteData, ResponseError, PlatformAppDeleteVariables>({+ mutationFn: (vars) => deletePlatformApp(vars),+ async onSuccess(data, variables, context) {+ await queryClient.invalidateQueries({ queryKey: platformAppKeys.list(variables.slug) })+ await queryClient.invalidateQueries({+ queryKey: platformAppKeys.installations(variables.slug),+ })+ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to delete app: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ })+}diff --git a/apps/studio/data/platform-apps/platform-app-installation-create-mutation.ts b/apps/studio/data/platform-apps/platform-app-installation-create-mutation.tsnew file mode 100644index 00000000000..baf11daab6e--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-installation-create-mutation.ts@@ -0,0 +1,65 @@+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { toast } from 'sonner'++import type { components } from 'api-types'+import { handleError, post } from 'data/fetchers'+import type { ResponseError, UseCustomMutationOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppInstallationCreateVariables = {+ slug: string+} & components['schemas']['InstallPlatformAppBody']++export async function createPlatformAppInstallation({+ slug,+ ...body+}: PlatformAppInstallationCreateVariables) {+ const { data, error } = await post('/platform/organizations/{slug}/apps/installations', {+ params: { path: { slug } },+ body,+ })++ if (error) handleError(error)+ return data+}++export type PlatformAppInstallationCreateData = Awaited<+ ReturnType<typeof createPlatformAppInstallation>+>++export const usePlatformAppInstallationCreateMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseCustomMutationOptions<+ PlatformAppInstallationCreateData,+ ResponseError,+ PlatformAppInstallationCreateVariables+ >,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<+ PlatformAppInstallationCreateData,+ ResponseError,+ PlatformAppInstallationCreateVariables+ >({+ mutationFn: (vars) => createPlatformAppInstallation(vars),+ async onSuccess(data, variables, context) {+ await queryClient.invalidateQueries({+ queryKey: platformAppKeys.installations(variables.slug),+ })+ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to install app: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ })+}diff --git a/apps/studio/data/platform-apps/platform-app-installation-delete-mutation.ts b/apps/studio/data/platform-apps/platform-app-installation-delete-mutation.tsnew file mode 100644index 00000000000..ed125331c8b--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-installation-delete-mutation.ts@@ -0,0 +1,65 @@+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { toast } from 'sonner'++import { del, handleError } from 'data/fetchers'+import type { ResponseError, UseCustomMutationOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppInstallationDeleteVariables = {+ slug: string+ installationId: string+}++export async function deletePlatformAppInstallation({+ slug,+ installationId,+}: PlatformAppInstallationDeleteVariables) {+ const { data, error } = await del(+ '/platform/organizations/{slug}/apps/installations/{installation_id}',+ { params: { path: { slug, installation_id: installationId } } }+ )++ if (error) handleError(error)+ return data+}++export type PlatformAppInstallationDeleteData = Awaited<+ ReturnType<typeof deletePlatformAppInstallation>+>++export const usePlatformAppInstallationDeleteMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseCustomMutationOptions<+ PlatformAppInstallationDeleteData,+ ResponseError,+ PlatformAppInstallationDeleteVariables+ >,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<+ PlatformAppInstallationDeleteData,+ ResponseError,+ PlatformAppInstallationDeleteVariables+ >({+ mutationFn: (vars) => deletePlatformAppInstallation(vars),+ async onSuccess(data, variables, context) {+ await queryClient.invalidateQueries({+ queryKey: platformAppKeys.installations(variables.slug),+ })+ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to uninstall app: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ })+}diff --git a/apps/studio/data/platform-apps/platform-app-installations-query.ts b/apps/studio/data/platform-apps/platform-app-installations-query.tsnew file mode 100644index 00000000000..ff14590e4b5--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-installations-query.ts@@ -0,0 +1,41 @@+import { useQuery } from '@tanstack/react-query'++import type { components } from 'api-types'+import { get, handleError } from 'data/fetchers'+import type { ResponseError, UseCustomQueryOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppInstallation =+ components['schemas']['ListPlatformAppInstallationsResponse']['installations'][number]++export async function getPlatformAppInstallations(+ { slug }: { slug?: string },+ signal?: AbortSignal+) {+ if (!slug) throw new Error('slug is required')++ const { data, error } = await get('/platform/organizations/{slug}/apps/installations', {+ params: { path: { slug } },+ signal,+ })++ if (error) handleError(error)+ return data+}++export type PlatformAppInstallationsData = Awaited<ReturnType<typeof getPlatformAppInstallations>>+export type PlatformAppInstallationsError = ResponseError++export const usePlatformAppInstallationsQuery = <TData = PlatformAppInstallationsData>(+ { slug }: { slug?: string },+ {+ enabled = true,+ ...options+ }: UseCustomQueryOptions<PlatformAppInstallationsData, PlatformAppInstallationsError, TData> = {}+) =>+ useQuery<PlatformAppInstallationsData, PlatformAppInstallationsError, TData>({+ queryKey: platformAppKeys.installations(slug),+ queryFn: ({ signal }) => getPlatformAppInstallations({ slug }, signal),+ enabled: enabled && typeof slug !== 'undefined',+ ...options,+ })diff --git a/apps/studio/data/platform-apps/platform-app-query.ts b/apps/studio/data/platform-apps/platform-app-query.tsnew file mode 100644index 00000000000..b464061cd5e--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-query.ts@@ -0,0 +1,48 @@+import { useQuery } from '@tanstack/react-query'++import type { components } from 'api-types'+import { constructHeaders, fetchHandler, handleError } from 'data/fetchers'+import { API_URL } from 'lib/constants'+import type { ResponseError, UseCustomQueryOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppVariables = {+ slug?: string+ id?: string+}++export type PlatformAppDetail = components['schemas']['GetPlatformAppResponse']++export async function getPlatformApp({ slug, id }: PlatformAppVariables, signal?: AbortSignal) {+ if (!slug) throw new Error('slug is required')+ if (!id) throw new Error('id is required')++ const baseUrl = API_URL?.replace('/platform', '')+ const url = `${baseUrl}/platform/organizations/${slug}/apps/${id}`+ const headers = await constructHeaders()+ const res = await fetchHandler(url, { method: 'GET', headers, signal })++ if (!res.ok) {+ const body = await res.json().catch(() => ({}))+ handleError(body)+ }++ return res.json() as Promise<PlatformAppDetail>+}++export type PlatformAppData = Awaited<ReturnType<typeof getPlatformApp>>+export type PlatformAppError = ResponseError++export const usePlatformAppQuery = <TData = PlatformAppData>(+ { slug, id }: PlatformAppVariables,+ {+ enabled = true,+ ...options+ }: UseCustomQueryOptions<PlatformAppData, PlatformAppError, TData> = {}+) =>+ useQuery<PlatformAppData, PlatformAppError, TData>({+ queryKey: platformAppKeys.detail(slug, id),+ queryFn: ({ signal }) => getPlatformApp({ slug, id }, signal),+ enabled: enabled && typeof slug !== 'undefined' && typeof id !== 'undefined',+ ...options,+ })diff --git a/apps/studio/data/platform-apps/platform-app-signing-key-create-mutation.ts b/apps/studio/data/platform-apps/platform-app-signing-key-create-mutation.tsnew file mode 100644index 00000000000..c3319dc78e7--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-signing-key-create-mutation.ts@@ -0,0 +1,64 @@+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { toast } from 'sonner'++import { handleError, post } from 'data/fetchers'+import type { ResponseError, UseCustomMutationOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppSigningKeyCreateVariables = {+ slug: string+ appId: string+}++export async function createPlatformAppSigningKey({+ slug,+ appId,+}: PlatformAppSigningKeyCreateVariables) {+ const { data, error } = await post('/platform/organizations/{slug}/apps/{app_id}/signing-keys', {+ params: { path: { slug, app_id: appId } },+ })++ if (error) handleError(error)+ return data+}++export type PlatformAppSigningKeyCreateData = Awaited<+ ReturnType<typeof createPlatformAppSigningKey>+>++export const usePlatformAppSigningKeyCreateMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseCustomMutationOptions<+ PlatformAppSigningKeyCreateData,+ ResponseError,+ PlatformAppSigningKeyCreateVariables+ >,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<+ PlatformAppSigningKeyCreateData,+ ResponseError,+ PlatformAppSigningKeyCreateVariables+ >({+ mutationFn: (vars) => createPlatformAppSigningKey(vars),+ async onSuccess(data, variables, context) {+ await queryClient.invalidateQueries({+ queryKey: platformAppKeys.signingKeys(variables.slug, variables.appId),+ })+ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to create signing key: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ })+}diff --git a/apps/studio/data/platform-apps/platform-app-signing-key-delete-mutation.ts b/apps/studio/data/platform-apps/platform-app-signing-key-delete-mutation.tsnew file mode 100644index 00000000000..6a3b05a8605--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-signing-key-delete-mutation.ts@@ -0,0 +1,69 @@+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { toast } from 'sonner'++import { del, handleError } from 'data/fetchers'+import type { ResponseError, UseCustomMutationOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppSigningKeyDeleteVariables = {+ slug: string+ appId: string+ keyId: string+}++export async function deletePlatformAppSigningKey({+ slug,+ appId,+ keyId,+}: PlatformAppSigningKeyDeleteVariables) {+ const { data, error } = await del(+ '/platform/organizations/{slug}/apps/{app_id}/signing-keys/{key_id}',+ {+ params: { path: { slug, app_id: appId, key_id: keyId } },+ }+ )++ if (error) handleError(error)+ return data+}++export type PlatformAppSigningKeyDeleteData = Awaited<+ ReturnType<typeof deletePlatformAppSigningKey>+>++export const usePlatformAppSigningKeyDeleteMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseCustomMutationOptions<+ PlatformAppSigningKeyDeleteData,+ ResponseError,+ PlatformAppSigningKeyDeleteVariables+ >,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<+ PlatformAppSigningKeyDeleteData,+ ResponseError,+ PlatformAppSigningKeyDeleteVariables+ >({+ mutationFn: (vars) => deletePlatformAppSigningKey(vars),+ async onSuccess(data, variables, context) {+ await queryClient.invalidateQueries({+ queryKey: platformAppKeys.signingKeys(variables.slug, variables.appId),+ })+ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to delete signing key: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ })+}diff --git a/apps/studio/data/platform-apps/platform-app-update-mutation.ts b/apps/studio/data/platform-apps/platform-app-update-mutation.tsnew file mode 100644index 00000000000..c3136879f29--- /dev/null+++ b/apps/studio/data/platform-apps/platform-app-update-mutation.ts@@ -0,0 +1,56 @@+import { useMutation, useQueryClient } from '@tanstack/react-query'+import { toast } from 'sonner'++import type { components } from 'api-types'+import { handleError, patch } from 'data/fetchers'+import type { ResponseError, UseCustomMutationOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppUpdateVariables = {+ slug: string+ appId: string+} & components['schemas']['UpdatePlatformAppBody']++export async function updatePlatformApp({ slug, appId, ...body }: PlatformAppUpdateVariables) {+ const { data, error } = await patch('/platform/organizations/{slug}/apps/{app_id}', {+ params: { path: { slug, app_id: appId } },+ body,+ })++ if (error) handleError(error)+ return data+}++export type PlatformAppUpdateData = Awaited<ReturnType<typeof updatePlatformApp>>++export const usePlatformAppUpdateMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseCustomMutationOptions<PlatformAppUpdateData, ResponseError, PlatformAppUpdateVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<PlatformAppUpdateData, ResponseError, PlatformAppUpdateVariables>({+ mutationFn: (vars) => updatePlatformApp(vars),+ async onSuccess(data, variables, context) {+ await Promise.all([+ queryClient.invalidateQueries({ queryKey: platformAppKeys.list(variables.slug) }),+ queryClient.invalidateQueries({+ queryKey: platformAppKeys.detail(variables.slug, variables.appId),+ }),+ ])+ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to update app: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ })+}diff --git a/apps/studio/data/platform-apps/platform-apps-query.ts b/apps/studio/data/platform-apps/platform-apps-query.tsnew file mode 100644index 00000000000..48b33f922aa--- /dev/null+++ b/apps/studio/data/platform-apps/platform-apps-query.ts@@ -0,0 +1,41 @@+import { useQuery } from '@tanstack/react-query'++import type { components } from 'api-types'+import { get, handleError } from 'data/fetchers'+import type { ResponseError, UseCustomQueryOptions } from 'types'+import { platformAppKeys } from './keys'++export type PlatformAppsVariables = {+ slug?: string+}++export type PlatformApp = components['schemas']['ListPlatformAppsResponse']['apps'][number]++export async function getPlatformApps({ slug }: PlatformAppsVariables, signal?: AbortSignal) {+ if (!slug) throw new Error('slug is required')++ const { data, error } = await get('/platform/organizations/{slug}/apps', {+ params: { path: { slug } },+ signal,+ })++ if (error) handleError(error)+ return data+}++export type PlatformAppsData = Awaited<ReturnType<typeof getPlatformApps>>+export type PlatformAppsError = ResponseError++export const usePlatformAppsQuery = <TData = PlatformAppsData>(+ { slug }: PlatformAppsVariables,+ {+ enabled = true,+ ...options+ }: UseCustomQueryOptions<PlatformAppsData, PlatformAppsError, TData> = {}+) =>+ useQuery<PlatformAppsData, PlatformAppsError, TData>({+ queryKey: platformAppKeys.list(slug),+ queryFn: ({ signal }) => getPlatformApps({ slug }, signal),+ enabled: enabled && typeof slug !== 'undefined',+ ...options,+ })diff --git a/apps/studio/pages/account/tokens/scoped.tsx b/apps/studio/pages/account/tokens/scoped.tsxindex 80b718810c9..f8130c1f660 100644--- a/apps/studio/pages/account/tokens/scoped.tsx+++ b/apps/studio/pages/account/tokens/scoped.tsx@@ -68,6 +68,16 @@ const ScopedTokens: NextPageWithLayout = () => {if (id === newToken?.id) setNewToken(undefined)}}/>++ <p className="text-sm text-foreground-muted text-center mt-6">+ Looking for Private Apps?{' '}+ <a+ href="/org"+ className="text-foreground-light underline hover:text-foreground transition-colors"+ >+ Go to Organization Settings → Connections → Private Apps+ </a>+ </p></div></AccessTokensLayout>)diff --git a/apps/studio/pages/org/[slug]/private-apps/index.tsx b/apps/studio/pages/org/[slug]/private-apps/index.tsxnew file mode 100644index 00000000000..b1a82ca5895--- /dev/null+++ b/apps/studio/pages/org/[slug]/private-apps/index.tsx@@ -0,0 +1,99 @@+import { useState } from 'react'+import { Plus } from 'lucide-react'+import { Button } from 'ui'+import { AppsList } from 'components/interfaces/Organization/PrivateApps/Apps/AppsList/AppsList'+import { CreateAppSheet } from 'components/interfaces/Organization/PrivateApps/Apps/CreateAppSheet/CreateAppSheet'+import {+ PrivateAppsProvider,+ usePrivateApps,+} from 'components/interfaces/Organization/PrivateApps/PrivateAppsContext'+import { PageContainer } from 'ui-patterns/PageContainer'+import DefaultLayout from 'components/layouts/DefaultLayout'+import OrganizationLayout from 'components/layouts/OrganizationLayout'+import OrganizationSettingsLayout from 'components/layouts/ProjectLayout/OrganizationSettingsLayout'+import type { NextPageWithLayout } from 'types'+import {+ PageHeader,+ PageHeaderDescription,+ PageHeaderMeta,+ PageHeaderSummary,+ PageHeaderTitle,+} from 'ui-patterns/PageHeader'+import {+ PageSection,+ PageSectionAside,+ PageSectionContent,+ PageSectionDescription,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'++function PrivateAppsContent() {+ const { apps, isLoading } = usePrivateApps()+ const [showCreate, setShowCreate] = useState(false)++ return (+ <>+ <PageHeader size="default">+ <PageHeaderMeta>+ <PageHeaderSummary>+ <PageHeaderTitle>Private Apps</PageHeaderTitle>+ <PageHeaderDescription>+ Create private apps to generate scoped access tokens for your organization+ </PageHeaderDescription>+ </PageHeaderSummary>+ </PageHeaderMeta>+ </PageHeader>++ <PageContainer size="default" className="pb-16">+ <PageSection id="apps">+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Apps</PageSectionTitle>+ <PageSectionDescription>+ Registered private apps and their credentials+ </PageSectionDescription>+ </PageSectionSummary>+ {!isLoading && apps.length > 0 && (+ <PageSectionAside>+ <Button+ type="primary"+ icon={<Plus size={14} />}+ onClick={() => setShowCreate(true)}+ >+ Create app+ </Button>+ </PageSectionAside>+ )}+ </PageSectionMeta>+ <PageSectionContent>+ <AppsList onCreateApp={() => setShowCreate(true)} />+ </PageSectionContent>+ </PageSection>+ </PageContainer>++ <CreateAppSheet+ visible={showCreate}+ onClose={() => setShowCreate(false)}+ onCreated={() => setShowCreate(false)}+ />+ </>+ )+}++const PrivateAppsPage: NextPageWithLayout = () => {+ return <PrivateAppsContent />+}++PrivateAppsPage.getLayout = (page) => (+ <DefaultLayout>+ <OrganizationLayout title="Private Apps">+ <OrganizationSettingsLayout>+ <PrivateAppsProvider>{page}</PrivateAppsProvider>+ </OrganizationSettingsLayout>+ </OrganizationLayout>+ </DefaultLayout>+)++export default PrivateAppsPagediff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.tsindex b562d0da791..8d5b481152b 100644--- a/packages/api-types/types/platform.d.ts+++ b/packages/api-types/types/platform.d.ts@@ -917,6 +917,115 @@ export interface paths {patch: operations['OrganizationSlugController_updateOrganization']trace?: never}+ '/platform/organizations/{slug}/apps': {+ parameters: {+ query?: never+ header?: never+ path?: never+ cookie?: never+ }+ /** List platform apps for the given organization */+ get: operations['PlatformAppsController_listPlatformApps']+ put?: never+ /** Create new platform app */+ post: operations['PlatformAppsController_createPlatformApp']+ delete?: never+ options?: never+ head?: never+ patch?: never+ trace?: never+ }+ '/platform/organizations/{slug}/apps/{app_id}': {+ parameters: {+ query?: never+ header?: never+ path?: never+ cookie?: never+ }+ /** Get organization platform app by the given id */+ get: operations['PlatformAppsController_getPlatformApp']+ put?: never+ post?: never+ /** Delete platform app */+ delete: operations['PlatformAppsController_deletePlatformApp']+ options?: never+ head?: never+ /** Update platform app */+ patch: operations['PlatformAppsController_updatePlatformApp']+ trace?: never+ }+ '/platform/organizations/{slug}/apps/{app_id}/signing-keys': {+ parameters: {+ query?: never+ header?: never+ path?: never+ cookie?: never+ }+ /** List signing keys for the given platform app */+ get: operations['PlatformAppSigningKeysController_listPlatformAppSigningKeys']+ put?: never+ /** Create a signing key for the given platform app */+ post: operations['PlatformAppSigningKeysController_createPlatformAppSigningKey']+ delete?: never+ options?: never+ head?: never+ patch?: never+ trace?: never+ }+ '/platform/organizations/{slug}/apps/{app_id}/signing-keys/{key_id}': {+ parameters: {+ query?: never+ header?: never+ path?: never+ cookie?: never+ }+ get?: never+ put?: never+ post?: never+ /** Delete a signing key for the given platform app */+ delete: operations['PlatformAppSigningKeysController_deletePlatformAppSigningKey']+ options?: never+ head?: never+ patch?: never+ trace?: never+ }+ '/platform/organizations/{slug}/apps/installations': {+ parameters: {+ query?: never+ header?: never+ path?: never+ cookie?: never+ }+ /** List platform app installations for the given organization */+ get: operations['PlatformAppInstallationsController_listPlatformAppInstallations']+ put?: never+ /** Install a platform app to this organization */+ post: operations['PlatformAppInstallationsController_installPlatformApp']+ delete?: never+ options?: never+ head?: never+ patch?: never+ trace?: never+ }+ '/platform/organizations/{slug}/apps/installations/{installation_id}': {+ parameters: {+ query?: never+ header?: never+ path?: never+ cookie?: never+ }+ /** Get platform app installation with the given id */+ get: operations['PlatformAppInstallationsController_getPlatformAppInstallation']+ put?: never+ post?: never+ /** Uninstall the given platform app installation */+ delete: operations['PlatformAppInstallationsController_uninstallPlatformInstallation']+ options?: never+ head?: never+ /** Update platform app installation permissions */+ patch: operations['PlatformAppInstallationsController_updatePlatformAppInstallation']+ trace?: never+ }'/platform/organizations/{slug}/audit': {parameters: {query?: never@@ -4654,7 +4763,7 @@ export interface components {slug: string}/** @enum {string} */- status: 'pending' | 'complete' | 'expired' | 'error'+ status: 'pending' | 'complete' | 'expired'}AddAwsAccountToPrivateLinkBody: {account_name?: string@@ -5239,6 +5348,110 @@ export interface components {*/id: number}+ CreatePlatformAppBody: {+ description?: string+ name: string+ permissions: (+ | 'organizations_read'+ | 'organizations_create'+ | 'projects_read'+ | 'snippets_read'+ | 'organization_admin_read'+ | 'organization_admin_write'+ | 'members_read'+ | 'members_write'+ | 'organization_projects_read'+ | 'organization_projects_create'+ | 'project_admin_read'+ | 'project_admin_write'+ | 'action_runs_read'+ | 'action_runs_write'+ | 'advisors_read'+ | 'analytics_logs_read'+ | 'analytics_usage_read'+ | 'api_gateway_keys_read'+ | 'api_gateway_keys_write'+ | 'auth_config_read'+ | 'auth_config_write'+ | 'auth_signing_keys_read'+ | 'auth_signing_keys_write'+ | 'backups_read'+ | 'backups_write'+ | 'branching_development_create'+ | 'branching_development_delete'+ | 'branching_development_read'+ | 'branching_development_write'+ | 'branching_production_create'+ | 'branching_production_delete'+ | 'branching_production_read'+ | 'branching_production_write'+ | 'custom_domain_read'+ | 'custom_domain_write'+ | 'data_api_config_read'+ | 'data_api_config_write'+ | 'database_read'+ | 'database_write'+ | 'database_config_read'+ | 'database_config_write'+ | 'database_jit_read'+ | 'database_jit_write'+ | 'database_network_bans_read'+ | 'database_network_bans_write'+ | 'database_network_restrictions_read'+ | 'database_network_restrictions_write'+ | 'database_migrations_read'+ | 'database_migrations_write'+ | 'database_pooling_config_read'+ | 'database_pooling_config_write'+ | 'database_readonly_config_read'+ | 'database_readonly_config_write'+ | 'database_ssl_config_read'+ | 'database_ssl_config_write'+ | 'database_webhooks_config_read'+ | 'database_webhooks_config_write'+ | 'edge_functions_read'+ | 'edge_functions_write'+ | 'edge_functions_secrets_read'+ | 'edge_functions_secrets_write'+ | 'infra_add_ons_read'+ | 'infra_add_ons_write'+ | 'infra_disk_config_read'+ | 'infra_disk_config_write'+ | 'infra_read_replicas_read'+ | 'infra_read_replicas_write'+ | 'project_snippets_read'+ | 'project_snippets_write'+ | 'storage_read'+ | 'storage_write'+ | 'storage_config_read'+ | 'storage_config_write'+ | 'vanity_subdomain_read'+ | 'vanity_subdomain_write'+ )[]+ }+ CreatePlatformAppResponse: {+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ created_by: string+ description: string | null+ /** Format: uuid */+ id: string+ name: string+ permissions: string[]+ /** Format: date-time */+ updated_at: string+ }+ CreatePlatformAppSigningKeyResponse: {+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ created_by: string+ fingerprint: string+ /** Format: uuid */+ id: string+ private_key: string+ }CreateProjectBody: {auth_site_url?: string/** @enum {string} */@@ -6296,6 +6509,33 @@ export interface components {}updated_at: string}+ GetPlatformAppInstallationResponse: {+ /** Format: uuid */+ app_id: string+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ id: string+ /** Format: uuid */+ installed_by: string+ organization_slug: string+ permissions: string[]+ /** Format: date-time */+ updated_at: string+ }+ GetPlatformAppResponse: {+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ created_by: string+ description: string | null+ /** Format: uuid */+ id: string+ name: string+ permissions: string[]+ /** Format: date-time */+ updated_at: string+ }GetPostgrestConfigResponse: {db_anon_role: stringdb_extra_search_path: string@@ -6996,6 +7236,23 @@ export interface components {SMTP_USER: stringURI_ALLOW_LIST: string}+ InstallPlatformAppBody: {+ /** Format: uuid */+ app_id: string+ }+ InstallPlatformAppResponse: {+ /** Format: uuid */+ app_id: string+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ id: string+ /** Format: uuid */+ installed_by: string+ organization_slug: string+ /** Format: date-time */+ updated_at: string+ }InvitationByTokenResponse: {authorized_user: booleanemail_match: boolean@@ -7309,6 +7566,50 @@ export interface components {oauth_app_id: string}[]}+ ListPlatformAppInstallationsResponse: {+ installations: {+ /** Format: uuid */+ app_id: string+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ id: string+ /** Format: uuid */+ installed_by: string+ organization_slug: string+ /** Format: date-time */+ updated_at: string+ }[]+ }+ ListPlatformAppSigningKeysResponse: {+ keys: {+ /** Format: uuid */+ app_id: string+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ created_by: string+ fingerprint: string+ /** Format: uuid */+ id: string+ /** Format: date-time */+ last_used_at: string | null+ }[]+ }+ ListPlatformAppsResponse: {+ apps: {+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ created_by: string+ description: string | null+ /** Format: uuid */+ id: string+ name: string+ /** Format: date-time */+ updated_at: string+ }[]+ }ListProjectsPaginatedResponse: {pagination: {/** @description Total number of projects. Use this to calculate the total number of pages. */@@ -10228,15 +10529,110 @@ export interface components {server_idle_timeout?: numberserver_lifetime?: number}- UpdatePoolingConfigResponse: {- default_pool_size?: number- ignore_startup_parameters: string- max_client_conn?: number- pgbouncer_enabled: boolean- /** @enum {string} */- pgbouncer_status: 'COMING_UP' | 'COMING_DOWN' | 'RELOADING' | 'ENABLED' | 'DISABLED'- /**- * @deprecated+ UpdatePlatformAppBody: {+ description?: string+ name: string+ permissions: (+ | 'organizations_read'+ | 'organizations_create'+ | 'projects_read'+ | 'snippets_read'+ | 'organization_admin_read'+ | 'organization_admin_write'+ | 'members_read'+ | 'members_write'+ | 'organization_projects_read'+ | 'organization_projects_create'+ | 'project_admin_read'+ | 'project_admin_write'+ | 'action_runs_read'+ | 'action_runs_write'+ | 'advisors_read'+ | 'analytics_logs_read'+ | 'analytics_usage_read'+ | 'api_gateway_keys_read'+ | 'api_gateway_keys_write'+ | 'auth_config_read'+ | 'auth_config_write'+ | 'auth_signing_keys_read'+ | 'auth_signing_keys_write'+ | 'backups_read'+ | 'backups_write'+ | 'branching_development_create'+ | 'branching_development_delete'+ | 'branching_development_read'+ | 'branching_development_write'+ | 'branching_production_create'+ | 'branching_production_delete'+ | 'branching_production_read'+ | 'branching_production_write'+ | 'custom_domain_read'+ | 'custom_domain_write'+ | 'data_api_config_read'+ | 'data_api_config_write'+ | 'database_read'+ | 'database_write'+ | 'database_config_read'+ | 'database_config_write'+ | 'database_jit_read'+ | 'database_jit_write'+ | 'database_network_bans_read'+ | 'database_network_bans_write'+ | 'database_network_restrictions_read'+ | 'database_network_restrictions_write'+ | 'database_migrations_read'+ | 'database_migrations_write'+ | 'database_pooling_config_read'+ | 'database_pooling_config_write'+ | 'database_readonly_config_read'+ | 'database_readonly_config_write'+ | 'database_ssl_config_read'+ | 'database_ssl_config_write'+ | 'database_webhooks_config_read'+ | 'database_webhooks_config_write'+ | 'edge_functions_read'+ | 'edge_functions_write'+ | 'edge_functions_secrets_read'+ | 'edge_functions_secrets_write'+ | 'infra_add_ons_read'+ | 'infra_add_ons_write'+ | 'infra_disk_config_read'+ | 'infra_disk_config_write'+ | 'infra_read_replicas_read'+ | 'infra_read_replicas_write'+ | 'project_snippets_read'+ | 'project_snippets_write'+ | 'storage_read'+ | 'storage_write'+ | 'storage_config_read'+ | 'storage_config_write'+ | 'vanity_subdomain_read'+ | 'vanity_subdomain_write'+ )[]+ }+ UpdatePlatformAppInstallationResponse: {+ /** Format: uuid */+ app_id: string+ /** Format: date-time */+ created_at: string+ /** Format: uuid */+ id: string+ /** Format: uuid */+ installed_by: string+ organization_slug: string+ permissions: string[]+ /** Format: date-time */+ updated_at: string+ }+ UpdatePoolingConfigResponse: {+ default_pool_size?: number+ ignore_startup_parameters: string+ max_client_conn?: number+ pgbouncer_enabled: boolean+ /** @enum {string} */+ pgbouncer_status: 'COMING_UP' | 'COMING_DOWN' | 'RELOADING' | 'ENABLED' | 'DISABLED'+ /**+ * @deprecated* @description Cannot be changed, this is ignored* @enum {string}*/@@ -13470,6 +13866,308 @@ export interface operations {}}}+ PlatformAppsController_listPlatformApps: {+ parameters: {+ query?: never+ header?: never+ path: {+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['ListPlatformAppsResponse']+ }+ }+ }+ }+ PlatformAppsController_createPlatformApp: {+ parameters: {+ query?: never+ header?: never+ path: {+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody: {+ content: {+ 'application/json': components['schemas']['CreatePlatformAppBody']+ }+ }+ responses: {+ 201: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['CreatePlatformAppResponse']+ }+ }+ }+ }+ PlatformAppsController_getPlatformApp: {+ parameters: {+ query?: never+ header?: never+ path: {+ app_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['GetPlatformAppResponse']+ }+ }+ }+ }+ PlatformAppsController_deletePlatformApp: {+ parameters: {+ query?: never+ header?: never+ path: {+ app_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }+ }+ }+ PlatformAppsController_updatePlatformApp: {+ parameters: {+ query?: never+ header?: never+ path: {+ app_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody: {+ content: {+ 'application/json': components['schemas']['UpdatePlatformAppBody']+ }+ }+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['GetPlatformAppResponse']+ }+ }+ }+ }+ PlatformAppSigningKeysController_listPlatformAppSigningKeys: {+ parameters: {+ query?: never+ header?: never+ path: {+ app_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['ListPlatformAppSigningKeysResponse']+ }+ }+ }+ }+ PlatformAppSigningKeysController_createPlatformAppSigningKey: {+ parameters: {+ query?: never+ header?: never+ path: {+ app_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 201: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['CreatePlatformAppSigningKeyResponse']+ }+ }+ }+ }+ PlatformAppSigningKeysController_deletePlatformAppSigningKey: {+ parameters: {+ query?: never+ header?: never+ path: {+ app_id: string+ key_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }+ }+ }+ PlatformAppInstallationsController_listPlatformAppInstallations: {+ parameters: {+ query?: never+ header?: never+ path: {+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['ListPlatformAppInstallationsResponse']+ }+ }+ }+ }+ PlatformAppInstallationsController_installPlatformApp: {+ parameters: {+ query?: never+ header?: never+ path: {+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody: {+ content: {+ 'application/json': components['schemas']['InstallPlatformAppBody']+ }+ }+ responses: {+ 201: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['InstallPlatformAppResponse']+ }+ }+ }+ }+ PlatformAppInstallationsController_getPlatformAppInstallation: {+ parameters: {+ query?: never+ header?: never+ path: {+ installation_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['GetPlatformAppInstallationResponse']+ }+ }+ }+ }+ PlatformAppInstallationsController_uninstallPlatformInstallation: {+ parameters: {+ query?: never+ header?: never+ path: {+ installation_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }+ }+ }+ PlatformAppInstallationsController_updatePlatformAppInstallation: {+ parameters: {+ query?: never+ header?: never+ path: {+ installation_id: string+ /** @description Organization slug */+ slug: string+ }+ cookie?: never+ }+ requestBody?: never+ responses: {+ 200: {+ headers: {+ [name: string]: unknown+ }+ content: {+ 'application/json': components['schemas']['UpdatePlatformAppInstallationResponse']+ }+ }+ }+ }OrgAuditLogsController_getAuditLogs: {parameters: {query: {