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
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@ Do reach out to support if you have any concerns around this change.

- [Supabase - Get started for free](https://supabase.com)
- [Supabase JS Client](https://github.com/supabase/supabase-js)
- [LinkedIn Developer Dashboard](https://api.LinkedIn.com/apps)
- [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps)
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ For more advanced migrations, including the use of a middleware server component

## Enterprise

[Contact us](https://forms.supabase.com/enterprise) if you need more help migrating your project.
[Contact us](https://forms.supabase.com/firebase-migration) if you need more help migrating your project.
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ If the bucket doesn't exist, it's created as a `non-public` bucket. You must set

## Enterprise

[Contact us](https://forms.supabase.com/enterprise) if you need more help migrating your project.
[Contact us](https://forms.supabase.com/firebase-migration) if you need more help migrating your project.
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@ The result is two separate JSON files:

## Enterprise

[Contact us](https://forms.supabase.com/enterprise) if you need more help migrating your project.
[Contact us](https://forms.supabase.com/firebase-migration) if you need more help migrating your project.
4 changes: 4 additions & 0 deletions apps/docs/docs/ref/swift/installing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
- `Functions`
- `Storage`

If you use Xcode, follow [Apple's dependencies guide](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app) to add supabase-swift to your project. Use https://github.com/supabase-community/supabase-swift.git for the url when Xcode asks.

If you don't want the full Supabase environment, you can add individual packages, such as Functions, `Auth`, `Realtime`, `Storage`, or `PostgREST`.

</RefSubLayout.Details>

<RefSubLayout.Examples>
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/spec/supabase_swift_v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ functions:
name: Initialize Client
code: |
```swift
let client = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key")
let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key")
```
- id: initialize-client-custom-options
name: Initialize Client with custom options
code: |
```swift
let client = SupabaseClient(
let supabase = SupabaseClient(
supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,
supabaseKey: "public-anon-key",
options: SupabaseClientOptions(
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/spec/supabase_swift_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ functions:
```swift
import Supabase

let client = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key")
let supabase = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "public-anon-key")
```
- id: initialize-client-custom-options
name: Initialize Client with custom options
code: |
```swift
import Supabase

let client = SupabaseClient(
let supabase = SupabaseClient(
supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,
supabaseKey: "public-anon-key",
options: SupabaseClientOptions(
Expand Down Expand Up @@ -65,7 +65,7 @@ functions:
}
}

let client = SupabaseClient(
let supabase = SupabaseClient(
supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,
supabaseKey: "public-anon-key",
options: SupabaseClientOptions(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RenderEditCellProps } from 'react-data-grid'
import { useTableEditorTableStateSnapshot } from 'state/table-editor-table'
import { Select } from 'ui'

interface Props<TRow, TSummaryRow = unknown> extends RenderEditCellProps<TRow, TSummaryRow> {
Expand All @@ -13,8 +12,6 @@ export const BooleanEditor = <TRow, TSummaryRow = unknown>({
onRowChange,
onClose,
}: Props<TRow, TSummaryRow>) => {
const snap = useTableEditorTableStateSnapshot()
const gridColumn = snap.gridColumns.find((x) => x.name == column.key)
const value = row[column.key as keyof TRow] as unknown as string

const onBlur = () => onClose(false)
Expand All @@ -36,7 +33,7 @@ export const BooleanEditor = <TRow, TSummaryRow = unknown>({
onBlur={onBlur}
onChange={onChange}
defaultValue={value === null ? 'null' : value.toString()}
style={{ width: `${gridColumn?.width || column.width}px` }}
style={{ width: `${column.width}px` }}
>
<Select.Option value="true">TRUE</Select.Option>
<Select.Option value="false">FALSE</Select.Option>
Expand Down
10 changes: 3 additions & 7 deletions apps/studio/components/grid/components/editor/JsonEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { isTableLike } from 'data/table-editor/table-editor-types'
import { useGetCellValueMutation } from 'data/table-rows/get-cell-value-mutation'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { prettifyJSON, removeJSONTrailingComma, tryParseJson } from 'lib/helpers'
import { useTableEditorTableStateSnapshot } from 'state/table-editor-table'
import { Popover, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import { BlockKeys } from '../common/BlockKeys'
import { MonacoEditor } from '../common/MonacoEditor'
Expand Down Expand Up @@ -55,16 +54,13 @@ export const JsonEditor = <TRow, TSummaryRow = unknown>({
const { id: _id } = useParams()
const id = _id ? Number(_id) : undefined
const { data: project } = useSelectedProjectQuery()
const snap = useTableEditorTableStateSnapshot()

const { data: selectedTable } = useTableEditorQuery({
projectRef: project?.ref,
connectionString: project?.connectionString,
id,
})

const gridColumn = snap.gridColumns.find((x) => x.name == column.key)

const rawInitialValue = row[column.key as keyof TRow] as unknown
const initialValue =
rawInitialValue === null || rawInitialValue === undefined || typeof rawInitialValue === 'string'
Expand Down Expand Up @@ -161,13 +157,13 @@ export const JsonEditor = <TRow, TSummaryRow = unknown>({
overlay={
isTruncated && !isSuccess ? (
<div
style={{ width: `${gridColumn?.width || column.width}px` }}
style={{ width: `${column.width}px` }}
className="flex items-center justify-center flex-col relative"
>
<MonacoEditor
readOnly
onChange={() => {}}
width={`${gridColumn?.width || column.width}px`}
width={`${column.width}px`}
value={value ?? ''}
language="markdown"
/>
Expand All @@ -176,7 +172,7 @@ export const JsonEditor = <TRow, TSummaryRow = unknown>({
) : (
<BlockKeys value={value} onEscape={cancelChanges} onEnter={saveChanges}>
<MonacoEditor
width={`${gridColumn?.width || column.width}px`}
width={`${column.width}px`}
value={value ?? ''}
language="json"
readOnly={!isEditable}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { RenderEditCellProps } from 'react-data-grid'
import { Select } from 'ui'

import { useTableEditorTableStateSnapshot } from 'state/table-editor-table'

interface SelectEditorProps<TRow, TSummaryRow = unknown>
extends RenderEditCellProps<TRow, TSummaryRow> {
isNullable?: boolean
Expand All @@ -17,9 +15,6 @@ export function SelectEditor<TRow, TSummaryRow = unknown>({
options,
isNullable,
}: SelectEditorProps<TRow, TSummaryRow>) {
const snap = useTableEditorTableStateSnapshot()
const gridColumn = snap.gridColumns.find((x) => x.name == column.key)

const value = row[column.key as keyof TRow] as unknown as string

function onChange(event: any) {
Expand All @@ -42,7 +37,7 @@ export function SelectEditor<TRow, TSummaryRow = unknown>({
size="small"
defaultValue={value ?? ''}
className="sb-grid-select-editor !gap-2"
style={{ width: `${gridColumn?.width || column.width}px` }}
style={{ width: `${column.width}px` }}
// @ts-ignore
onChange={onChange}
onBlur={onBlur}
Expand Down
9 changes: 3 additions & 6 deletions apps/studio/components/grid/components/editor/TextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useTableEditorQuery } from 'data/table-editor/table-editor-query'
import { isTableLike } from 'data/table-editor/table-editor-types'
import { useGetCellValueMutation } from 'data/table-rows/get-cell-value-mutation'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { useTableEditorTableStateSnapshot } from 'state/table-editor-table'
import { Button, Popover, Tooltip, TooltipContent, TooltipTrigger, cn } from 'ui'
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
import { BlockKeys } from '../common/BlockKeys'
Expand All @@ -30,7 +29,6 @@ export const TextEditor = <TRow, TSummaryRow = unknown>({
isEditable?: boolean
onExpandEditor: (column: string, row: TRow) => void
}) => {
const snap = useTableEditorTableStateSnapshot()
const { id: _id } = useParams()
const id = _id ? Number(_id) : undefined
const { data: project } = useSelectedProjectQuery()
Expand All @@ -41,7 +39,6 @@ export const TextEditor = <TRow, TSummaryRow = unknown>({
id,
})

const gridColumn = snap.gridColumns.find((x) => x.name == column.key)
const rawValue = row[column.key as keyof TRow] as unknown
const initialValue = rawValue || rawValue === '' ? String(rawValue) : null
const [isPopoverOpen, setIsPopoverOpen] = useState(true)
Expand Down Expand Up @@ -114,13 +111,13 @@ export const TextEditor = <TRow, TSummaryRow = unknown>({
overlay={
isTruncated && !isSuccess ? (
<div
style={{ width: `${gridColumn?.width || column.width}px` }}
style={{ width: `${column.width}px` }}
className="flex items-center justify-center flex-col relative"
>
<MonacoEditor
readOnly
onChange={() => {}}
width={`${gridColumn?.width || column.width}px`}
width={`${column.width}px`}
value={value ?? ''}
language="markdown"
/>
Expand All @@ -134,7 +131,7 @@ export const TextEditor = <TRow, TSummaryRow = unknown>({
ignoreOutsideClicks={isConfirmNextModalOpen}
>
<MonacoEditor
width={`${gridColumn?.width || column.width}px`}
width={`${column.width}px`}
value={value ?? ''}
readOnly={!isEditable}
onChange={onChange}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// @ts-nocheck [Joshen] Temporarily silencing the TS checks here but please eventually remove
// it's cause the API types are conflicting a bit - API types have probably been updated for the UI here
// but the UI hasn't been updated yet to fit the new API types

import { Activity, ChevronLeft, ExternalLink, Search, X } from 'lucide-react'
import Link from 'next/link'
import { useEffect, useState } from 'react'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { toast } from 'sonner'

import { useParams } from 'common'
import { RoleImpersonationPopover } from 'components/interfaces/RoleImpersonationSelector'
import { InlineLink } from 'components/ui/InlineLink'
import { getKeys, useAPIKeysQuery } from 'data/api-keys/api-keys-query'
import { getTemporaryAPIKey } from 'data/api-keys/temp-api-keys-query'
import { useProjectPostgrestConfigQuery } from 'data/config/project-postgrest-config-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
Expand All @@ -27,12 +27,13 @@ export const RealtimeTokensPopover = ({ config, onChangeConfig }: RealtimeTokens
projectRef: config.projectRef,
reveal: true,
})
const { anonKey, serviceKey, publishableKey } = getKeys(apiKeys)
const { anonKey, publishableKey } = getKeys(apiKeys)

const { data: postgrestConfig } = useProjectPostgrestConfigQuery(
{ projectRef: config.projectRef },
{ enabled: IS_PLATFORM }
)

const jwtSecret = postgrestConfig?.jwt_secret

const { mutate: sendEvent } = useSendEventMutation()
Expand Down Expand Up @@ -62,12 +63,17 @@ export const RealtimeTokensPopover = ({ config, onChangeConfig }: RealtimeTokens
snap.role !== undefined &&
snap.role.type === 'postgrest'
) {
token = anonKey?.api_key
token = publishableKey?.api_key ?? anonKey?.api_key
await getRoleImpersonationJWT(config.projectRef, jwtSecret, snap.role)
.then((b) => (bearer = b))
.catch((err) => toast.error(`Failed to get JWT for role: ${err.message}`))
} else {
token = serviceKey?.api_key ?? publishableKey?.api_key
try {
const data = await getTemporaryAPIKey({ projectRef: config.projectRef })
token = data.api_key
} catch (error) {
token = publishableKey?.api_key
}
}
if (token) {
onChangeConfig({ ...config, token, bearer })
Expand All @@ -76,24 +82,7 @@ export const RealtimeTokensPopover = ({ config, onChangeConfig }: RealtimeTokens

triggerUpdateTokenBearer()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [snap.role, anonKey, serviceKey])
}, [snap.role, anonKey])

return (
<RoleImpersonationPopover
serviceRoleLabel={!serviceKey ? 'anon' : undefined}
disabled={!serviceKey}
disabledTooltip={
!serviceKey ? (
<>
Role impersonation for the Realtime Inspector is currently unavailable temporarily due
to the new API keys. Please re-enable{' '}
<InlineLink href={`/project/${ref}/settings/api-keys`}>legacy JWT keys</InlineLink> if
you'd like to use role impersonation with the Realtime Inspector.
</>
) : undefined
}
align="start"
variant="connected-on-both"
/>
)
return <RoleImpersonationPopover align="start" variant="connected-on-both" />
}
Loading
Loading