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
4 changes: 4 additions & 0 deletions .github/workflows/update-js-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
# Update @supabase/realtime-js
sed -i "s/'@supabase\/realtime-js': .*/'@supabase\/realtime-js': ${{ github.event.inputs.version }}/" pnpm-workspace.yaml
# Update @supabase/postgrest-js
sed -i "s/'@supabase\/postgrest-js': .*/'@supabase\/postgrest-js': ${{ github.event.inputs.version }}/" pnpm-workspace.yaml
echo "Updated pnpm-workspace.yaml:"
cat pnpm-workspace.yaml
Expand All @@ -69,6 +72,7 @@ jobs:
- Updated @supabase/supabase-js to ${{ github.event.inputs.version }}
- Updated @supabase/auth-js to ${{ github.event.inputs.version }}
- Updated @supabase/realtime-js to ${{ github.event.inputs.version }}
- Updated @supabase/postgest-js to ${{ github.event.inputs.version }}
- Refreshed pnpm-lock.yaml
This PR was created automatically.
Expand Down
41 changes: 9 additions & 32 deletions apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { memo, useState } from 'react'
import { useIsLoggedIn, useIsUserLoading, useUser } from 'common'
import { isFeatureEnabled } from 'common/enabled-features'
import { Button, buttonVariants, cn } from 'ui'
import { AuthenticatedDropdownMenu, CommandMenuTrigger } from 'ui-patterns'
import { AuthenticatedDropdownMenu, CommandMenuTriggerInput } from 'ui-patterns'
import { getCustomContent } from '../../../lib/custom-content/getCustomContent'
import GlobalNavigationMenu from './GlobalNavigationMenu'
import useDropdownMenu from './useDropdownMenu'
Expand Down Expand Up @@ -43,37 +43,14 @@ const TopNavBar: FC = () => {
</div>

<div className="flex gap-2 items-center">
<CommandMenuTrigger>
<button
className={cn(
'group',
'flex-grow md:w-44 xl:w-56 h-[30px] rounded-md',
'pl-1.5 md:pl-2 pr-1',
'flex items-center justify-between',
'bg-surface-100/75 text-foreground-lighter border',
'hover:bg-opacity-100 hover:border-strong',
'focus-visible:!outline-4 focus-visible:outline-offset-1 focus-visible:outline-brand-600',
'transition'
)}
>
<div className="flex items-center space-x-2 text-foreground-muted">
<Search size={18} strokeWidth={2} />
<p className="flex text-sm pr-2">
Search
<span className="hidden xl:inline ml-1"> docs...</span>
</p>
</div>
<div className="hidden md:flex items-center space-x-1">
<div
aria-hidden="true"
className="md:flex items-center justify-center h-full px-1 border rounded bg-surface-300 gap-0.5"
>
<Command size={12} strokeWidth={1.5} />
<span className="text-[12px]">K</span>
</div>
</div>
</button>
</CommandMenuTrigger>
<CommandMenuTriggerInput
placeholder={
<>
Search
<span className="hidden xl:inline ml-1"> docs...</span>
</>
}
/>
<button
title="Menu dropdown button"
className={cn(
Expand Down
73 changes: 72 additions & 1 deletion apps/docs/content/guides/auth/passwords.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,18 @@ client.auth.reset_password_email(
)
```
</TabPanel>
</$Show>
<$Show if="sdk:dart">
<TabPanel id="dart" label="Dart">
```dart
await supabase.auth.resetPasswordForEmail(
'[email protected]',
redirectTo: 'http://example.com/account/update-password',
);
```
</TabPanel>
</$Show>
</Tabs>
Expand Down Expand Up @@ -937,6 +949,15 @@ supabase.gotrue.sendRecoveryEmail(
supabase.auth.reset_password_email('[email protected]')
```
</TabPanel>
</$Show>
<$Show if="sdk:dart">
<TabPanel id="dart" label="Dart">
```dart
await supabase.auth.resetPasswordForEmail('[email protected]');
```
</TabPanel>
</$Show>
</Tabs>
Expand Down Expand Up @@ -992,6 +1013,17 @@ supabase.auth.updateUser {
supabase.auth.update_user({'password': 'new_password'})
```
</TabPanel>
</$Show>
<$Show if="sdk:dart">
<TabPanel id="dart" label="Dart">
```dart
final UserResponse res = await supabase.auth.updateUser(
UserAttributes(password: 'new_password'),
);
```
</TabPanel>
</$Show>
</Tabs>
Expand Down Expand Up @@ -1098,6 +1130,18 @@ supabase.auth.sign_up({
})
```
</TabPanel>
</$Show>
<$Show if="sdk:dart">
<TabPanel id="dart" label="Dart">
```dart
final AuthResponse res = await supabase.auth.signUp(
phone: '+13334445555',
password: 'some-password',
);
```
</TabPanel>
</$Show>
<TabPanel id="http" label="HTTP">
Expand Down Expand Up @@ -1187,6 +1231,21 @@ supabase.auth.verify_otp({
})
```
</TabPanel>
</$Show>
<$Show if="sdk:dart">
<TabPanel id="dart" label="Dart">
You should present a form to the user so they can input the 6 digit pin, then send it along with the phone number to `verifyOTP`:
```dart
final AuthResponse res = await supabase.auth.verifyOTP(
phone: '+13334445555',
token: '123456',
type: OtpType.sms,
);
```
</TabPanel>
</$Show>
<TabPanel id="http" label="HTTP">
Expand Down Expand Up @@ -1259,11 +1318,23 @@ supabase.auth.signInWith(Phone) {
```python
supabase.auth.sign_in_with_password({
'phone': "+13334445555"
'phone': "+13334445555",
'password': "some-password"
})
```
</TabPanel>
</$Show>
<$Show if="sdk:dart">
<TabPanel id="dart" label="Dart">
```dart
final AuthResponse res = await supabase.auth.signInWithPassword(
phone: '+13334445555',
password: 'some-password',
);
```
</TabPanel>
</$Show>
<TabPanel id="http" label="HTTP">
Expand Down
9 changes: 4 additions & 5 deletions apps/docs/features/app.providers.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { type PropsWithChildren } from 'react'
import type { PropsWithChildren } from 'react'

import { FeatureFlagProvider, IS_PLATFORM, ThemeProvider } from 'common'
import { SonnerToaster, TooltipProvider } from 'ui'
import { CommandProvider } from 'ui-patterns/CommandMenu'
import SiteLayout from '~/layouts/SiteLayout'
import { API_URL } from '~/lib/constants'
import { AuthContainer } from './auth/auth.client'
import { DocsCommandMenu } from './command'
import { DocsCommandMenu, DocsCommandProvider } from './command'
import { QueryClientProvider } from './data/queryClient.client'
import { PageTelemetry } from './telemetry/telemetry.client'
import { ScrollRestoration } from './ui/helpers.scroll.client'
Expand All @@ -24,15 +23,15 @@ function GlobalProviders({ children }: PropsWithChildren) {
<ScrollRestoration />
<ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
<TooltipProvider delayDuration={0}>
<CommandProvider>
<DocsCommandProvider>
<div className="flex flex-col">
<SiteLayout>
{children}
<DocsCommandMenu />
</SiteLayout>
<ThemeSandbox />
</div>
</CommandProvider>
</DocsCommandProvider>
<SonnerToaster position="top-right" />
</TooltipProvider>
</ThemeProvider>
Expand Down
16 changes: 16 additions & 0 deletions apps/docs/features/command/DocsCommandProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use client'

import type { PropsWithChildren } from 'react'

import { CommandProvider } from 'ui-patterns/CommandMenu'
import { useDocsCommandMenuTelemetry } from 'hooks/useDocsCommandMenuTelemetry'

export function DocsCommandProvider({ children }: PropsWithChildren) {
const { onTelemetry } = useDocsCommandMenuTelemetry()

return (
<CommandProvider app="docs" onTelemetry={onTelemetry}>
{children}
</CommandProvider>
)
}
3 changes: 2 additions & 1 deletion apps/docs/features/command/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dynamic from 'next/dynamic'

import { useCommandMenuInitiated } from 'ui-patterns/CommandMenu'
import { DocsCommandProvider } from './DocsCommandProvider'

const LazyCommandMenu = dynamic(() => import('./CommandMenu'), { ssr: false })

Expand All @@ -11,4 +12,4 @@ const DocsCommandMenu = () => {
return isInitiated && <LazyCommandMenu />
}

export { DocsCommandMenu }
export { DocsCommandMenu, DocsCommandProvider }
28 changes: 28 additions & 0 deletions apps/docs/hooks/useDocsCommandMenuTelemetry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use client'

import { useCallback } from 'react'

import type {
CommandMenuOpenedEvent,
CommandMenuCommandSelectedEvent,
CommandMenuSearchSubmittedEvent,
} from 'common/telemetry-constants'
import { useSendTelemetryEvent } from 'lib/telemetry'

export function useDocsCommandMenuTelemetry() {
const sendTelemetryEvent = useSendTelemetryEvent()

const onTelemetry = useCallback(
(
event:
| CommandMenuOpenedEvent
| CommandMenuCommandSelectedEvent
| CommandMenuSearchSubmittedEvent
) => {
sendTelemetryEvent(event)
},
[sendTelemetryEvent]
)

return { onTelemetry }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { PropsWithChildren } from 'react'

import { CommandProvider } from 'ui-patterns/CommandMenu'
import { useStudioCommandMenuTelemetry } from 'hooks/misc/useStudioCommandMenuTelemetry'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { LOCAL_STORAGE_KEYS } from 'common'

export function StudioCommandProvider({ children }: PropsWithChildren) {
const { onTelemetry } = useStudioCommandMenuTelemetry()
const [commandMenuHotkeyEnabled] = useLocalStorageQuery<boolean>(
LOCAL_STORAGE_KEYS.HOTKEY_COMMAND_MENU,
true
)

return (
<CommandProvider
app="studio"
onTelemetry={onTelemetry}
openKey={commandMenuHotkeyEnabled ? 'k' : ''}
>
{children}
</CommandProvider>
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { includes, noop, sortBy } from 'lodash'
import { Copy, Edit, Edit2, FileText, MoreVertical, Trash } from 'lucide-react'
import Link from 'next/link'
import { useRouter } from 'next/router'

import { ButtonTooltip } from 'components/ui/ButtonTooltip'
Expand All @@ -23,6 +24,8 @@ interface FunctionListProps {
schema: string
filterString: string
isLocked: boolean
returnTypeFilter: string[]
securityFilter: string[]
duplicateFunction: (fn: any) => void
editFunction: (fn: any) => void
deleteFunction: (fn: any) => void
Expand All @@ -32,6 +35,8 @@ const FunctionList = ({
schema,
filterString,
isLocked,
returnTypeFilter,
securityFilter,
duplicateFunction = noop,
editFunction = noop,
deleteFunction = noop,
Expand All @@ -45,9 +50,16 @@ const FunctionList = ({
connectionString: selectedProject?.connectionString,
})

const filteredFunctions = (functions ?? []).filter((x) =>
includes(x.name.toLowerCase(), filterString.toLowerCase())
)
const filteredFunctions = (functions ?? []).filter((x) => {
const matchesName = includes(x.name.toLowerCase(), filterString.toLowerCase())
const matchesReturnType =
returnTypeFilter.length === 0 || returnTypeFilter.includes(x.return_type)
const matchesSecurity =
securityFilter.length === 0 ||
(securityFilter.includes('definer') && x.security_definer) ||
(securityFilter.includes('invoker') && !x.security_definer)
return matchesName && matchesReturnType && matchesSecurity
})
const _functions = sortBy(
filteredFunctions.filter((x) => x.schema == schema),
(func) => func.name.toLocaleLowerCase()
Expand Down Expand Up @@ -100,16 +112,30 @@ const FunctionList = ({
{x.name}
</Button>
</TableCell>
<TableCell className="table-cell overflow-auto">
<p title={x.argument_types} className="truncate">
<TableCell className="table-cell">
<p title={x.argument_types} className="truncate text-foreground-light">
{x.argument_types || '-'}
</p>
</TableCell>
<TableCell className="table-cell">
<p title={x.return_type}>{x.return_type}</p>
{x.return_type === 'trigger' ? (
<Link
href={`/project/${projectRef}/database/triggers?search=${x.name}`}
className="truncate text-link"
title={x.return_type}
>
{x.return_type}
</Link>
) : (
<p title={x.return_type} className="truncate text-foreground-light">
{x.return_type}
</p>
)}
</TableCell>
<TableCell className="table-cell">
{x.security_definer ? 'Definer' : 'Invoker'}
<p className="truncate text-foreground-light">
{x.security_definer ? 'Definer' : 'Invoker'}
</p>
</TableCell>
<TableCell className="text-right">
{!isLocked && (
Expand Down
Loading
Loading