Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"prism-react-renderer": "^2.3.1",
"react": "catalog:",
"react-dom": "catalog:",
"sharp": "0.32.6",
"sharp": "~0.34.0",
"tailwind-merge": "^1.13.2",
"tsx": "^4.19.3",
"typescript": "catalog:"
Expand Down
91 changes: 64 additions & 27 deletions apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { HardenAPIModal } from './HardenAPIModal'
const formSchema = z
.object({
dbSchema: z.array(z.string()),
dbExtraSearchPath: z.string(),
dbExtraSearchPath: z.array(z.string()),
maxRows: z.number().max(1000000, "Can't be more than 1,000,000"),
dbPool: z
.number()
Expand Down Expand Up @@ -84,15 +84,26 @@ export const PostgrestConfig = () => {

const [showModal, setShowModal] = useState(false)

const { data: config, isError, isLoading } = useProjectPostgrestConfigQuery({ projectRef })
const {
data: config,
isError,
isLoading: isLoadingConfig,
} = useProjectPostgrestConfigQuery({ projectRef })
const { data: extensions } = useDatabaseExtensionsQuery({
projectRef: project?.ref,
connectionString: project?.connectionString,
})
const { data: schemas, isLoading: isLoadingSchemas } = useSchemasQuery({
const {
data: allSchemas = [],
isLoading: isLoadingSchemas,
isSuccess: isSuccessSchemas,
} = useSchemasQuery({
projectRef: project?.ref,
connectionString: project?.connectionString,
})

const isLoading = isLoadingConfig || isLoadingSchemas

const { mutate: updatePostgrestConfig, isLoading: isUpdating } =
useProjectPostgrestConfigUpdateMutation({
onSuccess: () => {
Expand All @@ -112,7 +123,10 @@ export const PostgrestConfig = () => {
const defaultValues = {
dbSchema,
maxRows: config?.max_rows,
dbExtraSearchPath: config?.db_extra_search_path,
dbExtraSearchPath: (config?.db_extra_search_path ?? '')
.split(',')
.map((x) => x.trim())
.filter((x) => x.length > 0 && allSchemas.find((y) => y.name === x)),
dbPool: config?.db_pool,
}

Expand All @@ -122,9 +136,9 @@ export const PostgrestConfig = () => {
defaultValues,
})

const schema =
schemas
?.filter((x) => {
const schemas =
allSchemas
.filter((x) => {
const find = indexOf(hiddenSchema, x.name)
if (find < 0) return x
})
Expand All @@ -149,20 +163,20 @@ export const PostgrestConfig = () => {
projectRef,
dbSchema: values.dbSchema.join(', '),
maxRows: values.maxRows,
dbExtraSearchPath: values.dbExtraSearchPath,
dbExtraSearchPath: values.dbExtraSearchPath.join(','),
dbPool: values.dbPool ? values.dbPool : null,
})
}

useEffect(() => {
if (config) {
if (config && isSuccessSchemas) {
/**
* Checks if enableDataApi should be enabled or disabled
* based on the db_schema value being empty string
*/
resetForm()
}
}, [config])
}, [config, isSuccessSchemas])

const isDataApiEnabledInForm = form.getValues('enableDataApi')

Expand Down Expand Up @@ -277,21 +291,16 @@ export const PostgrestConfig = () => {
/>
<MultiSelectorContent>
<MultiSelectorList>
{schema.length <= 0 ? (
{schemas.length <= 0 ? (
<MultiSelectorItem key="empty" value="no">
no
</MultiSelectorItem>
) : (
<>
{schema.map((x) => (
<MultiSelectorItem
key={x.id + '-' + x.name}
value={x.name}
>
{x.name}
</MultiSelectorItem>
))}
</>
schemas.map((x) => (
<MultiSelectorItem key={x.id + '-' + x.name} value={x.name}>
{x.name}
</MultiSelectorItem>
))
)}
</MultiSelectorList>
</MultiSelectorContent>
Expand Down Expand Up @@ -341,15 +350,43 @@ export const PostgrestConfig = () => {
className="w-full px-8 py-8"
layout="horizontal"
label="Extra search path"
description="Extra schemas to add to the search path of every request. Multiple schemas must be comma-separated."
description="Extra schemas to add to the search path of every request."
>
<FormControl_Shadcn_>
<Input_Shadcn_
{isLoadingSchemas ? (
<div className="col-span-12 flex flex-col gap-2 lg:col-span-7">
<Skeleton className="w-full h-[38px]" />
</div>
) : (
<MultiSelector
onValuesChange={field.onChange}
values={field.value}
size="small"
disabled={!canUpdatePostgrestConfig || !isDataApiEnabledInForm}
{...field}
/>
</FormControl_Shadcn_>
>
<MultiSelectorTrigger
mode="inline-combobox"
label="Select schemas to add to search path..."
badgeLimit="wrap"
showIcon={false}
deletableBadge
/>
<MultiSelectorContent>
<MultiSelectorList>
{allSchemas.length <= 0 ? (
<MultiSelectorItem key="empty" value="no">
no
</MultiSelectorItem>
) : (
allSchemas.map((x) => (
<MultiSelectorItem key={x.id + '-' + x.name} value={x.name}>
{x.name}
</MultiSelectorItem>
))
)}
</MultiSelectorList>
</MultiSelectorContent>
</MultiSelector>
)}
</FormItemLayout>
</FormItem_Shadcn_>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { AlertCircle } from 'lucide-react'
import { useParams } from 'common'
import { ScaffoldSection } from 'components/layouts/Scaffold'
import DatabaseSelector from 'components/ui/DatabaseSelector'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useCustomDomainsQuery } from 'data/custom-domains/custom-domains-query'
import { useLoadBalancersQuery } from 'data/read-replicas/load-balancers-query'
import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'
Expand All @@ -13,6 +12,7 @@ import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import { Alert_Shadcn_, AlertTitle_Shadcn_, Badge, Card, CardContent, CardHeader } from 'ui'
import { Input } from 'ui-patterns/DataInputs/Input'
import { FormLayout } from 'ui-patterns/form/Layout/FormLayout'
import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'
import { PostgrestConfig } from './PostgrestConfig'

export const ServiceList = () => {
Expand Down Expand Up @@ -65,7 +65,10 @@ export const ServiceList = () => {
</CardHeader>
<CardContent>
{isLoading || isLoadingDatabases ? (
<GenericSkeletonLoader />
<div className="space-y-2">
<ShimmeringLoader className="py-3.5" />
<ShimmeringLoader className="py-3.5 w-3/4" delayIndex={1} />
</div>
) : isError ? (
<Alert_Shadcn_ variant="destructive">
<AlertCircle size={16} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ function getErrorCondition(table: LogsTableName): string {
case 'postgres_logs':
return "parsed.error_severity IN ('ERROR', 'FATAL', 'PANIC')"
case 'auth_logs':
return "metadata.level = 'error' OR metadata.status >= 400"
return "metadata.level = 'error' OR SAFE_CAST(metadata.status AS INT64) >= 400"
case 'function_edge_logs':
return 'response.status_code >= 500'
case 'function_logs':
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"monaco-editor": "0.52.2",
"next": "catalog:",
"next-themes": "^0.3.0",
"nuqs": "2.7.0",
"nuqs": "^2.7.0",
"openai": "^4.75.1",
"openapi-fetch": "0.12.4",
"papaparse": "^5.3.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/ui-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@supabase/supa-mdx-lint": "0.2.6-alpha",
"@tanstack/react-query": "^5.83.0",
"@supabase/vue-blocks": "workspace:*",
"axios": "^1.11.0",
"axios": "^1.12.0",
"class-variance-authority": "*",
"cmdk": "^1.0.0",
"common": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"url": "git+https://github.com/supabase/supabase.git"
},
"engines": {
"pnpm": ">=10.16",
"pnpm": "10.18",
"node": ">=22"
},
"keywords": ["postgres", "firebase", "storage", "functions", "database", "auth"],
"packageManager": "pnpm@10.16.1"
"packageManager": "pnpm@10.18.0"
}
Loading
Loading