The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: adds base for S3 wrapper UI
Alaister Young585d4a2521f3
diff --git a/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsx b/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsxindex 242345a01f7..574355c3ae3 100644--- a/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsx+++ b/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsx@@ -139,9 +139,9 @@ const CreateWrapper = () => {</a></Link></div>- <h3 className="mb-2 text-xl text-scale-1200">Create a {wrapperMeta?.label} Wrapper</h3>+ <h3 className="mb-2 text-xl text-scale-1200">Create a {wrapperMeta.label} Wrapper</h3><div className="flex items-center space-x-2">- <Link href="https://supabase.github.io/wrappers/stripe/">+ <Link href={wrapperMeta.docsUrl}><a target="_blank"><Button type="default" icon={<IconExternalLink strokeWidth={1.5} />}>Documentationdiff --git a/studio/components/interfaces/Database/Wrappers/WrapperTableEditor.tsx b/studio/components/interfaces/Database/Wrappers/WrapperTableEditor.tsxindex 7aa5d2fefad..eed4fa1e172 100644--- a/studio/components/interfaces/Database/Wrappers/WrapperTableEditor.tsx+++ b/studio/components/interfaces/Database/Wrappers/WrapperTableEditor.tsx@@ -1,5 +1,5 @@import { useEffect, useState } from 'react'-import { Form, IconDatabase, Input, Listbox, SidePanel, Modal, IconPlus } from 'ui'+import { Form, IconDatabase, Input, Listbox, SidePanel, Modal, IconPlus, Select } from 'ui'import { useStore } from 'hooks'import { Table, TableOption } from './Wrappers.types'import { makeValidateRequired } from './Wrappers.utils'@@ -68,6 +68,7 @@ const WrapperTableEditor = ({<SidePanel.Content><div className="mt-4 space-y-6"><Listbox+ size="small"label="Select a target the table will point to"value={selectedTableIndex}onChange={(value) => setSelectedTableIndex(value)}@@ -105,6 +106,55 @@ const WrapperTableEditor = ({export default WrapperTableEditorconst Option = ({ option }: { option: TableOption }) => {+ if (option.type === 'select') {+ // NOTE(alaister): We have this annoying workaround because Listbox+ // doesn't support conditional rendering inside of it++ return option.required ? (+ <Listbox+ key={option.name}+ id={option.name}+ name={option.name}+ label={option.label}+ defaultValue={option.defaultValue ?? ''}+ >+ {option.options.map((subOption) => (+ <Listbox.Option+ key={subOption.value}+ id={option.name + subOption.value}+ value={subOption.value}+ label={subOption.label}+ >+ {subOption.label}+ </Listbox.Option>+ ))}+ </Listbox>+ ) : (+ <Listbox+ key={option.name}+ id={option.name}+ name={option.name}+ label={option.label}+ defaultValue={option.defaultValue ?? ''}+ >+ <Listbox.Option key="empty" value="" label="---">+ ---+ </Listbox.Option>++ {option.options.map((subOption) => (+ <Listbox.Option+ key={subOption.value}+ id={option.name + subOption.value}+ value={subOption.value}+ label={subOption.label}+ >+ {subOption.label}+ </Listbox.Option>+ ))}+ </Listbox>+ )+ }+return (<Inputkey={option.name}@@ -139,7 +189,7 @@ const TableForm = ({const initialValues = initialData ?? {table_name: '',- columns: table.availableColumns.map((column) => column.name),+ columns: table.availableColumns ? table.availableColumns.map((column) => column.name) : [],...Object.fromEntries(table.options.map((option) => [option.name, option.defaultValue ?? ''])),schema: 'public',schema_name: '',@@ -204,7 +254,7 @@ const TableForm = ({<div className="form-group"><label className="!w-full">Select the columns to be added to your table</label><div className="flex flex-wrap gap-2">- {table.availableColumns.map((column) => {+ {table.availableColumns?.map((column) => {const isSelected = values.columns.includes(column.name)return (<divdiff --git a/studio/components/interfaces/Database/Wrappers/Wrappers.constants.ts b/studio/components/interfaces/Database/Wrappers/Wrappers.constants.tsindex cbb51c09408..92109c1a6d1 100644--- a/studio/components/interfaces/Database/Wrappers/Wrappers.constants.ts+++ b/studio/components/interfaces/Database/Wrappers/Wrappers.constants.ts@@ -8,7 +8,7 @@ export const WRAPPERS: WrapperMeta[] = [icon: '/img/icons/stripe-icon.svg',extensionName: 'StripeFdw',label: 'Stripe',- docsUrl: 'https://supabase.com/docs/guides/database/wrappers/stripe',+ docsUrl: 'https://supabase.github.io/wrappers/stripe/',server: {options: [{@@ -57,6 +57,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'balance',editable: false,required: true,+ type: 'text',},],},@@ -111,6 +112,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'balance_transactions',editable: false,required: true,+ type: 'text',},],},@@ -165,6 +167,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'charges',editable: false,required: true,+ type: 'text',},],},@@ -203,6 +206,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'customers',editable: false,required: true,+ type: 'text',},// {// name: 'rowid_column',@@ -260,6 +264,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'invoices',editable: false,required: true,+ type: 'text',},],},@@ -302,6 +307,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'payment_intents',editable: false,required: true,+ type: 'text',},],},@@ -348,6 +354,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'products',editable: false,required: true,+ type: 'text',},// {// name: 'rowid_column',@@ -393,6 +400,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'subscriptions',editable: false,required: true,+ type: 'text',},// {// name: 'rowid_column',@@ -412,7 +420,7 @@ export const WRAPPERS: WrapperMeta[] = [icon: '/img/icons/firebase-icon.svg',extensionName: 'FirebaseFdw',label: 'Firebase',- docsUrl: 'https://supabase.com/docs/guides/database/wrappers/firebase',+ docsUrl: 'https://supabase.github.io/wrappers/firebase/',server: {options: [{@@ -470,6 +478,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'auth/users',editable: false,required: true,+ type: 'text',},{name: 'base_url',@@ -477,6 +486,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'https://identitytoolkit.googleapis.com/v1/projects',editable: true,required: true,+ type: 'text',},{name: 'limit',@@ -484,6 +494,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: '10000',editable: true,required: true,+ type: 'text',},],},@@ -515,6 +526,7 @@ export const WRAPPERS: WrapperMeta[] = [placeholder: 'firestore/[collection_id]',editable: true,required: true,+ type: 'text',},{name: 'base_url',@@ -522,6 +534,7 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: 'https://firestore.googleapis.com/v1beta1/projects',editable: true,required: true,+ type: 'text',},{name: 'limit',@@ -529,6 +542,90 @@ export const WRAPPERS: WrapperMeta[] = [defaultValue: '10000',editable: true,required: true,+ type: 'text',+ },+ ],+ },+ ],+ },+ {+ name: 's3_wrapper',+ handlerName: 's3_fdw_handler',+ validatorName: 's3_fdw_validator',+ icon: '/img/icons/s3-icon.svg',+ extensionName: 'S3Fdw',+ label: 'S3',+ docsUrl: 'https://supabase.github.io/wrappers/s3/',+ server: {+ options: [+ {+ name: 'vault_access_key_id',+ label: 'Access Key ID',+ required: true,+ encrypted: true,+ hidden: false,+ },+ {+ name: 'vault_secret_access_key',+ label: 'Access Key Secret',+ required: true,+ encrypted: true,+ hidden: false,+ },+ {+ name: 'aws_region',+ label: 'AWS Region',+ required: true,+ encrypted: false,+ hidden: false,+ defaultValue: 'us-east-1',+ },+ ],+ },+ tables: [+ {+ label: 'S3 File',+ description: 'Map to a file in S3',+ options: [+ {+ name: 'uri',+ label: 'URI',+ editable: true,+ required: true,+ placeholder: 's3://bucket/s3_table.csv',+ type: 'text',+ },+ {+ name: 'format',+ label: 'Format',+ editable: true,+ required: true,+ type: 'select',+ defaultValue: 'csv',+ options: [+ { label: 'CSV', value: 'csv' },+ { label: 'JSONL (JSON Lines)', value: 'jsonl' },+ ],+ },+ {+ name: 'has_header',+ label: 'Has Header',+ editable: true,+ required: false,+ type: 'select',+ defaultValue: 'true',+ options: [+ { label: 'True', value: 'true' },+ { label: 'False', value: 'false' },+ ],+ },+ {+ name: 'compress',+ label: 'Compression',+ editable: true,+ required: false,+ type: 'select',+ options: [{ label: 'GZIP', value: 'gzip' }],},],},diff --git a/studio/components/interfaces/Database/Wrappers/Wrappers.types.ts b/studio/components/interfaces/Database/Wrappers/Wrappers.types.tsindex c0da532e9f1..d5b57e66937 100644--- a/studio/components/interfaces/Database/Wrappers/Wrappers.types.ts+++ b/studio/components/interfaces/Database/Wrappers/Wrappers.types.ts@@ -25,19 +25,33 @@ export type Server = {options: ServerOption[]}-export type TableOption = {- name: string- defaultValue?: string- editable: boolean- required: boolean- label?: string- placeholder?: string-}+export type TableOption =+ | {+ name: string+ defaultValue?: string+ editable: boolean+ required: boolean+ label?: string+ placeholder?: string+ type: 'text'+ }+ | {+ name: string+ defaultValue?: string+ editable: boolean+ required: boolean+ label?: string+ type: 'select'+ options: {+ label: string+ value: string+ }[]+ }export type Table = {label: stringdescription?: string- availableColumns: AvailableColumn[]+ availableColumns?: AvailableColumn[]options: TableOption[]}diff --git a/studio/public/img/icons/s3-icon.svg b/studio/public/img/icons/s3-icon.svgnew file mode 100644index 00000000000..00dbbd82a51--- /dev/null+++ b/studio/public/img/icons/s3-icon.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" preserveAspectRatio="xMidYMid" viewBox="-27 0 310 310"><path fill="#8C3123" d="M20.624 53.686 0 64v181.02l20.624 10.254.124-.149V53.828l-.124-.142"/><path fill="#E05243" d="M131 229 20.624 255.274V53.686L131 79.387V229"/><path fill="#8C3123" d="m81.178 187.866 46.818 5.96.294-.678.263-76.77-.557-.6-46.818 5.874v66.214"/><path fill="#8C3123" d="m127.996 229.295 107.371 26.035.169-.269-.003-201.195-.17-.18-107.367 25.996v149.613"/><path fill="#E05243" d="m174.827 187.866-46.831 5.96v-78.048l46.831 5.874v66.214"/><path fill="#5E1F18" d="m174.827 89.631-46.831 8.535-46.818-8.535 46.759-12.256 46.89 12.256"/><path fill="#F2B0A9" d="m174.827 219.801-46.831-8.591-46.818 8.591 46.761 13.053 46.888-13.053"/><path fill="#8C3123" d="m81.178 89.631 46.818-11.586.379-.117V.313L127.996 0 81.178 23.413v66.218"/><path fill="#E05243" d="m174.827 89.631-46.831-11.586V0l46.831 23.413v66.218"/><path fill="#8C3123" d="m127.996 309.428-46.823-23.405v-66.217l46.823 11.582.689.783-.187 75.906-.502 1.351"/><path fill="#E05243" d="m127.996 309.428 46.827-23.405v-66.217l-46.827 11.582v78.04M235.367 53.686 256 64v181.02l-20.633 10.31V53.686"/></svg>\ No newline at end of file