diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 57849f5e09a..7e2b99fa05d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,3 +2,4 @@ /apps/www/ @supabase/frontend /apps/docs/ @supabase/docs /spec/ @supabase/docs +/docker/ @supabase/cli diff --git a/README.md b/README.md index 4c35921e1a5..4a6e2f223da 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Our approach for client libraries is modular. Each sub-library is a standalone i - gotrue-java - - - + storage-java - diff --git a/about/package-lock.json b/about/package-lock.json index 546a81ba1e7..4ec443b7240 100644 --- a/about/package-lock.json +++ b/about/package-lock.json @@ -5158,9 +5158,9 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" }, "decompress-response": { "version": "3.3.0", diff --git a/apps/docs/components/DocSearch.tsx b/apps/docs/components/DocSearch.tsx index 2a4f56d1e48..7ff1a5ece2a 100644 --- a/apps/docs/components/DocSearch.tsx +++ b/apps/docs/components/DocSearch.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback, useRef, createContext, useContext, useEffect } from 'react' +import { useState, useCallback, useRef, createContext, useContext, useEffect, memo } from 'react' import { createPortal } from 'react-dom' import Link from 'next/link' import Head from 'next/head' @@ -84,7 +84,7 @@ export function SearchProvider({ children }: any) { hitComponent={Hit} transformItems={(items) => { return items.map((item, index) => { - console.log('item', item) + // console.log('item', item) // We transform the absolute URL into a relative URL to // leverage Next's preloading. const a = document.createElement('a') diff --git a/apps/docs/components/Footer/DarkModeToggle.tsx b/apps/docs/components/Footer/DarkModeToggle.tsx deleted file mode 100644 index 04f9d225854..00000000000 --- a/apps/docs/components/Footer/DarkModeToggle.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { useTheme } from 'common/Providers' -import { IconSun, IconMoon } from '@supabase/ui' - -function DarkModeToggle() { - const { isDarkMode, toggleTheme } = useTheme() - - const toggleDarkMode = () => { - localStorage.setItem('supabaseDarkMode', (!isDarkMode).toString()) - toggleTheme() - - const key = localStorage.getItem('supabaseDarkMode') - document.documentElement.className = key === 'true' ? 'dark' : '' - } - - return ( -
- - - -
- ) -} - -export default DarkModeToggle diff --git a/apps/docs/components/Footer/index.tsx b/apps/docs/components/Footer/index.tsx deleted file mode 100644 index 01424c906f5..00000000000 --- a/apps/docs/components/Footer/index.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import { Badge } from 'ui' -import Link from 'next/link' -import Image from 'next/image' -import FooterLinks from 'data/footer.json' -import DarkModeToggle from './DarkModeToggle' -import { useTheme } from 'common/Providers' -import * as supabaseLogoWordmarkDark from 'common/assets/images/supabase-logo-wordmark--dark.png' -import * as supabaseLogoWordmarkLight from 'common/assets/images/supabase-logo-wordmark--light.png' - -const Footer = () => { - const { isDarkMode } = useTheme() - - return ( - - ) -} - -export default Footer diff --git a/apps/docs/components/FooterHelpCallout.tsx b/apps/docs/components/FooterHelpCallout.tsx index 82f1a03c683..2eb6421dc4c 100644 --- a/apps/docs/components/FooterHelpCallout.tsx +++ b/apps/docs/components/FooterHelpCallout.tsx @@ -1,11 +1,13 @@ const FooterHelpCallout = () => { return ( -
-
Need some help?
-

- Not to worry, our specialist engineers are here to help. Submit a support ticket through the{' '} - Dashboard. -

+
+
+
Need some help?
+

+ Not to worry, our specialist engineers are here to help. Submit a support ticket through + the Dashboard. +

+
) } diff --git a/apps/docs/components/Navigation/Footer.tsx b/apps/docs/components/Navigation/Footer.tsx new file mode 100644 index 00000000000..cbbb215e7a6 --- /dev/null +++ b/apps/docs/components/Navigation/Footer.tsx @@ -0,0 +1,56 @@ +import Image from 'next/image' +import Link from 'next/link' +import { Button, IconGitHub, IconTwitter } from '~/../../packages/ui' +import footerData from '~/data/footer.json' +import { useTheme } from 'common/Providers' + +const Footer = () => { + const { isDarkMode } = useTheme() + return ( +
+
+
+
+ Supabase 2022 + — + {footerData.map((item) => ( + + {item.title} + + ))} +
+
+ + +
+
+
+ ) +} + +export default Footer diff --git a/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx index a769976a8a4..9a1f712f859 100644 --- a/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/HomeMenu.tsx @@ -1,8 +1,8 @@ +import { useTheme } from 'common/Providers' import Image from 'next/image' import Link from 'next/link' import { useRouter } from 'next/router' -import { useMenuLevelId } from '~/hooks/useMenuState' -import { useTheme } from 'common/Providers' +import { Fragment } from 'react' const home = [ [ @@ -64,6 +64,12 @@ const home = [ href: '/guides/resources', level: 'resources', }, + { + label: 'Self-Hosting', + icon: '/img/icons/menu/platform', + href: '/guides/self-hosting', + level: 'self_hosting', + }, { label: 'Integrations', icon: '/img/icons/menu/integrations', @@ -106,8 +112,7 @@ const home = [ ], ] -const NavigationMenuHome = () => { - const level = useMenuLevelId() +const NavigationMenuHome = ({ active }) => { const router = useRouter() const { isDarkMode } = useTheme() @@ -115,15 +120,13 @@ const NavigationMenuHome = () => {
- + ) })} diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts index 6a210a4cf67..d9837f2ea65 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts @@ -14,7 +14,7 @@ export const REFERENCES: References = { name: 'supabase-js', library: 'supabase-js', versions: ['v2', 'v1'], - icon: '/docs/img/libraries/javascript-icon.svg', + icon: '/img/libraries/javascript-icon', }, dart: { name: 'Flutter', @@ -570,45 +570,37 @@ export const resources = { }, ], }, - { - name: 'Self-Hosting', - items: [ - { name: 'Overview', url: '/guides/resources/self-hosting', items: [] }, - { name: 'Docker', url: '/guides/resources/self-hosting/docker', items: [] }, - ], - }, - { - name: 'Self-Hosting Reference', - items: [ - { - name: 'Auth Server', - url: '/reference/self-hosting-auth/introduction', - icon: '/img/icons/menu/reference-auth', - items: [], - }, - { - name: 'Storage Server', - url: '/reference/self-hosting-storage/introduction', - icon: '/img/icons/menu/reference-storage', - items: [], - }, - { - name: 'Realtime Server', - url: '/reference/self-hosting-realtime/introduction', - icon: '/img/icons/menu/reference-realtime', - items: [], - }, - ], - }, ], } -export const selfHosting = { - label: 'Self-Hosting', +export const self_hosting = { + title: 'Self-Hosting', + icon: 'resources', url: '/guides/self-hosting', items: [ - { name: 'Overview', url: '/guides/hosting/overview', items: [] }, - { name: 'Docker', url: '/guides/hosting/docker', items: [] }, + { name: 'Overview', url: '/guides/self-hosting', items: [] }, + { name: 'Self-Hosting with Docker', url: '/guides/self-hosting/docker', items: [] }, + { + name: 'Auth Server', + items: [ + { name: 'Reference', url: '/reference/self-hosting-auth/introduction', items: [] }, + { name: 'Configuration', url: '/guides/self-hosting/auth/config', items: [] }, + ], + }, + { + name: 'Storage Server', + items: [ + { name: 'Reference', url: '/reference/self-hosting-storage/introduction', items: [] }, + { name: 'Configuration', url: '/guides/self-hosting/storage/config', items: [] }, + ], + }, + { + name: 'Realtime Server', + items: [ + { name: 'Reference', url: '/reference/self-hosting-realtime/introduction', items: [] }, + { name: 'Configuration', url: '/guides/self-hosting/realtime/config', items: [] }, + ], + }, ], } @@ -696,22 +688,22 @@ export const reference = { url: '/reference/javascript/start', level: 'reference_javascript', items: [], - icon: 'docs/img/icons/javascript.svg', + icon: '/img/icons/menu/reference-javascript', }, { name: 'supabase-dart', url: '/reference/dart/start', level: 'reference_dart', items: [], - icon: 'docs/img/icons/javascript.svg', - }, - { - name: 'supbase-python', - url: '/reference/python/start', - level: 'reference_python', - items: [], - icon: 'docs/img/icons/javascript.svg', + icon: '/img/icons/menu/reference-dart', }, + // { + // name: 'supabase-python', + // url: '/reference/python/start', + // level: 'reference_python', + // items: [], + // icon: '/img/icons/menu/reference-javascript', + // }, ], }, { @@ -721,13 +713,13 @@ export const reference = { name: 'Supabase CLI', url: '/reference/cli/start', items: [], - icon: 'docs/img/icons/cli-icon.svg', + icon: '/img/icons/menu/reference-cli', }, { name: 'Management API', url: '/reference/javascript', items: [], - icon: 'docs/img/icons/javascript-icon.svg', + icon: '/img/icons/menu/reference-api', }, ], }, diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx index 5a945b965c5..cfb4d87b143 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx @@ -1,6 +1,6 @@ import { useRouter } from 'next/router' import { memo, useEffect } from 'react' -import { menuState } from '~/hooks/useMenuState' +import { menuState, useMenuLevelId } from '~/hooks/useMenuState' import NavigationMenuGuideList from './NavigationMenuGuideList' import NavigationMenuRefList from './NavigationMenuRefList' // @ts-expect-error @@ -22,7 +22,7 @@ import { flattenSections } from '~/lib/helpers' import NavigationMenuHome from './HomeMenu' // Filter libCommonSections for just the relevant sections in the current library -function generateAllowedClientLibKeys(sections, spec) { +export function generateAllowedClientLibKeys(sections, spec) { // Filter parent sections first const specIds = spec.functions.map((func) => { @@ -62,7 +62,7 @@ export type RefKeyOptions = | 'self-hosting-storage' | 'self-hosting-realtime' -const SideNav = () => { +const NavigationMenu = () => { const router = useRouter() let version = '' @@ -104,6 +104,9 @@ const SideNav = () => { case url.includes(`/docs/guides/resources`) && url: menuState.setMenuLevelId('resources') break + case url.includes(`/docs/guides/self-hosting`) && url: + menuState.setMenuLevelId('self_hosting') + break case url.includes(`/docs/guides/integrations`) && url: menuState.setMenuLevelId('integrations') break @@ -153,59 +156,91 @@ const SideNav = () => { } }, [router.events]) + const level = useMenuLevelId() + + const isHomeActive = 'home' === level + const isGettingStartedActive = 'gettingstarted' === level + const isDatabaseActive = 'database' === level + const isAuthActive = 'auth' === level + const isFunctionsActive = 'functions' === level + const isRealtimeActive = 'realtime' === level + const isStorageActive = 'storage' === level + const isPlatformActive = 'platform' === level + const isResourcesActive = 'resources' === level + const isSelfHosting = 'self_hosting' === level + const isIntegrationsActive = 'integrations' === level + const isReferenceActive = 'reference' === level + + const isReference_Javascript_V1 = 'reference_javascript_v1' === level + const isReference_Javascript_V2 = 'reference_javascript_v2' === level + const isReference_Dart_V0 = 'reference_dart_v0' === level + const isReference_Dart_V1 = 'reference_dart_v1' === level + const isReference_Cli = 'reference_cli' === level + const isReference_Api = 'reference_api' === level + const isReference_Self_Hosting_Auth = 'reference_self_hosting_auth' === level + const isReference_Self_Hosting_Storage = 'reference_self_hosting_storage' === level + const isReference_Self_Hosting_Realtime = 'reference_self_hosting_realtime' === level + return ( -
+
{/* // main menu */} - - - - - - - - - - - + + + + + + + + + + + + {/* // Client Libs */} {/* // Tools */} @@ -213,18 +248,21 @@ const SideNav = () => { @@ -232,4 +270,4 @@ const SideNav = () => { ) } -export default memo(SideNav) +export default memo(NavigationMenu) diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.utils.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.utils.ts new file mode 100644 index 00000000000..ad3d100450f --- /dev/null +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.utils.ts @@ -0,0 +1,6 @@ +// check if the link is allowed to be displayed +export function isFuncNotInLibraryOrVersion(id, type, allowedKeys) { + if (id && allowedKeys && !allowedKeys.includes(id) && type !== 'markdown') { + return true + } +} diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx index 782544c57cd..e4a7eb5c8f7 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx @@ -140,28 +140,6 @@ const NavigationMenuCliList = ({ currentLevel, setLevel, id }) => { - {menu.extras && ( - <> - {' '} - - Resources - - - )} - {menu.extras?.map((x) => { - return ( - - ) - })}
) diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx index 40e03fa6184..b0a5a9c78e1 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx @@ -1,32 +1,20 @@ import * as Accordion from '@radix-ui/react-accordion' -import { useTheme } from 'common/Providers' -import Image from 'next/image' -import Link from 'next/link' import { useRouter } from 'next/router' import React from 'react' -import { IconChevronLeft } from '~/../../packages/ui' -import { useMenuLevelId } from '~/hooks/useMenuState' -import * as NavItems from './NavigationMenu.constants' +import NavigationMenuGuideListItems from './NavigationMenuGuideListItems' interface Props { id: string - setMenuLevelId?: any + active: boolean } -const NavigationMenuGuideList: React.FC = ({ id, setMenuLevelId }) => { +const NavigationMenuGuideList: React.FC = ({ id, active }) => { const router = useRouter() - const { isDarkMode } = useTheme() - - const menu = NavItems[id] - - //console.log(id, 'url is:', menu.url) // get url const url = router.asPath // remove the end of the url if a deep link const firstLevelRoute = url?.split('/')?.slice(0, 4)?.join('/') - const level = useMenuLevelId() - return ( = ({ id, setMenuLevelId }) => { className={[ 'transition-all ml-8 duration-150 ease-out', // enabled - level === id && 'opacity-100 ml-0 delay-150', - level === 'home' && 'ml-12', + active && 'opacity-100 ml-0 delay-150', + // level === 'home' && 'ml-12', // disabled - level !== 'home' && level !== id ? '-ml-8' : '', - level !== id ? 'opacity-0 invisible absolute' : '', + // level !== 'home' && level !== id ? '-ml-8' : '', + !active ? 'opacity-0 invisible absolute' : '', ].join(' ')} > -
- - - - {menu.items.map((x, index) => { - // console.log('1st type of link?', x.items && x.items.length > 0) - // console.log() - return ( -
- {x.items && x.items.length > 0 ? ( -
- {x.items.map((subItem, subItemIndex) => { - // console.log('subitem', { subItem }) - // console.log('router', router) - //console.log('subitem url', subItem.url) - let subItemMenuOpen = false - - if (router.asPath.includes(subItem.url)) { - subItemMenuOpen = true - } - - const LinkContainer = (props) => { - return ( - - {props.children} - - ) - } - - return ( - <> - {subItemIndex === 0 && ( - <> -
- - {x.name} - - - )} - -
  • - - {subItem.icon && ( - {subItem.name - )} - {subItem.name} - -
  • - - {subItem.items && subItem.items.length > 0 && ( - - {subItem.items.map((subSubItem, subSubItemIndex) => { - return ( -
  • - - - {subSubItem.name} - - -
  • - ) - })} -
    - )} -
    - - ) - })} -
    - ) : ( - <> -
  • - - - {x.icon && } - {x.name} - - -
  • - - )} -
    - ) - })} - {menu.extras && ( - <> -
    - - Resources - - - )} - {menu.extras?.map((x) => { - return ( -
    -
  • - - - {x.icon && } - {x.name} - - -
  • -
    - ) - })} - + ) } diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx new file mode 100644 index 00000000000..e4e73a8e132 --- /dev/null +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx @@ -0,0 +1,213 @@ +import { useTheme } from 'common/Providers' +import Image from 'next/image' +import Link from 'next/link' +import { useRouter } from 'next/router' +import React from 'react' +import { IconChevronLeft } from '~/../../packages/ui' +import * as NavItems from './NavigationMenu.constants' +import * as Accordion from '@radix-ui/react-accordion' + +interface ImPureProps { + // users: Array +} + +const HeaderImage = React.memo(function HeaderImage(props: any) { + const router = useRouter() + const { isDarkMode } = useTheme() + + return ( + {props.icon} + ) +}) + +const HeaderLink = React.memo(function HeaderLink(props: any) { + const router = useRouter() + + return ( + + {props.title ?? props.id} + + ) +}) + +const ContentAccordionLink = React.memo(function ContentAccordionLink(props: any) { + const router = useRouter() + const { isDarkMode } = useTheme() + + let subItemMenuOpen = false + + if (router.asPath.includes(props.subItem.url)) { + subItemMenuOpen = true + } + + const LinkContainer = (props) => { + return ( + + {props.children} + + ) + } + + return ( + <> + {props.subItemIndex === 0 && ( + <> +
    + + {props.parent.name} + + + )} + +
  • + + {props.subItem.icon && ( + {props.subItem.name + )} + {props.subItem.name} + +
  • + + {props.subItem.items && props.subItem.items.length > 0 && ( + + {props.subItem.items.map((subSubItem) => { + return ( +
  • + + + {subSubItem.name} + + +
  • + ) + })} +
    + )} +
    + + ) +}) + +const ContentLink = React.memo(function ContentLink(props: any) { + const router = useRouter() + + return ( +
  • + + + {props.icon && ( + {props.icon} + )} + {props.name} + + +
  • + ) +}) + +const Content = (props) => { + const { id } = props + + const menu = NavItems[id] + + return ( + + ) +} + +export default React.memo(Content) diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx index e2db35f487a..206a50d2230 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx @@ -1,76 +1,9 @@ -import * as Accordion from '@radix-ui/react-accordion' -import Link from 'next/link' -import { useRouter } from 'next/router' -import { IconChevronLeft } from 'ui' -import * as NavItems from './NavigationMenu.constants' - -import { find } from 'lodash' -import Image from 'next/image' -import { useTheme } from 'common/Providers' - // import apiCommonSections from '~/../../spec/common-client-libs-sections.json' -import RevVersionDropdown from '~/components/RefVersionDropdown' -import { useMenuActiveRefId, useMenuLevelId } from '~/hooks/useMenuState' import { RefIdOptions, RefKeyOptions } from './NavigationMenu' +import NavigationMenuRefListItems from './NavigationMenuRefListItems' -const FunctionLink = ({ - title, - id, - icon, - library, - slug, -}: { - title: string - name?: string - id: string - icon?: string - product?: string - library: string - slug: string -}) => { - const router = useRouter() - const activeAccordianItem = useMenuActiveRefId() - - // check if we're on a versioned page - let version = '' - if (router.asPath.includes('v1')) { - version = 'v1' - } - - if (router.asPath.includes('v0')) { - version = 'v0' - } - - const active = activeAccordianItem === id - return ( -
  • - - - {icon && {icon}} - {title} - - -
  • - ) -} - -const SideMenuTitle = ({ title }: { title: string }) => { - return ( - - {title} - - ) -} - -const Divider = () => { - return
    -} +import React from 'react' interface INavigationMenuRefList { id: RefIdOptions @@ -80,228 +13,34 @@ interface INavigationMenuRefList { // the keys of menu items that are allowed to be shown on the side menu // if undefined, we show all the menu items allowedClientKeys?: string[] + active: boolean + spec?: any } const NavigationMenuRefList: React.FC = ({ id, lib, commonSections, - allowedClientKeys, + + active, + spec, }) => { - const router = useRouter() - const { isDarkMode } = useTheme() - - let sections = commonSections - - const allowedKeys = allowedClientKeys - - if (!sections) console.error('no common sections imported') - - const menu = NavItems[id] - - const databaseFunctions = find(sections, { title: 'Database' }) - ? find(sections, { title: 'Database' }).items - : [] - - const authFunctions = find(sections, { title: 'Auth' }) - ? find(sections, { title: 'Auth' }).items - : [] - - const filterIds = - databaseFunctions.length > 0 - ? find(databaseFunctions, { - id: 'using-filters', - }) && - find(databaseFunctions, { - id: 'using-filters', - }) - .items.filter((x) => allowedKeys.includes(x.id)) - .map((x) => x.id) - : [] - const modifierIds = - databaseFunctions.length > 0 - ? find(databaseFunctions, { - id: 'using-modifiers', - }) && - find(databaseFunctions, { - id: 'using-modifiers', - }) - .items.filter((x) => allowedKeys.includes(x.id)) - .map((x) => x.id) - : [] - - const authServerIds = - databaseFunctions.length > 0 - ? find(authFunctions, { - id: 'admin-api', - }) && - find(authFunctions, { - id: 'admin-api', - }).items.map((x) => x.id) - : [] - - // console.log(filterIds) - // console.log(modifierIds) - - const level = useMenuLevelId() - return (
    -
    - - -
    -
    - -
    -
    - Back to Main Menu -
    - - -
    - {id} - - {menu.title} - - -
    - {/* )} */} - -
      - {sections.map((fn: any, fnIndex) => { - // - // check if the link is allowed to be displayed - function isFuncNotInLibraryOrVersion(id, type) { - if (id && allowedKeys && !allowedKeys.includes(id) && type !== 'markdown') { - /* - * Remove this menu link from side bar, as it does not exist for either - * this language, or for this lib version - * - * */ - return true - } else { - return false - } - } - - // run allow check - if (isFuncNotInLibraryOrVersion(fn.id, fn.type)) { - return <> - } - - const RenderLink = (props) => { - const activeAccordianItem = useMenuActiveRefId() - let active = false - - const isFilter = - filterIds && filterIds.length > 0 && filterIds.includes(activeAccordianItem) - const isModifier = - modifierIds && modifierIds.length > 0 && modifierIds.includes(activeAccordianItem) - const isAuthServer = - authServerIds && - authServerIds.length > 0 && - authServerIds.includes(activeAccordianItem) - - if ( - (isFilter && !isModifier && !isAuthServer && props.id === 'using-filters') || - (activeAccordianItem === 'using-filters' && props.id === 'using-filters') - ) { - active = true - } else if ( - (isModifier && !isFilter && !isAuthServer && props.id === 'using-modifiers') || - (activeAccordianItem === 'using-modifiers' && props.id === 'using-modifiers') - ) { - active = true - } else if ( - (isAuthServer && !isFilter && !isModifier && props.id === 'admin-api') || - (activeAccordianItem === 'admin-api' && props.id === 'admin-api') - ) { - active = true - } else { - active = false - } - - return ( - - - - - {props.items && - props.items - .filter((item) => allowedKeys.includes(item.id)) - .map((item) => { - return - })} - - - - ) - } - - // handle subtitles with subitems - if (!fn.id) { - return ( - <> - - - {fn.items && - fn.items - //.filter((item) => item.libs && item.libs.includes(lib)) - .map((item) => { - // run allow check - if (isFuncNotInLibraryOrVersion(item.id, item.type)) return <> - return - })} - - ) - } else { - // handle normal links - return ( - <> - - {fn.items && - fn.items - //.filter((item) => item.libs.includes(lib)) - .map((item) => )} - - ) - } - })} -
    -
    +
    ) } -export default NavigationMenuRefList +export default React.memo(NavigationMenuRefList) diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx new file mode 100644 index 00000000000..87a90b82baa --- /dev/null +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx @@ -0,0 +1,306 @@ +import * as Accordion from '@radix-ui/react-accordion' +import Link from 'next/link' +import { useRouter } from 'next/router' +import { IconChevronLeft } from 'ui' +import * as NavItems from './NavigationMenu.constants' + +import { find } from 'lodash' +import Image from 'next/image' +import { useTheme } from 'common/Providers' + +import RevVersionDropdown from '~/components/RefVersionDropdown' +import { useMenuActiveRefId } from '~/hooks/useMenuState' +import { RefIdOptions, RefKeyOptions } from './NavigationMenu' + +import React, { Fragment } from 'react' +import { generateAllowedClientLibKeys } from '~/lib/refGenerator/helpers' +import { isFuncNotInLibraryOrVersion } from './NavigationMenu.utils' + +const HeaderImage = React.memo(function HeaderImage(props: any) { + const router = useRouter() + const { isDarkMode } = useTheme() + + return ( + {props.icon} + ) +}) + +const HeaderLink = React.memo(function HeaderLink(props: any) { + const router = useRouter() + + return ( + + {props.title ?? props.id} + + ) +}) + +const FunctionLink = React.memo(function FunctionLink({ + title, + id, + icon, + library, + slug, +}: { + title: string + name?: string + id: string + icon?: string + product?: string + library: string + slug: string +}) { + const router = useRouter() + const activeAccordianItem = useMenuActiveRefId() + + // check if we're on a versioned page + let version = '' + if (router.asPath.includes('v1')) { + version = 'v1' + } + + if (router.asPath.includes('v0')) { + version = 'v0' + } + + const active = activeAccordianItem === id + return ( +
  • + + + {icon && {icon}} + {title} + + +
  • + ) +}) + +const RenderLink = React.memo(function RenderLink(props: any) { + const activeAccordianItem = useMenuActiveRefId() + let active = false + + const isFilter = props.filterIds?.includes(activeAccordianItem) + const isModifier = props.modifierIds?.includes(activeAccordianItem) + const isAuthServer = props.authServerIds?.includes(activeAccordianItem) + + if ( + (isFilter && props.id === 'using-filters') || + (activeAccordianItem === 'using-filters' && props.id === 'using-filters') + ) { + active = true + } else if ( + (isModifier && props.id === 'using-modifiers') || + (activeAccordianItem === 'using-modifiers' && props.id === 'using-modifiers') + ) { + active = true + } else if ( + (isAuthServer && props.id === 'admin-api') || + (activeAccordianItem === 'admin-api' && props.id === 'admin-api') + ) { + active = true + } else { + active = false + } + + return ( + + + + + {props.items && + props.items + .filter((item) => props.allowedKeys.includes(item.id)) + .map((item) => { + return ( + + ) + })} + + + + ) +}) + +const SideMenuTitle = ({ title }: { title: string }) => { + return ( + + {title} + + ) +} + +const Divider = () => { + return
    +} + +interface INavigationMenuRefList { + id: RefIdOptions + lib: RefKeyOptions + commonSections: any[] // to do type up + + // the keys of menu items that are allowed to be shown on the side menu + // if undefined, we show all the menu items + allowedClientKeys?: string[] + spec?: any +} + +const Content: React.FC = ({ id, lib, commonSections, spec }) => { + const allowedClientKeys = spec ? generateAllowedClientLibKeys(commonSections, spec) : undefined + + let sections = commonSections + + const allowedKeys = allowedClientKeys + + if (!sections) console.error('no common sections imported') + + const menu = NavItems[id] + + const databaseFunctions = find(sections, { title: 'Database' }) + ? find(sections, { title: 'Database' }).items + : [] + + const authFunctions = find(sections, { title: 'Auth' }) + ? find(sections, { title: 'Auth' }).items + : [] + + const filterIds = + databaseFunctions.length > 0 + ? find(databaseFunctions, { + id: 'using-filters', + }) && + find(databaseFunctions, { + id: 'using-filters', + }) + .items.filter((x) => allowedKeys.includes(x.id)) + .map((x) => x.id) + : [] + const modifierIds = + databaseFunctions.length > 0 + ? find(databaseFunctions, { + id: 'using-modifiers', + }) && + find(databaseFunctions, { + id: 'using-modifiers', + }) + .items.filter((x) => allowedKeys.includes(x.id)) + .map((x) => x.id) + : [] + + const authServerIds = + databaseFunctions.length > 0 + ? find(authFunctions, { + id: 'admin-api', + }) && + find(authFunctions, { + id: 'admin-api', + }).items.map((x) => x.id) + : [] + + return ( +
    + + +
    +
    + +
    +
    + Back to Main Menu +
    + + +
    + + + +
    + +
      + {sections.map((fn: any, fnIndex) => { + // run allow check + if (isFuncNotInLibraryOrVersion(fn.id, fn.type, allowedKeys)) { + return + } + + // handle subtitles with subitems + return fn.id ? ( + + + {fn.items && + fn.items + //.filter((item) => item.libs.includes(lib)) + .map((item) => ( + + ))} + + ) : ( + + + + {fn.items && + fn.items.map((item, i) => { + // run allow check + if (isFuncNotInLibraryOrVersion(item.id, item.type, allowedKeys)) + return + return ( + + ) + })} + + ) + })} +
    +
    + ) +} + +export default React.memo(Content) diff --git a/apps/docs/components/Navigation/NavigationMenu/TopNavBarRef.tsx b/apps/docs/components/Navigation/NavigationMenu/TopNavBarRef.tsx index 6fcae17712d..b1d344b081d 100644 --- a/apps/docs/components/Navigation/NavigationMenu/TopNavBarRef.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/TopNavBarRef.tsx @@ -2,19 +2,7 @@ import Image from 'next/image' import Link from 'next/link' import { useRouter } from 'next/router' import { FC, useEffect, useState } from 'react' -import { - Badge, - Button, - Dropdown, - IconCommand, - IconMenu, - IconMessageSquare, - IconMoon, - IconSearch, - IconSun, - Input, - Listbox, -} from 'ui' +import { Button, IconCommand, IconGitHub, IconMoon, IconSearch, IconSun } from 'ui' import { SearchButton } from '~/components/DocSearch' import { REFERENCES } from '~/components/Navigation/Navigation.constants' import { useTheme } from 'common/Providers' @@ -54,6 +42,7 @@ const TopNavBarRef: FC = () => { const key = localStorage.getItem('supabaseDarkMode') document.documentElement.className = key === 'true' ? 'dark' : '' + document.documentElement.style.colorScheme = key === 'true' ? 'dark' : '' } const onSelectVersion = (version: string) => { @@ -134,7 +123,7 @@ const TopNavBarRef: FC = () => { target="_blank" rel="noreferrer noopener" > - Main site + Supabase.com +
      + +
    • diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx index c5a5aa3752a..cdfa36060b5 100644 --- a/apps/docs/components/index.tsx +++ b/apps/docs/components/index.tsx @@ -29,6 +29,7 @@ import CliGlobalFlagsHandler from '~/components/reference/enrichments/cli/CliGlo import Options from '~/components/Options' import Param from '~/components/Params' +import Image from 'next/image' const components = { Admonition, @@ -73,6 +74,13 @@ const components = { CliGlobalFlagsHandler: () => , Options, Param, + img: (props: any) => { + return ( + + + + ) + }, } export default components diff --git a/apps/docs/components/reference/RefFunctionSection.tsx b/apps/docs/components/reference/RefFunctionSection.tsx index a31c52af992..8c36b793b8b 100644 --- a/apps/docs/components/reference/RefFunctionSection.tsx +++ b/apps/docs/components/reference/RefFunctionSection.tsx @@ -9,6 +9,7 @@ import RefSubLayout from '~/layouts/ref/RefSubLayout' import { extractTsDocNode, generateParameters } from '~/lib/refGenerator/helpers' import RefDetailCollapse from '~/components/reference/RefDetailCollapse' +import { Fragment } from 'react' interface ICommonFunc { id: string @@ -32,11 +33,6 @@ const RefFunctionSection: React.FC = (props) => { // gracefully return nothing if function does not exist if (!item) return <> - if (item && !item['$ref']) { - //console.warn('🚩 issue with $ref in:', item.id) - } - - // console.log(item) const hasTsRef = item['$ref'] || null const tsDefinition = @@ -64,11 +60,7 @@ const RefFunctionSection: React.FC = (props) => { {item.description}
      )} - {/* {functionMarkdownContent && ( -
      - -
      - )} */} + {item.notes && (
      {item.notes} @@ -89,25 +81,29 @@ const RefFunctionSection: React.FC = (props) => { }) const paramItem = overide?.length > 0 ? overide[0] : param - return ( - + {paramItem.subContent && (
      {param.subContent.map((param) => { return ( - <> + {param.subContent && ( {param.subContent.map((param) => { - return + return ( + + ) })} )} - + ) })} @@ -150,9 +146,18 @@ const RefFunctionSection: React.FC = (props) => { return ( + {example.description && ( +
      + + {example.description} + +
      + )} + {((tables && tables.length > 0) || sql) && ( = (props) => { .replace('js', '') .replace('ts', ''))} + {response && ( + ) +} + +export default RefSEO diff --git a/apps/docs/components/reference/RefSectionHandler.tsx b/apps/docs/components/reference/RefSectionHandler.tsx index cca2e834ac9..d54e5d616bb 100644 --- a/apps/docs/components/reference/RefSectionHandler.tsx +++ b/apps/docs/components/reference/RefSectionHandler.tsx @@ -5,7 +5,7 @@ import { useEffect } from 'react' import components from '~/components' import RefEducationSection from '~/components/reference/RefEducationSection' import RefFunctionSection from '~/components/reference/RefFunctionSection' -import OldLayout from '~/layouts/Default' + import RefSubLayout from '~/layouts/ref/RefSubLayout' import ApiOperationSection from './ApiOperationSection' import CliCommandSection from './CLICommandSection' @@ -34,30 +34,19 @@ const RefSectionHandler = (props) => { } }) - /* - * handle old ref pages - */ - if (!isNewDocs) { - return ( - // @ts-ignore - - - - ) - } - return ( - {props.sections.map((x) => { + {props.sections.map((x, i) => { switch (x.type) { case 'markdown': const markdownData = props.pageProps.docs.find((doc) => doc.id === x.id) - return + return break case 'function': return ( { /> ) case 'cli-command': - return + return break case 'operation': - return + return ( + + ) default: return ( { menuState.menuActiveRefId = value }, - menuLevelId: '', + menuLevelId: 'home', setMenuLevelId: (value) => { menuState.menuMobileOpen = false menuState.menuLevelId = value diff --git a/apps/docs/layouts/Default.tsx b/apps/docs/layouts/Default.tsx deleted file mode 100644 index 515f73b89ac..00000000000 --- a/apps/docs/layouts/Default.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import { useEffect, FC } from 'react' -import { NextSeo } from 'next-seo' -import NavBar from '../components/Navigation/NavBar' -import SideBar from '../components/Navigation/SideBar' -import Footer from '../components/Footer' -import TableOfContents from '~/components/TableOfContents' -import { menuItems } from '~/components/Navigation/Navigation.constants' -import { useRouter } from 'next/router' -import { getPageType } from '~/lib/helpers' - -interface Props { - meta: { title: string; description?: string; hide_table_of_contents?: boolean } - children: any - toc?: any - menuItems?: any - currentPage?: string -} - -const Layout: FC = ({ meta, children, toc }) => { - const { asPath } = useRouter() - - useEffect(() => { - const key = localStorage.getItem('supabaseDarkMode') - if (!key) { - // Default to dark mode if no preference config - document.documentElement.className = 'dark' - } else { - document.documentElement.className = key === 'true' ? 'dark' : '' - } - }, []) - - const hasTableOfContents = - toc !== undefined && toc.json.filter((item) => item.lvl !== 1 && item.lvl <= 3).length > 0 - - const pageType = getPageType(asPath) - - console.log('Default, pageType', pageType) - - return ( - <> - - -
      - -
      - -
      -
      -
      - {children} -
      -
      - {hasTableOfContents && !meta?.hide_table_of_contents && ( - - )} -
      -
      -
      -
      - - ) -} - -export default Layout diff --git a/apps/docs/layouts/SiteLayout.tsx b/apps/docs/layouts/SiteLayout.tsx index 9feac530869..eb017378efd 100644 --- a/apps/docs/layouts/SiteLayout.tsx +++ b/apps/docs/layouts/SiteLayout.tsx @@ -1,320 +1,335 @@ import { useTheme } from 'common/Providers' import Image from 'next/image' import Link from 'next/link' -import { useRouter } from 'next/router' import NavigationMenu from '~/components/Navigation/NavigationMenu/NavigationMenu' import TopNavBarRef from '~/components/Navigation/NavigationMenu/TopNavBarRef' import FooterHelpCallout from '~/components/FooterHelpCallout' +import { memo, useEffect } from 'react' +import Footer from '~/components/Navigation/Footer' import { menuState, useMenuLevelId, useMenuMobileOpen } from '~/hooks/useMenuState' -import { useEffect } from 'react' -const SiteRefLayout = ({ children }) => { +const levelsData = { + home: { + icon: '/docs/img/icons/menu/home', + name: 'Home', + }, + gettingstarted: { + icon: '/docs/img/icons/menu/getting-started', + name: 'Getting Started', + }, + database: { + icon: '/docs/img/icons/menu/database', + name: 'Database', + }, + auth: { + icon: '/docs/img/icons/menu/auth', + name: 'Auth', + }, + functions: { + icon: '/docs/img/icons/menu/functions', + name: 'Functions', + }, + realtime: { + icon: '/docs/img/icons/menu/realtime', + name: 'Realtime', + }, + storage: { + icon: '/docs/img/icons/menu/storage', + name: 'Storage', + }, + platform: { + icon: '/docs/img/icons/menu/platform', + name: 'Platform', + }, + resources: { + icon: '/docs/img/icons/menu/resources', + name: 'Resources', + }, + self_hosting: { + icon: '/docs/img/icons/menu/self-hosting', + name: 'Self-Hosting', + }, + integrations: { + icon: '/docs/img/icons/menu/integrations', + name: 'Integrations', + }, + reference_javascript_v1: { + icon: '/docs/img/icons/menu/reference-javascript', + name: 'Javascript Reference v1.0', + }, + reference_javascript_v2: { + icon: '/docs/img/icons/menu/reference-javascript', + name: 'Javascript Reference v2.0', + }, + reference_dart_v0: { + icon: '/docs/img/icons/menu/reference-dart', + name: 'Dart Reference v0.0', + }, + reference_dart_v1: { + icon: '/docs/img/icons/menu/reference-dart', + name: 'Dart Reference v0.0', + }, + reference_cli: { + icon: '/docs/img/icons/menu/reference-cli', + name: 'CLI Reference', + }, + reference_api: { + icon: '/docs/img/icons/menu/reference-api', + name: 'Management API Reference', + }, + reference_self_hosting_auth: { + icon: '/docs/img/icons/menu/reference-auth', + name: 'Auth Server Reference', + }, + reference_self_hosting_storage: { + icon: '/docs/img/icons/menu/reference-storage', + name: 'Storage Server Reference', + }, + reference_self_hosting_realtime: { + icon: '/docs/img/icons/menu/reference-realtime', + name: 'Realtime Server Reference', + }, +} + +const MobileHeader = memo(function MobileHeader() { + const mobileMenuOpen = useMenuMobileOpen() + const menuLevel = useMenuLevelId() + + return ( +
      + +
      + +
      + + {mobileMenuOpen + ? 'Close' + : menuLevel + ? levelsData[menuLevel].name + : levelsData['home'].name} + +
      + ) +}) + +const MobileMenuBackdrop = memo(function MobileMenuBackdrop() { + const mobileMenuOpen = useMenuMobileOpen() + return ( +
      menuState.setMenuMobileOpen(!mobileMenuOpen)} + >
      + ) +}) + +const SideMenu = memo(function SideMenu() { + return ( +
      + +
      + ) +}) + +const HeaderLogo = memo(function HeaderLogo() { const { isDarkMode } = useTheme() + return ( + + + Supabase Logo + DOCS + + + ) +}) + +const Container = memo(function Container(props) { + const mobileMenuOpen = useMenuMobileOpen() + + return ( +
      +
      {props.children}
      +
      + ) +}) + +const NavContainer = memo(function NavContainer() { + const mobileMenuOpen = useMenuMobileOpen() + + return ( +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      + +
      +
      + ) +}) + +const SiteLayout = ({ children }) => { + // const mobileMenuOpen = useMenuMobileOpen() useEffect(() => { const key = localStorage.getItem('supabaseDarkMode') if (!key) { // Default to dark mode if no preference config document.documentElement.className = 'dark' + document.documentElement.style.colorScheme = 'dark' } else { document.documentElement.className = key === 'true' ? 'dark' : '' + document.documentElement.style.colorScheme = key === 'true' ? 'dark' : '' } }, []) - const menuLevel = useMenuLevelId() - const mobileMenuOpen = useMenuMobileOpen() - - const levelsData = { - home: { - icon: '/docs/img/icons/menu/home', - name: 'Home', - }, - gettingstarted: { - icon: '/docs/img/icons/menu/getting-started', - name: 'Getting Started', - }, - database: { - icon: '/docs/img/icons/menu/database', - name: 'Database', - }, - auth: { - icon: '/docs/img/icons/menu/auth', - name: 'Auth', - }, - functions: { - icon: '/docs/img/icons/menu/functions', - name: 'Functions', - }, - realtime: { - icon: '/docs/img/icons/menu/realtime', - name: 'Realtime', - }, - storage: { - icon: '/docs/img/icons/menu/storage', - name: 'Storage', - }, - platform: { - icon: '/docs/img/icons/menu/platform', - name: 'Platform', - }, - resources: { - icon: '/docs/img/icons/menu/resources', - name: 'Resources', - }, - integrations: { - icon: '/docs/img/icons/menu/integrations', - name: 'Integrations', - }, - reference_javascript_v1: { - icon: '/docs/img/icons/menu/reference-javascript', - name: 'Javascript Reference v1.0', - }, - reference_javascript_v2: { - icon: '/docs/img/icons/menu/reference-javascript', - name: 'Javascript Reference v2.0', - }, - reference_dart_v0: { - icon: '/docs/img/icons/menu/reference-dart', - name: 'Dart Reference v0.0', - }, - reference_dart_v1: { - icon: '/docs/img/icons/menu/reference-dart', - name: 'Dart Reference v0.0', - }, - reference_cli: { - icon: '/docs/img/icons/menu/reference-cli', - name: 'CLI Reference', - }, - reference_api: { - icon: '/docs/img/icons/menu/reference-api', - name: 'Management API Reference', - }, - reference_self_hosting_auth: { - icon: '/docs/img/icons/menu/reference-auth', - name: 'Auth Server Reference', - }, - reference_self_hosting_storage: { - icon: '/docs/img/icons/menu/reference-storage', - name: 'Storage Server Reference', - }, - reference_self_hosting_realtime: { - icon: '/docs/img/icons/menu/reference-realtime', - name: 'Realtime Server Reference', - }, - } - return (
      - {/* */} -
      -
      ) } -export default SiteRefLayout +export default SiteLayout diff --git a/apps/docs/layouts/SiteRefLayout.tsx b/apps/docs/layouts/SiteRefLayout.tsx deleted file mode 100644 index 930daa4d684..00000000000 --- a/apps/docs/layouts/SiteRefLayout.tsx +++ /dev/null @@ -1,321 +0,0 @@ -import { useTheme } from 'common/Providers' -import Image from 'next/image' -import Link from 'next/link' -import { useRouter } from 'next/router' -import NavigationMenu from '~/components/Navigation/NavigationMenu/NavigationMenu' -import TopNavBarRef from '~/components/Navigation/NavigationMenu/TopNavBarRef' - -import FooterHelpCallout from '~/components/FooterHelpCallout' - -import { menuState } from '~/hooks/useMenuState' -import { useEffect } from 'react' - -const SiteRefLayout = ({ children }) => { - const { isDarkMode } = useTheme() - - useEffect(() => { - const key = localStorage.getItem('supabaseDarkMode') - if (!key) { - // Default to dark mode if no preference config - document.documentElement.className = 'dark' - } else { - document.documentElement.className = key === 'true' ? 'dark' : '' - } - }, []) - - const menuLevel = 'home' - // useMenuLevelId() - const mobileMenuOpen = false - - const levelsData = { - home: { - icon: '/docs/img/icons/menu/home', - name: 'Home', - }, - gettingstarted: { - icon: '/docs/img/icons/menu/getting-started', - name: 'Getting Started', - }, - database: { - icon: '/docs/img/icons/menu/database', - name: 'Database', - }, - auth: { - icon: '/docs/img/icons/menu/auth', - name: 'Auth', - }, - functions: { - icon: '/docs/img/icons/menu/functions', - name: 'Functions', - }, - realtime: { - icon: '/docs/img/icons/menu/realtime', - name: 'Realtime', - }, - storage: { - icon: '/docs/img/icons/menu/storage', - name: 'Storage', - }, - platform: { - icon: '/docs/img/icons/menu/platform', - name: 'Platform', - }, - resources: { - icon: '/docs/img/icons/menu/resources', - name: 'Resources', - }, - integrations: { - icon: '/docs/img/icons/menu/integrations', - name: 'Integrations', - }, - reference_javascript_v1: { - icon: '/docs/img/icons/menu/reference-javascript', - name: 'Javascript Reference v1.0', - }, - reference_javascript_v2: { - icon: '/docs/img/icons/menu/reference-javascript', - name: 'Javascript Reference v2.0', - }, - reference_dart_v0: { - icon: '/docs/img/icons/menu/reference-dart', - name: 'Dart Reference v0.0', - }, - reference_dart_v1: { - icon: '/docs/img/icons/menu/reference-dart', - name: 'Dart Reference v0.0', - }, - reference_cli: { - icon: '/docs/img/icons/menu/reference-cli', - name: 'CLI Reference', - }, - reference_api: { - icon: '/docs/img/icons/menu/reference-api', - name: 'Management API Reference', - }, - reference_self_hosting_auth: { - icon: '/docs/img/icons/menu/reference-auth', - name: 'Auth Server Reference', - }, - reference_self_hosting_storage: { - icon: '/docs/img/icons/menu/reference-storage', - name: 'Storage Server Reference', - }, - reference_self_hosting_realtime: { - icon: '/docs/img/icons/menu/reference-realtime', - name: 'Realtime Server Reference', - }, - } - - return ( -
      - {/* */} - -
      - -
      -
      - {/* */} -
      - -
      -
      -
      -
      - -
      - -
      - - {mobileMenuOpen - ? 'Close' - : menuLevel - ? levelsData[menuLevel].name - : levelsData['home'].name} - -
      -
      - -
      -
      -
      -
      - {children} - -
      - -
      -
      -
      - Supabase 2022 - — - - Contributing - - - Changelog - - - - Author Styleguide - - - Open Source - - - SupaSquad - -
      -
      - - -
      -
      -
      -
      - ) -} - -export default SiteRefLayout diff --git a/apps/docs/layouts/guides/index.tsx b/apps/docs/layouts/guides/index.tsx index 10ccfed870d..07ec7929195 100644 --- a/apps/docs/layouts/guides/index.tsx +++ b/apps/docs/layouts/guides/index.tsx @@ -31,10 +31,11 @@ const Layout: FC = (props) => { const [tocList, setTocList] = useState([]) const { asPath } = useRouter() - const page = getPageType(asPath) const router = useRouter() + const EDIT_BUTTON_EXCLUDE_LIST = ['/404'] + useEffect(() => { if (hash && tocList.length > 0) { highlightSelectedTocItem(hash as string) @@ -59,6 +60,8 @@ const Layout: FC = (props) => { const hasTableOfContents = tocList.length > 0 + const ogPageType = asPath.split('/')[2] + return ( <> = (props) => { url: `https://supabase.com/docs${asPath}`, images: [ { - url: `https://supabase.com/docs/img/supabase-og-image.png`, + url: `https://obuldanrptloktxcffvn.functions.supabase.co/og-images?site=docs${ + ogPageType ? `&type=${ogPageType}` : '' + }&title=${encodeURIComponent(props.meta?.title)}&description=${encodeURIComponent( + props.meta?.description + )}`, }, ], }} /> -
      +
      = (props) => { )}
      {props.children} -
      -
      - - - Edit this page on GitHub - - + + {EDIT_BUTTON_EXCLUDE_LIST.includes(router.route) ? ( + <> + ) : ( + -
      + )}
      {!props.hideToc && hasTableOfContents && !props.meta?.hide_table_of_contents && ( diff --git a/apps/docs/layouts/ref/RefSubLayout.tsx b/apps/docs/layouts/ref/RefSubLayout.tsx index 26e1c612515..fb3668fc594 100644 --- a/apps/docs/layouts/ref/RefSubLayout.tsx +++ b/apps/docs/layouts/ref/RefSubLayout.tsx @@ -4,6 +4,7 @@ import { highlightSelectedNavItem } from '~/components/CustomHTMLElements/Custom import { useRouter } from 'next/router' import { useNavigationMenuContext } from '~/components/Navigation/NavigationMenu/NavigationMenu.Context' import { menuState } from '~/hooks/useMenuState' +import Image from 'next/image' interface ISectionContainer { id: string @@ -54,10 +55,9 @@ const RefSubLayout: FC & RefSubLayoutSubComponents = (props) = } const Section: FC = (props) => { - // console.log({ props }) return (
      = (props) => { const StickyHeader: FC = ({ icon, ...props }) => { const router = useRouter() + const { setActiveRefItem } = useNavigationMenuContext() + // we're serving search bots a different file (/crawlers/[...slug]) + // and need to modify content to suit that + const isCrawlerPage = router.route.includes('/crawlers/[...slug]') + const { ref } = useInView({ threshold: 1, rootMargin: '30% 0% -35% 0px', @@ -99,21 +104,25 @@ const StickyHeader: FC = ({ icon, ...props }) => {
      {icon && (
      - + {icon}
      )} -

      - {props.title && {props.title}} -

      + {isCrawlerPage ? ( +

      {props.title}

      + ) : ( +

      + {props.title && {props.title}} +

      + )}
      ) } @@ -139,10 +148,9 @@ const EducationRow: FC = (props) => { } const EducationSection: FC = ({ icon, hideTitle = false, ...props }) => { - // console.log({ props }) return (
      {!hideTitle && } diff --git a/apps/docs/layouts/tutorials/TutorialLayout.tsx b/apps/docs/layouts/tutorials/TutorialLayout.tsx index b49391425b2..fc1a2fa8ea9 100644 --- a/apps/docs/layouts/tutorials/TutorialLayout.tsx +++ b/apps/docs/layouts/tutorials/TutorialLayout.tsx @@ -2,7 +2,6 @@ import { MDXProvider } from '@mdx-js/react' import Head from 'next/head' import { FC, useEffect, useState } from 'react' import components from '~/components' -import Footer from '~/components/Footer' import SideBar from '~/components/Navigation/SideBar' import TableOfContents from '~/components/TableOfContents' diff --git a/apps/docs/lib/mdx/getConfig.tsx b/apps/docs/lib/mdx/getConfig.tsx new file mode 100644 index 00000000000..8a014486212 --- /dev/null +++ b/apps/docs/lib/mdx/getConfig.tsx @@ -0,0 +1,20 @@ +// @ts-expect-error +import specStorageV0 from '~/../../spec/storage_v0_config.yaml' assert { type: 'yml' } +// @ts-expect-error +import specRealtimeV0 from '~/../../spec/realtime_v0_config.yaml' assert { type: 'yml' } +// @ts-expect-error +import specAuthV1 from '~/../../spec/gotrue_v1_config.yaml' assert { type: 'yml' } + +function getStorageConfigV0() { + return { ...specStorageV0 } +} + +function getRealtimeConfigV0() { + return { ...specRealtimeV0 } +} + +function getAuthConfigV1() { + return { ...specAuthV1 } +} + +export { getStorageConfigV0, getRealtimeConfigV0, getAuthConfigV1 } diff --git a/apps/docs/lib/refGenerator/helpers.ts b/apps/docs/lib/refGenerator/helpers.ts index 6af5b8eb539..9c14a80167f 100644 --- a/apps/docs/lib/refGenerator/helpers.ts +++ b/apps/docs/lib/refGenerator/helpers.ts @@ -2,6 +2,7 @@ import { TsDoc } from '../../generator/legacy/definitions' import { values, mapValues } from 'lodash' import { OpenAPIV3 } from 'openapi-types' +import { flattenSections } from '../helpers' export function extractTsDocNode(nodeToFind: string, definition: any) { const nodePath = nodeToFind.split('.') @@ -285,3 +286,23 @@ export const toArrayWithKey = (obj: object, keyAs: string) => return value }) ) + +export function generateAllowedClientLibKeys(sections, spec) { + // Filter parent sections first + + const specIds = spec.functions.map((func) => { + return func.id + }) + + const newShape = flattenSections(sections).filter((section) => { + if (specIds.includes(section.id)) { + return section + } + }) + + const final = newShape.map((func) => { + return func.id + }) + + return final +} diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index 9762c179622..bf98d6d34fd 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -48,7 +48,12 @@ const nextConfig = { basePath: '/docs', images: { dangerouslyAllowSVG: true, - domains: ['avatars.githubusercontent.com', 'github.com', 'user-images.githubusercontent.com'], + domains: [ + 'avatars.githubusercontent.com', + 'github.com', + 'user-images.githubusercontent.com', + 'raw.githubusercontent.com', + ], }, experimental: { mdxRs: true, diff --git a/apps/docs/pages/404.tsx b/apps/docs/pages/404.tsx deleted file mode 100644 index 71b9bb5f6f5..00000000000 --- a/apps/docs/pages/404.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { useEffect, useState } from 'react' -import Link from 'next/link' -import { Button } from 'ui' -import Head from 'next/head' - -export default function Custom404() { - const [show404, setShow404] = useState(false) - - useEffect(() => { - setTimeout(() => { - setShow404(true) - }, 500) - }, []) - - return ( - <> - - 404 | Supabase - -
      -
      -

      - 404 -

      -
      -
      -
      -

      Looking for something?

      -

      - We could not find the page that you are looking for! -

      -
      -
      - - - -
      -
      -
      - - ) -} diff --git a/apps/docs/pages/[...slug].tsx b/apps/docs/pages/[...slug].tsx deleted file mode 100644 index 6b34513a155..00000000000 --- a/apps/docs/pages/[...slug].tsx +++ /dev/null @@ -1,74 +0,0 @@ -import toc from 'markdown-toc' -import { MDXRemote } from 'next-mdx-remote' -import { serialize } from 'next-mdx-remote/serialize' -import components from '../components/index' -import NewLayout from '~/layouts/DefaultGuideLayout' - -import Layout from '~/layouts/Default' -import { getAllDocs, getDocsBySlug } from '../lib/docs' - -interface Meta { - id: string - title: string - sidebar_label: string - hide_table_of_contents: boolean -} - -interface Props { - meta: Meta - content: any - toc: any -} -const isNewDocs = process.env.NEXT_PUBLIC_NEW_DOCS === 'true' - -export default function Doc({ meta, content, toc }: Props) { - return ( - // @ts-ignore - <> - {Object.entries(meta).length > 0 || !isNewDocs ? ( - - - - ) : ( - - - - )} - - ) -} - -export async function getStaticProps({ params }: { params: { slug: string[] } }) { - let slug - if (params.slug.length > 1) { - slug = `docs/${params.slug.join('/')}` - } else { - slug = `docs/${params.slug[0]}` - } - - let doc = getDocsBySlug(slug) - const content = await serialize(doc.content || '') - - return { - props: { - ...doc, - content, - toc: toc(doc.content, { maxdepth: 1, firsth1: false }), - }, - } -} - -export function getStaticPaths() { - let docs = getAllDocs() - - return { - paths: docs.map(() => { - return { - params: { - slug: docs.map((d) => d.slug), - }, - } - }), - fallback: 'blocking', - } -} diff --git a/apps/docs/pages/_app.tsx b/apps/docs/pages/_app.tsx index 52a0b995643..0736cff9c2b 100644 --- a/apps/docs/pages/_app.tsx +++ b/apps/docs/pages/_app.tsx @@ -13,7 +13,6 @@ import '../styles/main.scss?v=1.0.0' import '../styles/new-docs.scss' import '../styles/prism-okaidia.scss' import { post } from '~/lib/fetchWrappers' -import { menuState } from '~/hooks/useMenuState' function MyApp({ Component, pageProps }: AppPropsWithLayout) { const router = useRouter() diff --git a/apps/docs/pages/faq.mdx b/apps/docs/pages/faq.mdx index eced1e89829..66c0c120969 100644 --- a/apps/docs/pages/faq.mdx +++ b/apps/docs/pages/faq.mdx @@ -16,7 +16,7 @@ Self-hosting Supabase is free. If you wish to use our cloud-platform, we provide ### How do I host Supabase? -You can use the docker-compose script [here](https://github.com/supabase/supabase/tree/master/docker), and find detailed instructions [here](/docs/guides/hosting/overview). +You can use the docker compose script [here](https://github.com/supabase/supabase/tree/master/docker), and find detailed instructions [here](/docs/guides/hosting/overview). Supabase is an amalgamation of open source tools. Some of these tools are made by Supabase (like our [Realtime Server](https://github.com/supabase/realtime)), some we support directly (like [PostgREST](http://postgrest.org/en/v7.0.0/)), and some are third-party tools (like [KonSupabase is an amalgamation open sourceg](https://github.com/Kong/kong)). diff --git a/apps/docs/pages/getting-started.mdx b/apps/docs/pages/getting-started.mdx index 6313b6cb018..ccb7790f15e 100644 --- a/apps/docs/pages/getting-started.mdx +++ b/apps/docs/pages/getting-started.mdx @@ -62,7 +62,7 @@ A scalable websocket engine for managing user Presence, broadcasting messages, a - Official Docs: [Supabase Realtime docs](/docs/guides/realtime) - Source code: [github.com/supabase/realtime](https://github.com/supabase/realtime) -- License: [Apache 2](https://github.com/supabase/realtime/blob/master/LICENSE) +- License: [Apache 2](https://github.com/supabase/realtime/blob/main/LICENSE) - Language: Elixir ### Storage API (large file storage) diff --git a/apps/docs/pages/guides/auth/auth-helpers/nextjs.mdx b/apps/docs/pages/guides/auth/auth-helpers/nextjs.mdx index d0e74b82999..76e169c2271 100644 --- a/apps/docs/pages/guides/auth/auth-helpers/nextjs.mdx +++ b/apps/docs/pages/guides/auth/auth-helpers/nextjs.mdx @@ -83,9 +83,9 @@ Wrap your `pages/_app.js` component with the `SessionContextProvider` component: ```jsx title=pages/_app.js import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs' import { SessionContextProvider } from '@supabase/auth-helpers-react' +import { useState } from 'react' function MyApp({ Component, pageProps }) { - const router = useRouter() // Create a new supabase browser client on every first render. const [supabaseClient] = useState(() => createBrowserSupabaseClient()) @@ -108,6 +108,7 @@ Wrap your `pages/_app.tsx` component with the `SessionContextProvider` component ```tsx lines=2,8 title=pages/_app.tsx import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs' import { SessionContextProvider, Session } from '@supabase/auth-helpers-react' +import { useState } from 'react' function MyApp({ Component, diff --git a/apps/docs/pages/guides/auth/overview.mdx b/apps/docs/pages/guides/auth/overview.mdx index 85b1fdc96da..97044096e13 100644 --- a/apps/docs/pages/guides/auth/overview.mdx +++ b/apps/docs/pages/guides/auth/overview.mdx @@ -55,7 +55,7 @@ You can enable third-party providers with the click of a button by navigating to ### Redirect URLs and wildcards -When using third-party providers, the [Supabase client library](/docs/reference/javascript/auth-signinwithoauth#sign-in-using-a-third-party-provider-with-redirect) redirects the user to the provider. When the third-party provider successfully authenticates the user, the provider redirects the user to the Supabase Auth callback URL where they are further redirected to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or [add additional redirect URLs](https://app.supabase.com/project/_/auth/settings). +When using third-party providers, the [Supabase client library](/docs/reference/javascript/auth-signinwithoauth#sign-in-using-a-third-party-provider-with-redirect) redirects the user to the provider. When the third-party provider successfully authenticates the user, the provider redirects the user to the Supabase Auth callback URL where they are further redirected to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional [redirect URLs](https://app.supabase.com/project/_/auth/url-configuration). You can use wildcard match patterns to support preview URLs from providers like Netlify and Vercel. See the [full list of supported patterns](https://pkg.go.dev/github.com/gobwas/glob#Compile). Use [this tool](https://www.digitalocean.com/community/tools/glob?comments=true&glob=http%3A%2F%2Flocalhost%3A3000%2F%2A%2A&matches=false&tests=http%3A%2F%2Flocalhost%3A3000&tests=http%3A%2F%2Flocalhost%3A3000%2F&tests=http%3A%2F%2Flocalhost%3A3000%2F%3Ftest%3Dtest&tests=http%3A%2F%2Flocalhost%3A3000%2Ftest-test%3Ftest%3Dtest&tests=http%3A%2F%2Flocalhost%3A3000%2Ftest%2Ftest%3Ftest%3Dtest) to test your patterns. diff --git a/apps/docs/pages/guides/functions.mdx b/apps/docs/pages/guides/functions.mdx index fdceb0ceea9..9c970cb6bfe 100644 --- a/apps/docs/pages/guides/functions.mdx +++ b/apps/docs/pages/guides/functions.mdx @@ -29,7 +29,7 @@ Check out the [Edge Function Examples](https://github.com/supabase/supabase/tree
      {examples.map((x) => ( -
      +
      diff --git a/apps/docs/pages/guides/getting-started/architecture.mdx b/apps/docs/pages/guides/getting-started/architecture.mdx index 91048898791..c97053b0c54 100644 --- a/apps/docs/pages/guides/getting-started/architecture.mdx +++ b/apps/docs/pages/guides/getting-started/architecture.mdx @@ -63,7 +63,7 @@ A scalable websocket engine for managing user Presence, broadcasting messages, a - Official Docs: [Supabase Realtime docs](/docs/guides/realtime) - Source code: [github.com/supabase/realtime](https://github.com/supabase/realtime) -- License: [Apache 2](https://github.com/supabase/realtime/blob/master/LICENSE) +- License: [Apache 2](https://github.com/supabase/realtime/blob/main/LICENSE) - Language: Elixir ### Storage API (large file storage) diff --git a/apps/docs/pages/guides/getting-started/tutorials/with-nextjs.mdx b/apps/docs/pages/guides/getting-started/tutorials/with-nextjs.mdx index df4d8171a4d..0a174410282 100644 --- a/apps/docs/pages/guides/getting-started/tutorials/with-nextjs.mdx +++ b/apps/docs/pages/guides/getting-started/tutorials/with-nextjs.mdx @@ -125,6 +125,7 @@ export default MyApp Wrap your `pages/_app.tsx` component with the `SessionContextProvider` component: ```jsx lines=2,8 title=pages/_app.tsx +import { useState } from 'react' import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs' import { SessionContextProvider, Session } from '@supabase/auth-helpers-react' diff --git a/apps/docs/pages/guides/integrations.mdx b/apps/docs/pages/guides/integrations.mdx index f4167b280a1..60e06333e2c 100644 --- a/apps/docs/pages/guides/integrations.mdx +++ b/apps/docs/pages/guides/integrations.mdx @@ -1,5 +1,6 @@ import Layout from '~/layouts/DefaultLayout' import Link from 'next/link' +import Image from 'next/image' import { GlassPanel } from 'ui' import { integrations } from '~/components/Navigation/NavigationMenu/NavigationMenu.constants' @@ -20,7 +21,7 @@ Explore a variety of integrations from Supabase partners. Need a different integ } + icon={} > {integration.description} diff --git a/apps/docs/pages/guides/integrations/authsignal.mdx b/apps/docs/pages/guides/integrations/authsignal.mdx index 250b822b483..65d83b22d01 100644 --- a/apps/docs/pages/guides/integrations/authsignal.mdx +++ b/apps/docs/pages/guides/integrations/authsignal.mdx @@ -61,7 +61,7 @@ cd supabase-authsignal-example Create a `.env.local` file and enter the following values: -``` +```sh NEXT_PUBLIC_SUPABASE_URL=get-from-supabase-dashboard NEXT_PUBLIC_SUPABASE_ANON_KEY=get-from-supabase-dashboard AUTHSIGNAL_SECRET=get-from-authsignal-dashboard @@ -84,19 +84,19 @@ npm run dev Install the Supabase client and Auth helpers for Next.js: -``` +```bash npm install @supabase/supabase-js @supabase/auth-helpers-nextjs ``` Install the Authsignal Node.js client: -``` +```bash npm install @authsignal/node ``` Finally install 2 packages to help encrypt and serialize session data in cookies: -``` +```bash npm install @hapi/iron cookie npm install --save-dev @types/cookie ``` @@ -105,18 +105,18 @@ npm install --save-dev @types/cookie Add the following code to `/lib/authsignal.ts`: -``` -import { Authsignal } from "@authsignal/node"; +```ts +import { Authsignal } from '@authsignal/node' -const secret = process.env.AUTHSIGNAL_SECRET; +const secret = process.env.AUTHSIGNAL_SECRET if (!secret) { - throw new Error("AUTHSIGNAL_SECRET is undefined"); + throw new Error('AUTHSIGNAL_SECRET is undefined') } -const redirectUrl = "http://localhost:3000/api/callback"; +const redirectUrl = 'http://localhost:3000/api/callback' -export const authsignal = new Authsignal({ secret, redirectUrl }); +export const authsignal = new Authsignal({ secret, redirectUrl }) ``` The `redirectUrl` here is a Next.js API route which Authsignal will redirect back to after an MFA challenge. We'll implement this below. @@ -131,83 +131,72 @@ Next we will add some helper functions for managing cookies: Add the following code to `/lib/cookies.ts`: -``` -import Iron from "@hapi/iron"; -import { Session } from "@supabase/supabase-js"; -import { parse, serialize } from "cookie"; -import { NextApiRequest, NextApiResponse } from "next"; +```ts +import Iron from '@hapi/iron' +import { Session } from '@supabase/supabase-js' +import { parse, serialize } from 'cookie' +import { NextApiRequest, NextApiResponse } from 'next' export async function setTempCookie(session: Session, res: NextApiResponse) { - const token = await Iron.seal(session, TEMP_TOKEN_SECRET, Iron.defaults); + const token = await Iron.seal(session, TEMP_TOKEN_SECRET, Iron.defaults) const cookie = serialize(TEMP_COOKIE, token, { maxAge: session.expires_in, httpOnly: true, - secure: process.env.NODE_ENV === "production", - path: "/", - sameSite: "lax", - }); + secure: process.env.NODE_ENV === 'production', + path: '/', + sameSite: 'lax', + }) - res.setHeader("Set-Cookie", cookie); + res.setHeader('Set-Cookie', cookie) } -export async function getSessionFromTempCookie( - req: NextApiRequest -): Promise { - const cookie = req.headers.cookie as string; +export async function getSessionFromTempCookie(req: NextApiRequest): Promise { + const cookie = req.headers.cookie as string - const cookies = parse(cookie ?? ""); + const cookies = parse(cookie ?? '') - const tempCookie = cookies[TEMP_COOKIE]; + const tempCookie = cookies[TEMP_COOKIE] if (!tempCookie) { - return undefined; + return undefined } - const session = await Iron.unseal( - tempCookie, - TEMP_TOKEN_SECRET, - Iron.defaults - ); + const session = await Iron.unseal(tempCookie, TEMP_TOKEN_SECRET, Iron.defaults) - return session; + return session } export function setAuthCookie(session: Session, res: NextApiResponse) { - const { access_token, refresh_token, expires_in } = session; + const { access_token, refresh_token, expires_in } = session const authCookies = [ { name: ACCESS_TOKEN_COOKIE, value: access_token }, - refresh_token - ? { name: REFRESH_TOKEN_COOKIE, value: refresh_token } - : undefined, + refresh_token ? { name: REFRESH_TOKEN_COOKIE, value: refresh_token } : undefined, ] .filter(isDefined) .map(({ name, value }) => serialize(name, value, { maxAge: expires_in, httpOnly: true, - secure: process.env.NODE_ENV === "production", - path: "/", - sameSite: "lax", + secure: process.env.NODE_ENV === 'production', + path: '/', + sameSite: 'lax', }) - ); + ) // Also clear the temp cookie - const updatedCookies = [ - ...authCookies, - serialize(TEMP_COOKIE, "", { maxAge: -1, path: "/" }), - ]; + const updatedCookies = [...authCookies, serialize(TEMP_COOKIE, '', { maxAge: -1, path: '/' })] - res.setHeader("Set-Cookie", updatedCookies); + res.setHeader('Set-Cookie', updatedCookies) } -const isDefined = (value: T | undefined): value is T => !!value; +const isDefined = (value: T | undefined): value is T => !!value -const TEMP_TOKEN_SECRET = process.env.TEMP_TOKEN_SECRET!; -const TEMP_COOKIE = "as-mfa-cookie"; -const ACCESS_TOKEN_COOKIE = "sb-access-token"; -const REFRESH_TOKEN_COOKIE = "sb-refresh-token"; +const TEMP_TOKEN_SECRET = process.env.TEMP_TOKEN_SECRET! +const TEMP_COOKIE = 'as-mfa-cookie' +const ACCESS_TOKEN_COOKIE = 'sb-access-token' +const REFRESH_TOKEN_COOKIE = 'sb-refresh-token' ``` ## Step 7: Building the UI @@ -216,34 +205,34 @@ We will add some form components for signing in and signing up as well as a basi Add the following code to `/pages/sign-up.tsx`: -``` -import Link from "next/link"; -import { useRouter } from "next/router"; +```ts +import Link from 'next/link' +import { useRouter } from 'next/router' export default function SignUpPage() { - const router = useRouter(); + const router = useRouter() return (
      { - e.preventDefault(); + e.preventDefault() const target = e.target as typeof e.target & { - email: { value: string }; - password: { value: string }; - }; + email: { value: string } + password: { value: string } + } - const email = target.email.value; - const password = target.password.value; + const email = target.email.value + const password = target.password.value - await fetch("/api/sign-up", { - method: "POST", - headers: { "Content-Type": "application/json" }, + await fetch('/api/sign-up', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, password }), - }).then((res) => res.json()); + }).then((res) => res.json()) - router.push("/"); + router.push('/') }} > @@ -253,49 +242,49 @@ export default function SignUpPage() {
      - ); + ) } ``` Then add the following code to `/pages/sign-in.tsx`: -``` -import Link from "next/link"; -import { useRouter } from "next/router"; +```ts +import Link from 'next/link' +import { useRouter } from 'next/router' export default function SignInPage() { - const router = useRouter(); + const router = useRouter() return (
      { - e.preventDefault(); + e.preventDefault() const target = e.target as typeof e.target & { - email: { value: string }; - password: { value: string }; - }; + email: { value: string } + password: { value: string } + } - const email = target.email.value; - const password = target.password.value; + const email = target.email.value + const password = target.password.value - const { state, mfaUrl } = await fetch("/api/sign-in", { - method: "POST", - headers: { "Content-Type": "application/json" }, + const { state, mfaUrl } = await fetch('/api/sign-in', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, password }), - }).then((res) => res.json()); + }).then((res) => res.json()) - if (state === "CHALLENGE_REQUIRED") { - window.location.href = mfaUrl; + if (state === 'CHALLENGE_REQUIRED') { + window.location.href = mfaUrl } else { - router.push("/"); + router.push('/') } }} > @@ -312,38 +301,38 @@ export default function SignInPage() {
      - ); + ) } ``` Now we will use Supabase's `withPageAuth` wrapper around `getServerSideProps` to make the home page require authentication via SSR. Replace the existing code in `/pages/index.tsx` with the following: -``` -import { getUser, User, withPageAuth } from "@supabase/auth-helpers-nextjs"; -import { GetServerSideProps } from "next"; -import { useRouter } from "next/router"; -import { authsignal } from "../lib/authsignal"; +```ts +import { getUser, User, withPageAuth } from '@supabase/auth-helpers-nextjs' +import { GetServerSideProps } from 'next' +import { useRouter } from 'next/router' +import { authsignal } from '../lib/authsignal' interface Props { - user: User; - isEnrolled: boolean; + user: User + isEnrolled: boolean } export const getServerSideProps: GetServerSideProps = withPageAuth({ - redirectTo: "/sign-in", + redirectTo: '/sign-in', async getServerSideProps(ctx) { - const { user } = await getUser(ctx); + const { user } = await getUser(ctx) - const { isEnrolled } = await authsignal.getUser({userId: user.id}); + const { isEnrolled } = await authsignal.getUser({ userId: user.id }) return { props: { user, isEnrolled }, - }; + } }, -}); +}) export default function HomePage({ user, isEnrolled }: Props) { - const router = useRouter(); + const router = useRouter() return (
      @@ -351,29 +340,29 @@ export default function HomePage({ user, isEnrolled }: Props) {
      Signed in as: {user?.email}
      - +
      - ); + ) } ``` Optional: To make things look a bit nicer, you can add the following to `/styles/globals.css`: -``` +```css main { min-height: 100vh; display: flex; @@ -435,113 +424,95 @@ Now we'll replace the existing api routes in `/pages/api/` with 5 new routes: Add the following code to `/pages/api/sign-in.ts`: -``` -import { supabaseClient } from "@supabase/auth-helpers-nextjs"; -import { NextApiRequest, NextApiResponse } from "next"; -import { authsignal } from "../../lib/authsignal"; -import { setAuthCookie, setTempCookie } from "../../lib/cookies"; +```ts +import { supabaseClient } from '@supabase/auth-helpers-nextjs' +import { NextApiRequest, NextApiResponse } from 'next' +import { authsignal } from '../../lib/authsignal' +import { setAuthCookie, setTempCookie } from '../../lib/cookies' -export default async function signIn( - req: NextApiRequest, - res: NextApiResponse -) { - const { email, password } = req.body; +export default async function signIn(req: NextApiRequest, res: NextApiResponse) { + const { email, password } = req.body - const { data, error } = await supabaseClient.auth.api.signInWithEmail( - email, - password - ); + const { data, error } = await supabaseClient.auth.api.signInWithEmail(email, password) if (error || !data?.user) { - return res.send({ error }); + return res.send({ error }) } const { state, url: mfaUrl } = await authsignal.track({ - action: "signIn", + action: 'signIn', userId: data.user.id, - }); + }) - if (state === "CHALLENGE_REQUIRED") { - await setTempCookie(data, res); + if (state === 'CHALLENGE_REQUIRED') { + await setTempCookie(data, res) } else { - setAuthCookie(data, res); + setAuthCookie(data, res) } - res.send({ state, mfaUrl }); + res.send({ state, mfaUrl }) } ``` Then to handle new sign-ups add the following to `/pages/api/sign-up.ts`: -``` -import { supabaseClient } from "@supabase/auth-helpers-nextjs"; -import { Session } from "@supabase/supabase-js"; -import { NextApiRequest, NextApiResponse } from "next"; -import { setAuthCookie } from "../../lib/cookies"; +```ts +import { supabaseClient } from '@supabase/auth-helpers-nextjs' +import { Session } from '@supabase/supabase-js' +import { NextApiRequest, NextApiResponse } from 'next' +import { setAuthCookie } from '../../lib/cookies' -export default async function signUp( - req: NextApiRequest, - res: NextApiResponse -) { - const { email, password } = req.body; +export default async function signUp(req: NextApiRequest, res: NextApiResponse) { + const { email, password } = req.body - const { data, error } = await supabaseClient.auth.api.signUpWithEmail( - email, - password - ); + const { data, error } = await supabaseClient.auth.api.signUpWithEmail(email, password) if (error || !isSession(data)) { - res.send({ error }); + res.send({ error }) } else { - setAuthCookie(data, res); - res.send({ data }); + setAuthCookie(data, res) + res.send({ data }) } } -const isSession = (data: any): data is Session => !!data?.access_token; +const isSession = (data: any): data is Session => !!data?.access_token ``` To clear the auth cookies on sign-out add the following to `/pages/api/sign-out.ts`: -``` -import { supabaseClient } from "@supabase/auth-helpers-nextjs"; -import { NextApiRequest, NextApiResponse } from "next"; +```ts +import { supabaseClient } from '@supabase/auth-helpers-nextjs' +import { NextApiRequest, NextApiResponse } from 'next' -export default async function signOut( - req: NextApiRequest, - res: NextApiResponse -) { - supabaseClient.auth.api.deleteAuthCookie(req, res, { redirectTo: "/sign-in" }); +export default async function signOut(req: NextApiRequest, res: NextApiResponse) { + supabaseClient.auth.api.deleteAuthCookie(req, res, { redirectTo: '/sign-in' }) } ``` To handle the user's actions to set up MFA or manage their existing MFA settings, add the following to `/pages/api/mfa.ts`: -``` -import { getUser, withApiAuth } from "@supabase/auth-helpers-nextjs"; -import { NextApiRequest, NextApiResponse } from "next"; -import { authsignal } from "../../lib/authsignal"; +```ts +import { getUser, withApiAuth } from '@supabase/auth-helpers-nextjs' +import { NextApiRequest, NextApiResponse } from 'next' +import { authsignal } from '../../lib/authsignal' -export default withApiAuth(async function mfa( - req: NextApiRequest, - res: NextApiResponse -) { - if (req.method !== "POST") { - return res.status(405).send({ message: "Only POST requests allowed" }); +export default withApiAuth(async function mfa(req: NextApiRequest, res: NextApiResponse) { + if (req.method !== 'POST') { + return res.status(405).send({ message: 'Only POST requests allowed' }) } - const { user } = await getUser({ req, res }); + const { user } = await getUser({ req, res }) - const { isEnrolled } = req.body; + const { isEnrolled } = req.body const { url: mfaUrl } = await authsignal.track({ - action: isEnrolled ? "manageSettings" : "enroll", + action: isEnrolled ? 'manageSettings' : 'enroll', userId: user.id, redirectToSettings: isEnrolled, - }); + }) - res.send({ mfaUrl }); -}); + res.send({ mfaUrl }) +}) ``` Because the user should be authenticated with Supabase to set up or manage MFA, we can use Supabase's `withApiAuth` wrapper to protect this route. @@ -550,28 +521,25 @@ The `redirectToSettings` param specifies whether the user should be redirected t Finally we need a route to handle the redirect back from Authsignal after an MFA challenge. Add the following to `/pages/api/callback.ts`: -``` -import { NextApiRequest, NextApiResponse } from "next"; -import { authsignal } from "../../lib/authsignal"; -import { getSessionFromTempCookie, setAuthCookie } from "../../lib/cookies"; +```ts +import { NextApiRequest, NextApiResponse } from 'next' +import { authsignal } from '../../lib/authsignal' +import { getSessionFromTempCookie, setAuthCookie } from '../../lib/cookies' -export default async function callback( - req: NextApiRequest, - res: NextApiResponse -) { - const token = req.query.token as string; +export default async function callback(req: NextApiRequest, res: NextApiResponse) { + const token = req.query.token as string - const { success } = await authsignal.validateChallenge({ token }); + const { success } = await authsignal.validateChallenge({ token }) if (success) { - const session = await getSessionFromTempCookie(req); + const session = await getSessionFromTempCookie(req) if (session) { - setAuthCookie(session, res); + setAuthCookie(session, res) } } - res.redirect("/"); + res.redirect('/') } ``` diff --git a/apps/docs/pages/guides/integrations/estuary.mdx b/apps/docs/pages/guides/integrations/estuary.mdx index 549f6cbc549..e8287eaff62 100644 --- a/apps/docs/pages/guides/integrations/estuary.mdx +++ b/apps/docs/pages/guides/integrations/estuary.mdx @@ -3,62 +3,64 @@ import Layout from '~/layouts/DefaultGuideLayout' export const meta = { id: 'estuary', title: 'Estuary', - description: 'Create a real-time data pipeline connecting Firestore and Supabase to make migration simple.', + description: + 'Create a real-time data pipeline connecting Firestore and Supabase to make migration simple.', } Estuary Flow is a platform for creating [real-time data pipelines at scale](https://www.estuary.dev/). -It combines the intuitive interface of an ELT service with an event-driven runtime and a variety of open-source connectors. +It combines the intuitive interface of an ELT service with an event-driven runtime and a variety of open-source connectors. -You can use Flow to migrate your data from Firestore to the Postgres database in your Supabase project. +You can use Flow to migrate your data from Firestore to the Postgres database in your Supabase project. You do this by building a real-time pipeline that captures data from Firestore and materializes (loads) that data to Postgres. -Once created, the pipeline backfills all your historical data from Firestore and continues to process new data events in real time. +Once created, the pipeline backfills all your historical data from Firestore and continues to process new data events in real time. ## Prerequisites Before you begin, you'll need: -* An [Estuary account](go.estuary.dev/sign-up). +- An [Estuary account](https://go.estuary.dev/sign-up). -* For your Firestore database: - * A Google service account with read access to your Firestore database, via [roles/datastore.viewer](https://cloud.google.com/datastore/docs/access/iam). You can assign this role when you [create the service account](https://cloud.google.com/iam/docs/creating-managing-service-accounts#creating), or [add it to an existing service account](https://cloud.google.com/iam/docs/granting-changing-revoking-access#single-role). - * A generated [JSON service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating) for the service account. +- For your Firestore database: -* A Supabase project + - A Google service account with read access to your Firestore database, via [roles/datastore.viewer](https://cloud.google.com/datastore/docs/access/iam). You can assign this role when you [create the service account](https://cloud.google.com/iam/docs/creating-managing-service-accounts#creating), or [add it to an existing service account](https://cloud.google.com/iam/docs/granting-changing-revoking-access#single-role). + - A generated [JSON service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating) for the service account. + +- A Supabase project ## Step 1: Capture your Firestore data -You'll start by creating a **capture**, a task in Flow that connects to your data source system: in this case, Firestore. This process will create one or more data **collections**, backed by a real-time data lake. +You'll start by creating a **capture**, a task in Flow that connects to your data source system: in this case, Firestore. This process will create one or more data **collections**, backed by a real-time data lake. 1. Go to the Flow web application at [dashboard.estuary.dev](http://dashboard.estuary.dev) and sign in using the credentials provided by your Estuary account manager. 2. Click the **Captures** tab and choose **New Capture**. -3. Locate and select the **Google Firestore** card. +3. Locate and select the **Google Firestore** card. A form appears with the properties required for a Firestore capture. -4. Set a name for your capture. - +4. Set a name for your capture. + Click inside the **Name** field to generate a drop-down menu of available **prefixes** and select one (likely, this will be the name of your organization). Append a unique capture name after the `/` to create the full name, for example, `acmeCo/myFirestoreCapture`. 5. Fill out the required properties for Firestore. - * **Database**: Flow can autodetect the database name, but you may optionally specify it here. This is helpful if the service account used has access to multiple Firebase projects. Your database name usually follows the format `projects/$PROJECTID/databases/(default)`. - * **Credentials**: The JSON service account key created per the prerequisites. + - **Database**: Flow can autodetect the database name, but you may optionally specify it here. This is helpful if the service account used has access to multiple Firebase projects. Your database name usually follows the format `projects/$PROJECTID/databases/(default)`. + - **Credentials**: The JSON service account key created per the prerequisites. 6. Click **Discover Endpoint**. - Flow uses the provided configuration to initiate a connection with Firestore. It generates a capture specification and details of the collections that it will create, once published. +Flow uses the provided configuration to initiate a connection with Firestore. It generates a capture specification and details of the collections that it will create, once published. -7. Use the **Specification Editor** to view the [JSON schemas](https://docs.estuary.dev/concepts/schemas/) for each collection and make sure they are formatted correctly for your needs. If they're not, you can edit them. +7. Use the **Specification Editor** to view the [JSON schemas](https://docs.estuary.dev/concepts/schemas/) for each collection and make sure they are formatted correctly for your needs. If they're not, you can edit them. 8. Click **Save and publish**. - You'll see a notification when the capture publishes successfully. +You'll see a notification when the capture publishes successfully. - The data currently in your Firestore database has been captured, and future updates to it will be captured continuously. +The data currently in your Firestore database has been captured, and future updates to it will be captured continuously. - Click **Materialize Collections** to continue. +Click **Materialize Collections** to continue. ## Step 2: Materialize your collections to Postgres @@ -66,35 +68,35 @@ Next, you'll add a Postgres materialization to connect the captured collections 1. On the **Create Materialization** page, search for and select the **PostgreSQL** tile. - A form appears with the properties required for a Postgres materialization. +A form appears with the properties required for a Postgres materialization. 2. Choose a unique name for your materialization like you did when naming your capture; for example, `acmeCo/mySupabaseMaterialization`. 3. Fill out the required properties for PostgreSQL. You can find most of these in Supabase by going to the **Settings** section and clicking **Database**. - * **Address**: Format at `:`. - * **User**: Usually, this is `postgres`. - * **Password**: The password you set when you created your Supabase project. + - **Address**: Format at `:`. + - **User**: Usually, this is `postgres`. + - **Password**: The password you set when you created your Supabase project. 4. Scroll down to view the **Collection Selector** and fill in the **Table** field for each collection. - The collections you just created have already been selected, but you must provide names for the tables to which they'll be materialized. +The collections you just created have already been selected, but you must provide names for the tables to which they'll be materialized. -5. Click **Discover Endpoint**. - - Flow uses the provided configuration to initiate a connection to your Supabase Postgres database and generate a specification. +5. Click **Discover Endpoint**. -6. Click **Save and Publish**. You'll see a notification when the full materialization publishes successfully. +Flow uses the provided configuration to initiate a connection to your Supabase Postgres database and generate a specification. -Your Firestore collections are copied to tables in Supabase. As long as you leave the capture and materialation running, any changes to the Firestore data will be reflected in Supabase in milliseconds. +6. Click **Save and Publish**. You'll see a notification when the full materialization publishes successfully. + +Your Firestore collections are copied to tables in Supabase. As long as you leave the capture and materialation running, any changes to the Firestore data will be reflected in Supabase in milliseconds. ## Resources For more information, visit the [Flow docs](https://docs.estuary.dev/). In particular: - * [Guide to create a Data Flow](https://docs.estuary.dev/guides/create-dataflow/) - * [Firestore capture connector](https://docs.estuary.dev/reference/Connectors/capture-connectors/google-firestore/) - * [Postgres materializaiton connector](https://docs.estuary.dev/reference/Connectors/materialization-connectors/PostgreSQL/) +- [Guide to create a Data Flow](https://docs.estuary.dev/guides/create-dataflow/) +- [Firestore capture connector](https://docs.estuary.dev/reference/Connectors/capture-connectors/google-firestore/) +- [Postgres materializaiton connector](https://docs.estuary.dev/reference/Connectors/materialization-connectors/PostgreSQL/) export const Page = ({ children }) => diff --git a/apps/docs/pages/guides/integrations/prisma.mdx b/apps/docs/pages/guides/integrations/prisma.mdx index 7334621d910..6a80e95fee6 100644 --- a/apps/docs/pages/guides/integrations/prisma.mdx +++ b/apps/docs/pages/guides/integrations/prisma.mdx @@ -63,21 +63,38 @@ This project comes with TypeScript configured and has the following structure. ### Configuring the project to use PostgreSQL -Go ahead and delete the `prisma/dev.db` file because we will be switching to PostgreSQL. -Next, inside the `prisma/.env` file, update the value of the `DATABASE_URL` variable to the connection string you got in **step 1**. The URL might look as follows: +By default, Prisma migrations will try to drop the `postgres` database, which can lead to conflicts with Supabase databases. For this scenario, use [Prisma Shadow Databases](https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually). -```env -# prisma/.env -postgres://postgres:[YOUR-PASSWORD]@db.vdbnhqozmlzdsaejdxwr.supabase.co:5432/postgres +Create a shadow database in your PostgreSQL server within the same Supabase project using the `psql` CLI and the `DATABASE_URL` from the previous steps (or use the local database). + +```bash +psql postgresql://postgres:[YOUR-PASSWORD]@db.vdbnhqozmlzdsaejdxwr.supabase.red:5432 ``` -Finally, inside your `schema.prisma` file, change the `provider` from “sqlite” to `“postgresql”`. +After you connect to your project's PostgreSQL instance, create another database (e.g., `postgres_shadow`): + +```bash +postgres=> CREATE DATABASE postgres_shadow; +postgres=> exit +``` + +Go ahead and delete the `prisma/dev.db` file because we will be switching to PostgreSQL. +In the `.env` file, update `DATABASE_URL` and `SHADOW_DATABASE_URL` to the connection string from **step 1**. The `.env` file should look like: + +```env +# .env +DATABASE_URL="postgres://postgres:[YOUR-PASSWORD]@db.vdbnhqozmlzdsaejdxwr.supabase.co:5432/postgres" +SHADOW_DATABASE_URL="postgres://postgres:[YOUR-PASSWORD]@db.vdbnhqozmlzdsaejdxwr.supabase.co:5432/postgres_shadow" +``` + +In the `schema.prisma` file, change the `provider` from "sqlite" to `"postgresql"` and add the `shadowDatabaseUrl` property. This is what your `schema.prisma` file should look like: ```go datasource db { provider = “postgresql” url = env(“DATABASE_URL”) + shadowDatabaseUrl = env("SHADOW_DATABASE_URL") } generator client { provider = “prisma-client-js” @@ -124,11 +141,12 @@ This will create a `prisma/migrations` folder inside your `prisma` directory and If you’re working in a serverless environment (for example Node.js functions hosted on AWS Lambda, Vercel or Netlify Functions), you need to set up [connection pooling](https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#serverless-environments-faas) using a tool like [PgBouncer](https://www.pgbouncer.org/). That’s because every function invocation may result in a [new connection to the database](https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#the-serverless-challenge). Supabase [supports connection management using PgBouncer](https://supabase.io/blog/2021/04/02/supabase-pgbouncer#what-is-connection-pooling) and are enabled by default. Go to the **Database** page from the sidebar in the Supabase dashboard and navigate to **connection pool** settings ![Connection pool settings](/docs/img/guides/integrations/prisma/w0oowg8vq435ob5c3gf0.png) -When running migrations you need to use the non pooled connection URL (like the one we used in **step 1**). However, when deploying your app, you’ll use the pooled connection URL and add the `?pgbouncer=true` flag to the PostgreSQL connection URL. To minimize the number of concurrent connections, setting the `connection_limit` to `1` is also recommended. So the URL might look as follows: +When migrating, you need to use the non-pooled connection URL (like the one used in **step 1**). However, when deploying your app, use the pooled connection URL and add the `?pgbouncer=true` flag to the PostgreSQL connection URL. It's also recommended to minimize the number of concurrent connections by setting the `connection_limit` to `1`. The `.env` file should look like: ```env -# prisma/.env -postgres://postgres:[YOUR-PASSWORD]@db.vdbnhqozmlzdsaejdxwr.supabase.co:6543/postgres?pgbouncer=true&connection_limit=1 +# .env +DATABASE_URL="postgres://postgres:[YOUR-PASSWORD]@db.vdbnhqozmlzdsaejdxwr.supabase.co:6543/postgres?pgbouncer=true&connection_limit=1" +SHADOW_DATABASE_URL="postgres://postgres:[YOUR-PASSWORD]@db.vdbnhqozmlzdsaejdxwr.supabase.co:5432/postgres_shadow" ``` Prisma Migrate uses database transactions to check out the current state of the database and the migrations table. However, the Migration Engine is designed to use a single connection to the database, and does not support connection pooling with PgBouncer. If you attempt to run Prisma Migrate commands in any environment that uses PgBouncer for connection pooling, you might see the following error: diff --git a/apps/docs/pages/guides/integrations/sequin.mdx b/apps/docs/pages/guides/integrations/sequin.mdx index efdb578c775..200ca829ea0 100644 --- a/apps/docs/pages/guides/integrations/sequin.mdx +++ b/apps/docs/pages/guides/integrations/sequin.mdx @@ -82,7 +82,7 @@ You'll use this client to query for data in your synced schema. ## Resources - [Sequin](https://sequin.io) official website. -- [Sequin Console](https://app.sequin.io*). +- [Sequin Console](https://app.sequin.io). - [Sequin](https://docs.sequin.io/welcome) documentation. - [Sequin + Supabase + Stripe Tutorial](https://github.com/sequin-io/build-a-saas-with-next-js-supabase-stripe-and-sequin) diff --git a/apps/docs/pages/guides/integrations/snaplet.mdx b/apps/docs/pages/guides/integrations/snaplet.mdx index 6f541f8253b..151b6627035 100644 --- a/apps/docs/pages/guides/integrations/snaplet.mdx +++ b/apps/docs/pages/guides/integrations/snaplet.mdx @@ -51,7 +51,7 @@ The password is the same password you used when creating the Supabase project. ![supabase-connection-db-info](/docs/img/guides/integrations/snaplet/supabase-connection-db-info.png) -You’ll have to confirm providing Snaplet access to your database. Snaplet will prompt you to only provide `read-only` access to your database. Snaplet has a guide in their documentation on how to do so [here](https://docs.snaplet.dev/postgresql/create-read-only-role). +You’ll have to confirm providing Snaplet access to your database. Snaplet will prompt you to only provide `read-only` access to your database. Snaplet has a guide in their documentation on how to do so [here](https://docs.snaplet.dev/guides/postgresql/#create-read-only-role). > Note that whatever connection string you provide here will be that of your Data Source – essentially the production database in a real-life scenario diff --git a/apps/docs/pages/guides/integrations/weweb.mdx b/apps/docs/pages/guides/integrations/weweb.mdx index 93ddbd5f2bc..85809a457a9 100644 --- a/apps/docs/pages/guides/integrations/weweb.mdx +++ b/apps/docs/pages/guides/integrations/weweb.mdx @@ -39,12 +39,7 @@ Once you have added both to WeWeb, you will have the option to enable realtime t **🚨 Warning 🚨** -> Realtime is disabled by default in Supabase for better database performance and security. Learn more about [realtime functionalities](https://supabase.com/docs/guides/database#realtime) in our documentation. -> Member -> @awalias awalias 16 days ago -> might just wanna change these ones to be relative but otherwise looks great 👍 - -@EWMAs Reply... +> Realtime is disabled by default in Supabase for better database performance and security. Learn more about [realtime functionalities](/docs/guides/realtime). ## Step 2: GET Data from Supabase @@ -108,7 +103,7 @@ If we only ask for the data from the `location` field of the `vehicles` table, S Assuming you were able to fetch data from Supabase in a WeWeb Collection, you'll be able to bind the data from that Collection on your WeWeb pages. -In the example below, we chose to display the car model and mileage in the [Data Grid element](https://docs.weweb.io/data-grid/) that comes out-of-the-box in WeWeb: +In the example below, we chose to display the car model and mileage in the [Data Grid element](https://docs.weweb.io/add-elements/elements/data-grid.html) that comes out-of-the-box in WeWeb: ![](https://weweb-changelog.ghost.io/content/images/2022/10/CleanShot-2022-10-21-at-12.31.05@2x.png) @@ -116,7 +111,7 @@ We chose this element because it includes a built-in inline editing mode we'll w #### 🔥 Pro Tip 🔥 -> In WeWeb, you can [bind arrays of data to any Container](https://docs.weweb.io/display-collection-list/). Just bear in mind that the first child of the Container you bind the Collection to will be the repeated item. With that in mind, you might want the first child Element to be another Container with a number of items inside like a title, description, button or image. +> In WeWeb, you can [bind arrays of data to any Container](https://docs.weweb.io/binding-filtering/display-data.html). Just bear in mind that the first child of the Container you bind the Collection to will be the repeated item. With that in mind, you might want the first child Element to be another Container with a number of items inside like a title, description, button or image. ## Step 4: Update a record in Supabase diff --git a/apps/docs/pages/guides/platform/custom-domains.mdx b/apps/docs/pages/guides/platform/custom-domains.mdx index 01249cf5455..13fedb8e525 100644 --- a/apps/docs/pages/guides/platform/custom-domains.mdx +++ b/apps/docs/pages/guides/platform/custom-domains.mdx @@ -143,7 +143,8 @@ As with the final activation stage of the process for setting up a vanity subdom ## Limitations -Edge functions do not honor the custom domain or the vanity subdomain setting and they still have to be invoked via the `foobarbaz.supabase.co` domain. +- Edge functions do not honor the custom domain or the vanity subdomain setting and they still have to be invoked via the `foobarbaz.supabase.co` domain. +- A Supabase project can—at this time—use either a Custom Domain or a Vanity Subdomain, but not both. export const Page = ({ children }) => diff --git a/apps/docs/pages/guides/platform/network-restrictions.mdx b/apps/docs/pages/guides/platform/network-restrictions.mdx index c2286c6a4f5..ce2f320a023 100644 --- a/apps/docs/pages/guides/platform/network-restrictions.mdx +++ b/apps/docs/pages/guides/platform/network-restrictions.mdx @@ -20,7 +20,7 @@ To get started: 1. [Install](/docs/guides/cli) the Supabase CLI 1.22.0+. 1. [Log in](/docs/guides/cli/local-development#log-in-to-the-supabase-cli) to your Supabase account using the CLI. -1. Ensure that you have [Owner or Admin permissions](/docs/guides/hosting/platform/access-control#manage-team-members) for the project that you are enabling network restrictions. +1. Ensure that you have [Owner or Admin permissions](/docs/guides/platform/access-control#manage-team-members) for the project that you are enabling network restrictions. ## Check restrictions diff --git a/apps/docs/pages/guides/resources.mdx b/apps/docs/pages/guides/resources.mdx index 65774f5b504..b1b139020d3 100644 --- a/apps/docs/pages/guides/resources.mdx +++ b/apps/docs/pages/guides/resources.mdx @@ -76,16 +76,6 @@ export const meta = {
      -
      - - ### Self-Hosting Supabase - - We're happy to host your next big thing, but we also make it easy to host Supabase on your own. We use Docker to help make setup as painless as possible. - -[Learn more](/docs/guides/resources/self-hosting) - -
      -
      {/* end of container */} diff --git a/apps/docs/pages/guides/resources/supabase-cli/local-development.mdx b/apps/docs/pages/guides/resources/supabase-cli/local-development.mdx index 3ff1cb1c82a..90490ae4e55 100644 --- a/apps/docs/pages/guides/resources/supabase-cli/local-development.mdx +++ b/apps/docs/pages/guides/resources/supabase-cli/local-development.mdx @@ -54,7 +54,7 @@ git init supabase init ``` -Make sure Docker is running. The [start](/docs/reference/cli/usage#supabase-start) command uses Docker to start the Supabase [services](/docs/architecture). +Make sure Docker is running. The [start](/docs/reference/cli/usage#supabase-start) command uses Docker to start the Supabase [services](/docs/guides/getting-started/architecture). This command may take a while to run if this is the first time using the CLI. ```bash diff --git a/apps/docs/pages/guides/resources/self-hosting.mdx b/apps/docs/pages/guides/self-hosting.mdx similarity index 95% rename from apps/docs/pages/guides/resources/self-hosting.mdx rename to apps/docs/pages/guides/self-hosting.mdx index 51e618c4d31..cdd7b69cc57 100644 --- a/apps/docs/pages/guides/resources/self-hosting.mdx +++ b/apps/docs/pages/guides/self-hosting.mdx @@ -1,16 +1,14 @@ import Layout from '~/layouts/DefaultGuideLayout' export const meta = { - id: 'overview', - title: 'Self Hosting', - sidebar_label: 'Overview', - description: 'Getting started with Self Hosting.', + title: 'Self-Hosting', + description: 'Getting started with self-hosting Supabase.', } There are several ways to use Supabase: - [Supabase Cloud](https://app.supabase.com): you don't need to deploy anything. We will manage and scale your infrastructure. -- [Docker](../../guides/hosting/docker): deploy to your own infrastructure. +- [Docker](/docs/guides/self-hosting/docker): deploy to your own infrastructure. - Kubernetes: coming soon. ## Architecture @@ -74,7 +72,7 @@ For working with JWT and Auth functions. Supabase creates several default roles in your Postgres database. To restore defaults at any time you can run the commands inside the [schema initialization scripts](https://github.com/supabase/postgres/tree/develop/migrations/db/init-scripts). Remember to change your -[role passwords](./docker#securing-your-setup) before deploying to production environments. +[role passwords](/docs/guides/self-hosting/docker#securing-your-setup) before deploying to production environments. ##### `postgres` @@ -151,7 +149,7 @@ We realize that database migrations are difficult, and this is one of the proble While Supabase officially supports Docker, we have several other deployment strategies managed by the community: -- [supabase-docker](../../guides/hosting/docker) (Official) +- [supabase-docker](/docs/guides/self-hosting/docker) (Official) - [supabase-kubernetes](https://github.com/supabase-community/supabase-kubernetes) (Unofficial) - [supabase-terraform](https://github.com/supabase-community/supabase-terraform) (Unofficial) - [supabase-traefik](https://github.com/supabase-community/supabase-traefik) (Unofficial) diff --git a/apps/docs/pages/guides/self-hosting/auth/config.mdx b/apps/docs/pages/guides/self-hosting/auth/config.mdx new file mode 100644 index 00000000000..0e894114c65 --- /dev/null +++ b/apps/docs/pages/guides/self-hosting/auth/config.mdx @@ -0,0 +1,38 @@ +import Layout from '~/layouts/DefaultGuideLayout' +import { getAuthConfigV1 } from '~/lib/mdx/getConfig' +import Param from '~/components/Params' + +export const spec = getAuthConfigV1() + +export const meta = { + title: 'Auth Self-hosting Config', + description: 'How to configure and deploy Supabase.', +} + +
      {spec.info.description}
      + +
      +{spec.info.tags.map(tag => { + return ( + <> +

      {tag.title}

      +

      {tag.description}

      +
      +
      Parameters
      +
        + {spec.parameters.filter(param => param.tags.includes(tag.id)).map((param) => { + return + })} + +
      +
      + + ) + +})} + +
      + +export const Page = ({ children }) => + +export default Page diff --git a/apps/docs/pages/guides/resources/self-hosting/docker.mdx b/apps/docs/pages/guides/self-hosting/docker.mdx similarity index 82% rename from apps/docs/pages/guides/resources/self-hosting/docker.mdx rename to apps/docs/pages/guides/self-hosting/docker.mdx index ab14e78b0eb..0a32049889b 100644 --- a/apps/docs/pages/guides/resources/self-hosting/docker.mdx +++ b/apps/docs/pages/guides/self-hosting/docker.mdx @@ -1,10 +1,8 @@ import Layout from '~/layouts/DefaultGuideLayout' export const meta = { - id: 'docker', - title: 'Self-hosting with Docker', - description: 'How to configure and deploy Supabase.', - sidebar_label: 'Docker', + title: 'Self-Hosting with Docker', + description: 'Learn how to configure and deploy Supabase with Docker.', } Docker is the easiest way to get started with self-hosted Supabase. @@ -13,7 +11,7 @@ Docker is the easiest way to get started with self-hosted Supabase. You need the following installed in your system: -- [Docker](https://docs.docker.com/engine/install/) and [docker-compose](https://docs.docker.com/compose/install/) +- [Docker](https://docs.docker.com/engine/install/) and [docker compose](https://docs.docker.com/compose/install/) - [Git](https://git-scm.com/downloads) ## Quick Start @@ -33,7 +31,7 @@ cd supabase/docker cp .env.example .env # Start -docker-compose up +docker compose up ``` Now visit [http://localhost:3000](http://localhost:3000) to start using Supabase Studio. @@ -42,11 +40,11 @@ Now visit [http://localhost:3000](http://localhost:3000) to start using Supabase While we provided you with some example secrets for getting started, you should NEVER deploy your Supabase setup using the defaults we have provided. -Please follow these steps to secure your Docker setup. We [strongly recommend](../../guides/hosting/overview#managing-your-secrets) using a secrets manager when deploying to production. +Follow these steps to secure your Docker setup. We strongly recommend using a [secrets manager](../self-hosting#managing-your-secrets) when deploying to production. ### Generate API Keys -Use your `JWT_SECRET` to generate a `anon` and `service` API keys using the [JWT generator](../../guides/hosting/overview#api-keys). +Use your `JWT_SECRET` to generate a `anon` and `service` API keys using the [JWT generator](../self-hosting#api-keys). Replace the values in these files: @@ -72,7 +70,7 @@ The Docker setup doesn't include a management database for managing users and lo ## Configuration -Each system can be [configured](../../guides/hosting/overview#configuration) to suit your particular use-case. +Each system can be [configured](../self-hosting#configuration) to suit your particular use-case. To keep the setup simple, we made some choices that may not be optimal for production: @@ -82,7 +80,7 @@ To keep the setup simple, we made some choices that may not be optimal for produ ### Using an external database -We strongly [recommend](../../guides/hosting/overview#managing-your-database) that you decouple your database from `docker-compose` before deploying. +We strongly recommend [decoupling your database](../self-hosting#managing-your-database) from `docker-compose` before deploying. The middleware will run with any PostgreSQL database that has logical replication enabled. The following environment variables should be updated in the `.env` file to point to your external database: @@ -99,7 +97,7 @@ Once you have done this, you can safely comment out the `db` section of the `doc ### Setting database's `log_min_messages` -By default, `docker-compose` sets the database's `log_min_messages` configuration to `fatal` to prevent redundant logs generated by Realtime. +By default, `docker compose` sets the database's `log_min_messages` configuration to `fatal` to prevent redundant logs generated by Realtime. However, you might miss important log messages such as database errors. Configure `log_min_messages` based on your needs. ### File storage backend on macOS diff --git a/apps/docs/pages/guides/self-hosting/realtime/config.mdx b/apps/docs/pages/guides/self-hosting/realtime/config.mdx new file mode 100644 index 00000000000..a52dc2c111a --- /dev/null +++ b/apps/docs/pages/guides/self-hosting/realtime/config.mdx @@ -0,0 +1,38 @@ +import Layout from '~/layouts/DefaultGuideLayout' +import { getRealtimeConfigV0 } from '~/lib/mdx/getConfig' +import Param from '~/components/Params' + +export const spec = getRealtimeConfigV0() + +export const meta = { + title: 'Realtime Self-hosting Config', + description: 'How to configure and deploy Supabase.', +} + +
      {spec.info.description}
      + +
      +{spec.info.tags.map(tag => { + return ( + <> +

      {tag.title}

      +

      {tag.description}

      +
      +
      Parameters
      +
        + {spec.parameters.filter(param => param.tags.includes(tag.id)).map((param) => { + return + })} + +
      +
      + + ) + +})} + +
      + +export const Page = ({ children }) => + +export default Page diff --git a/apps/docs/pages/guides/self-hosting/storage/config.mdx b/apps/docs/pages/guides/self-hosting/storage/config.mdx new file mode 100644 index 00000000000..a2e12665551 --- /dev/null +++ b/apps/docs/pages/guides/self-hosting/storage/config.mdx @@ -0,0 +1,38 @@ +import Layout from '~/layouts/DefaultGuideLayout' +import { getStorageConfigV0 } from '~/lib/mdx/getConfig' +import Param from '~/components/Params' + +export const spec = getStorageConfigV0() + +export const meta = { + title: 'Storage Self-hosting Config', + description: 'How to configure and deploy Supabase.', +} + +
      {spec.info.description}
      + +
      +{spec.info.tags.map(tag => { + return ( + <> +

      {tag.title}

      +

      {tag.description}

      +
      +
      Parameters
      +
        + {spec.parameters.filter(param => param.tags.includes(tag.id)).map((param) => { + return + })} + +
      +
      + + ) + +})} + +
      + +export const Page = ({ children }) => + +export default Page diff --git a/apps/docs/pages/index.mdx b/apps/docs/pages/index.mdx index a47df32ed83..17bc30954ec 100644 --- a/apps/docs/pages/index.mdx +++ b/apps/docs/pages/index.mdx @@ -11,9 +11,9 @@ export const meta = {

      Supabase is an open source Firebase alternative providing all the backend features you need to - build a product. [Learn more](/docs/architecture) about Supabase, start with the - [tutorials](/docs/guides/getting-started#tutorials), or dive straight into the different products - and APIs. + build a product. [Learn more](/docs/guides/getting-started/architecture) about Supabase, start + with the [tutorials](/docs/guides/getting-started#tutorials), or dive straight into the different + products and APIs.

      {/* start container */} @@ -30,7 +30,7 @@ export const meta = { ">
      -
      +

      Getting Started

      Discover how to set up a database to an app making queries in just a few minutes. @@ -144,7 +144,7 @@ export const meta = { key={product.title} passHref > - + {product.description} @@ -243,6 +243,7 @@ export const apis = [ hasLightIcon: true, href: 'reference/javascript/introduction', description: 'Official client libraries for JavaScript and TypeScript.', + span: 'col-span-12 md:col-span-6', }, { title: 'Flutter Client Library', @@ -250,6 +251,7 @@ export const apis = [ hasLightIcon: true, href: 'reference/dart/introduction', description: 'Official client libraries for Flutter and Dart.', + span: 'col-span-12 md:col-span-6', }, { title: 'Management API', @@ -257,6 +259,7 @@ export const apis = [ hasLightIcon: true, href: 'reference/api/introduction', description: 'Manage your Supabase projects and organizations programmatically.', + span: 'col-span-12 md:col-span-6', }, { title: 'Supabase CLI', @@ -265,6 +268,7 @@ export const apis = [ href: 'reference/cli/introduction', description: 'Use the CLI to develop your project locally, manage database migrations, and deploy to the Supabase Platform or self-host.', + span: 'col-span-12 md:col-span-6', }, { title: 'Self-Hosting Auth', @@ -307,6 +311,13 @@ export const platform = [ href: 'guides/resources', description: 'View examples, curated content from the community, migration guides, and more.', }, + { + title: 'Self-Hosting Supabase', + icon: '/docs/img/icons/menu/platform', + hasLightIcon: true, + href: 'guides/self-hosting', + description: 'Learn how to self-host Supabase and deploy to your own infrastructure.', + }, { // header: '/docs/img/cards/sample-card-header-2.svg', title: 'Integrations', diff --git a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx index afdc202a05f..c12f3cabbf2 100644 --- a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx @@ -7,6 +7,7 @@ import { flattenSections } from '~/lib/helpers' import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { useRouter } from 'next/router' +import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) @@ -15,13 +16,21 @@ export default function JSReference(props) { const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.id === slug) + const pageTitle = filteredSection[0]?.title + ? `${filteredSection[0]?.title} | Supabase` + : 'Supabase' + return ( - + <> + + + + ) } diff --git a/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx index 3ef20b302fe..2e67a5b5c8e 100644 --- a/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx @@ -7,6 +7,7 @@ import { flattenSections } from '~/lib/helpers' import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { useRouter } from 'next/router' +import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) @@ -15,13 +16,20 @@ export default function JSReference(props) { const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.id === slug) + const pageTitle = filteredSection[0]?.title + ? `${filteredSection[0]?.title} | Supabase` + : 'Supabase' return ( - + <> + + + + ) } diff --git a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx index bd631d0e07e..2e6e0b271a9 100644 --- a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx @@ -7,6 +7,7 @@ import { flattenSections } from '~/lib/helpers' import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { useRouter } from 'next/router' +import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) @@ -15,13 +16,21 @@ export default function JSReference(props) { const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.id === slug) + const pageTitle = filteredSection[0]?.title + ? `${filteredSection[0]?.title} | Supabase` + : 'Supabase' + return ( - + <> + + + + ) } diff --git a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx index d1aa3ec92ee..bbb38f4598a 100644 --- a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx @@ -7,7 +7,7 @@ import { flattenSections } from '~/lib/helpers' import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths' import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' import { useRouter } from 'next/router' - +import RefSEO from '~/components/reference/RefSEO' const sections = flattenSections(clientLibsCommonSections) export default function JSReference(props) { @@ -15,13 +15,21 @@ export default function JSReference(props) { const slug = router.query.slug[0] const filteredSection = sections.filter((section) => section.id === slug) + const pageTitle = filteredSection[0]?.title + ? `${filteredSection[0]?.title} | Supabase` + : 'Supabase' + return ( - + <> + + + + ) } diff --git a/apps/docs/public/humans.txt b/apps/docs/public/humans.txt index 95817e22f6d..2231880862b 100644 --- a/apps/docs/public/humans.txt +++ b/apps/docs/public/humans.txt @@ -34,6 +34,7 @@ Kevin Grüneberg Lakshmipathi G Laura C Leo T +Long Hoang Margarita Sandomirskaia Marijana Šimag Mark Burggraf @@ -60,7 +61,7 @@ ____________ JOBS -If you are interested in working with us check out the open roles here: https://about.supabase.com/careers +If you are interested in working with us check out the open roles here: https://supabase.com/careers ___________ diff --git a/apps/docs/public/img/icons/discord-icon.svg b/apps/docs/public/img/icons/discord-icon.svg index 3efe1ec110f..f8f9cebc2ee 100644 --- a/apps/docs/public/img/icons/discord-icon.svg +++ b/apps/docs/public/img/icons/discord-icon.svg @@ -1,10 +1,9 @@ - - - - - - - - - - + + + discord-icon + + + + + + \ No newline at end of file diff --git a/apps/docs/public/sitemap.xml b/apps/docs/public/sitemap.xml index f98257a34a2..38b0e06220a 100644 --- a/apps/docs/public/sitemap.xml +++ b/apps/docs/public/sitemap.xml @@ -24,18 +24,6 @@ 0.5 - - https://supabase.com/docs/handbook/contributing - weekly - 0.5 - - - - https://supabase.com/docs/handbook/introduction - weekly - 0.5 - - https://supabase.com/docs/guides/api weekly @@ -103,13 +91,13 @@ - https://supabase.com/docs/tutorials/nextjs + https://supabase.com/docs/handbook/contributing weekly 0.5 - https://supabase.com/docs/reference/index + https://supabase.com/docs/handbook/introduction weekly 0.5 @@ -120,84 +108,24 @@ 0.5 + + https://supabase.com/docs/reference/index + weekly + 0.5 + + + + https://supabase.com/docs/tutorials/nextjs + weekly + 0.5 + + https://supabase.com/docs/guides/api/generating-types weekly 0.5 - - https://supabase.com/docs/guides/auth/auth-captcha - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/auth-email-templates - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/auth-email - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/auth-helpers - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/auth-magic-link - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/auth-mfa - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/managing-user-data - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/overview - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/phone-login - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/row-level-security - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/server-side-rendering - weekly - 0.5 - - - - https://supabase.com/docs/guides/auth/social-login - weekly - 0.5 - - https://supabase.com/docs/guides/database/arrays weekly @@ -288,6 +216,78 @@ 0.5 + + https://supabase.com/docs/guides/auth/auth-captcha + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/auth-email-templates + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/auth-email + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/auth-helpers + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/auth-magic-link + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/auth-mfa + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/managing-user-data + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/overview + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/phone-login + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/row-level-security + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/server-side-rendering + weekly + 0.5 + + + + https://supabase.com/docs/guides/auth/social-login + weekly + 0.5 + + https://supabase.com/docs/guides/functions/auth weekly @@ -643,19 +643,37 @@ - https://supabase.com/docs/guides/auth/phone-login/messagebird + https://supabase.com/docs/guides/database/extensions/http weekly 0.5 - https://supabase.com/docs/guides/auth/phone-login/twilio + https://supabase.com/docs/guides/database/extensions/pgcron weekly 0.5 - https://supabase.com/docs/guides/auth/phone-login/vonage + https://supabase.com/docs/guides/database/extensions/pgnet + weekly + 0.5 + + + + https://supabase.com/docs/guides/database/extensions/pgtap + weekly + 0.5 + + + + https://supabase.com/docs/guides/database/extensions/plv8 + weekly + 0.5 + + + + https://supabase.com/docs/guides/database/extensions/uuid-ossp weekly 0.5 @@ -691,43 +709,19 @@ - https://supabase.com/docs/guides/functions/examples/og-image + https://supabase.com/docs/guides/auth/phone-login/messagebird weekly 0.5 - https://supabase.com/docs/guides/database/extensions/http + https://supabase.com/docs/guides/auth/phone-login/twilio weekly 0.5 - https://supabase.com/docs/guides/database/extensions/pgcron - weekly - 0.5 - - - - https://supabase.com/docs/guides/database/extensions/pgnet - weekly - 0.5 - - - - https://supabase.com/docs/guides/database/extensions/pgtap - weekly - 0.5 - - - - https://supabase.com/docs/guides/database/extensions/plv8 - weekly - 0.5 - - - - https://supabase.com/docs/guides/database/extensions/uuid-ossp + https://supabase.com/docs/guides/auth/phone-login/vonage weekly 0.5 @@ -835,43 +829,25 @@ - https://supabase.com/docs/guides/platform/sso/azure + https://supabase.com/docs/guides/functions/examples/og-image weekly 0.5 - https://supabase.com/docs/guides/platform/sso/gsuite + https://supabase.com/docs/guides/getting-started/quickstarts/nextjs weekly 0.5 - https://supabase.com/docs/guides/platform/sso/okta + https://supabase.com/docs/guides/getting-started/quickstarts/nuxtjs weekly 0.5 - https://supabase.com/docs/guides/resources/migrating-to-supabase/firebase-auth - weekly - 0.5 - - - - https://supabase.com/docs/guides/resources/migrating-to-supabase/firebase-storage - weekly - 0.5 - - - - https://supabase.com/docs/guides/resources/migrating-to-supabase/firestore-data - weekly - 0.5 - - - - https://supabase.com/docs/guides/resources/migrating-to-supabase/heroku + https://supabase.com/docs/guides/getting-started/quickstarts/reactjs weekly 0.5 @@ -960,30 +936,54 @@ 0.5 + + https://supabase.com/docs/guides/platform/sso/azure + weekly + 0.5 + + + + https://supabase.com/docs/guides/platform/sso/gsuite + weekly + 0.5 + + + + https://supabase.com/docs/guides/platform/sso/okta + weekly + 0.5 + + + + https://supabase.com/docs/guides/resources/migrating-to-supabase/firebase-auth + weekly + 0.5 + + + + https://supabase.com/docs/guides/resources/migrating-to-supabase/firebase-storage + weekly + 0.5 + + + + https://supabase.com/docs/guides/resources/migrating-to-supabase/firestore-data + weekly + 0.5 + + + + https://supabase.com/docs/guides/resources/migrating-to-supabase/heroku + weekly + 0.5 + + https://supabase.com/docs/guides/resources/self-hosting/docker weekly 0.5 - - https://supabase.com/docs/guides/getting-started/quickstarts/nextjs - weekly - 0.5 - - - - https://supabase.com/docs/guides/getting-started/quickstarts/nuxtjs - weekly - 0.5 - - - - https://supabase.com/docs/guides/getting-started/quickstarts/reactjs - weekly - 0.5 - - https://supabase.com/docs/guides/resources/supabase-cli/local-development weekly diff --git a/apps/docs/styles/main.scss b/apps/docs/styles/main.scss index db00f8c12e2..ea1f9b78324 100644 --- a/apps/docs/styles/main.scss +++ b/apps/docs/styles/main.scss @@ -253,3 +253,22 @@ div[role='tablist'] { max-width: 620px; } } + +/* +* sets the image in @Next/Image components +* to respect the height of the content +* +*/ +.next-image--dynamic-fill { + width: 100%; + grid-column: 1 / -1; +} +.next-image--dynamic-fill > span { + position: relative !important; +} +.next-image--dynamic-fill img { + object-fit: contain; + width: 100% !important; + position: relative !important; + height: unset !important; +} diff --git a/apps/www/_blog/2020-07-10-alpha-launch-postmortem.mdx b/apps/www/_blog/2020-07-10-alpha-launch-postmortem.mdx index 61bb85d236e..f0186212be6 100644 --- a/apps/www/_blog/2020-07-10-alpha-launch-postmortem.mdx +++ b/apps/www/_blog/2020-07-10-alpha-launch-postmortem.mdx @@ -37,13 +37,13 @@ GitHub stars rocketed for our two main repos, [supabase](https://github.com/supa Here are the things that survived well. -### Middleware: docker-compose up +### Middleware: docker compose up -This was the most surprising survivor. Our middleware was served from a single Ubuntu server with 4 CPUs and 8GB of RAM. This server was running our middleware using `docker-compose up`: +This was the most surprising survivor. Our middleware was served from a single Ubuntu server with 4 CPUs and 8GB of RAM. This server was running our middleware using `docker compose up`: -![This image shows in middleware architecture. We used docker-compose to pull up 5 open source tools: Kong, Realtime, PostgREST, PG-API, and PG-BOSS.](/images/blog/supabase-middleware-docker.png) +![This image shows in middleware architecture. We used docker compose to pull up 5 open source tools: Kong, Realtime, PostgREST, PG-API, and PG-BOSS.](/images/blog/supabase-middleware-docker.png) -In case you're wondering why any sane company would use that in production, it's because we weren't planning to launch - the HackerNews post was created by an early GitHub follower, while we were alpha testing, and it was too scary to migrate the middleware while it was servicing the thundering herd. All Supabase projects use the same middleware stack (sans docker-compose), so I guess this counts as as a successful load test. +In case you're wondering why any sane company would use that in production, it's because we weren't planning to launch - the HackerNews post was created by an early GitHub follower, while we were alpha testing, and it was too scary to migrate the middleware while it was servicing the thundering herd. All Supabase projects use the same middleware stack (without docker compose), so I guess this counts as a successful load test. We have since migrated our middleware to multiple ECS clusters, globally load-balanced using AWS's [Global Accelerator](https://aws.amazon.com/global-accelerator/). diff --git a/apps/www/_blog/2021-03-31-supabase-cli.mdx b/apps/www/_blog/2021-03-31-supabase-cli.mdx index b24682700de..ea8d4c94ed8 100644 --- a/apps/www/_blog/2021-03-31-supabase-cli.mdx +++ b/apps/www/_blog/2021-03-31-supabase-cli.mdx @@ -217,7 +217,7 @@ Also check `kong.yml` inside the `kong` directory where you'll see how all the s Once you're all set, you can start the stack by running: ```bash -docker-compose up +docker compose up ``` Head over to the [Self Hosting Docs](/docs/guides/self-hosting) for a more complete walk through, it also includes several [one-click deploys](/docs/guides/self-hosting#one-click-deploys), so you can easily deploy into your own cloud hosting provider. diff --git a/apps/www/_blog/2021-05-03-supabase-beta-april-2021.mdx b/apps/www/_blog/2021-05-03-supabase-beta-april-2021.mdx index 7575e01d9b6..e7d3215ca92 100644 --- a/apps/www/_blog/2021-05-03-supabase-beta-april-2021.mdx +++ b/apps/www/_blog/2021-05-03-supabase-beta-april-2021.mdx @@ -49,7 +49,7 @@ So today we're shipping Light Mode. Access it in the settings of your [Dashboard With the help of the community, we [started internationalizing](https://github.com/supabase/supabase/issues/1341) our main repository: - [Arabic | العربية](https://github.com/supabase/supabase/blob/master/i18n/README.ar.md) -- [Chinese / 中文](https://github.com/supabase/supabase/blob/master/i18n/README.cn.md) +- [Chinese / 中文](https://github.com/supabase/supabase/blob/master/i18n/README.zh-cn.md) - [Dutch / Nederlands](https://github.com/supabase/supabase/blob/master/i18n/README.nl.md) - [English](https://github.com/supabase/supabase) - [French / Français](https://github.com/supabase/supabase/blob/master/i18n/README.fr.md) diff --git a/apps/www/_blog/2021-11-29-community-day-lw3.mdx b/apps/www/_blog/2021-11-29-community-day-lw3.mdx index 4ac1ea6ea05..801bfc24217 100644 --- a/apps/www/_blog/2021-11-29-community-day-lw3.mdx +++ b/apps/www/_blog/2021-11-29-community-day-lw3.mdx @@ -22,7 +22,7 @@ So let's get cracking, we've got a lot to cover. 🚀 ## Open Source Spotlight: Kong API Gateway -Supabase provides a whole bunch of features that are made up of a [collection of open-source tools](/docs/architecture). To orchestrate these different services and functionalities we use the [Kong API Gateway](https://github.com/Kong/kong). +Supabase provides a whole bunch of features that are made up of a [collection of open-source tools](/docs/guides/getting-started/architecture). To orchestrate these different services and functionalities we use the [Kong API Gateway](https://github.com/Kong/kong). As a user of our hosted offering you don't really need to know all this, but we love showcasing the amazing open-source tools that we work with, and so we've invited [Vik Gamov](https://twitter.com/gAmUssA) to give you a little intro to [Kong](https://github.com/Kong/kong): diff --git a/apps/www/_blog/2022-04-01-supabase-realtime-with-multiplayer-features.mdx b/apps/www/_blog/2022-04-01-supabase-realtime-with-multiplayer-features.mdx index e86f6423582..63600d109ee 100644 --- a/apps/www/_blog/2022-04-01-supabase-realtime-with-multiplayer-features.mdx +++ b/apps/www/_blog/2022-04-01-supabase-realtime-with-multiplayer-features.mdx @@ -76,4 +76,4 @@ Tech stack: Sign up for the waitlist at [multiplayer.dev](https://multiplayer.dev). -You can follow development in our [open source repository on GitHub](https://github.com/supabase/realtime/tree/multiplayer). +You can follow development in our [open source repository on GitHub](https://github.com/supabase/realtime/tree/develop). diff --git a/apps/www/_blog/2022-04-20-partner-gallery-works-with-supabase.mdx b/apps/www/_blog/2022-04-20-partner-gallery-works-with-supabase.mdx index eaea01bbd94..aaf5e4d21b0 100644 --- a/apps/www/_blog/2022-04-20-partner-gallery-works-with-supabase.mdx +++ b/apps/www/_blog/2022-04-20-partner-gallery-works-with-supabase.mdx @@ -19,7 +19,7 @@ To keep track of all the great tools and people that “Work With Supabase”, w ![partner-gallery-screenshot.png](/images/blog/partner-gallery/partner-gallery-screenshot.png) -As with anything at Supabase, the Partner Gallery is built on top of the [Supabase stack](/docs/architecture) and is, of course, open-source. If you’re looking to build a partner gallery yourself, feel free to use our template as a start: [github.com/supabase-community/partner-gallery-example](https://github.com/supabase-community/partner-gallery-example). It’s packed with goodies like [Postgres Full Text Search](/docs/guides/database/full-text-search), `next-image` with Supabase Storage, and sending emails based on an insert trigger with Supabase Edge Functions. +As with anything at Supabase, the Partner Gallery is built on top of the [Supabase stack](/docs/guides/getting-started/architecture) and is, of course, open-source. If you’re looking to build a partner gallery yourself, feel free to use our template as a start: [github.com/supabase-community/partner-gallery-example](https://github.com/supabase-community/partner-gallery-example). It’s packed with goodies like [Postgres Full Text Search](/docs/guides/database/full-text-search), `next-image` with Supabase Storage, and sending emails based on an insert trigger with Supabase Edge Functions. # Partner showcase - new integrations and expert services diff --git a/apps/www/_blog/2022-08-03-supabase-beta-update-july-2022.mdx b/apps/www/_blog/2022-08-03-supabase-beta-update-july-2022.mdx index 2330e5f8703..5f7812d4c91 100644 --- a/apps/www/_blog/2022-08-03-supabase-beta-update-july-2022.mdx +++ b/apps/www/_blog/2022-08-03-supabase-beta-update-july-2022.mdx @@ -48,7 +48,7 @@ The new hCpatcha integration allows you to implement captcha functionality for a ![supabase-updated-settings-ui-dashboard](/images/blog/2022-july/auth-config.jpeg) -We've started updating our settings UI, starting with the Auth settings. You'll now see updated UI for setting up your Auth providers, Email templates and SMTP config. [Auth settings](https://app.supabase.com/project/_/auth/settings) +We've started updating our settings UI, starting with the Auth settings. You'll now see updated UI for setting up your [Auth providers](https://app.supabase.com/project/_/auth/providers), [Email templates](https://app.supabase.com/project/_/auth/templates), and [SMTP config](https://app.supabase.com/project/_/auth/url-configuration). ## Quick product announcements diff --git a/apps/www/_blog/2022-08-09-slack-consolidate-slackbot-to-consolidate-messages.mdx b/apps/www/_blog/2022-08-09-slack-consolidate-slackbot-to-consolidate-messages.mdx index 2172b0330a7..7581b57e33a 100644 --- a/apps/www/_blog/2022-08-09-slack-consolidate-slackbot-to-consolidate-messages.mdx +++ b/apps/www/_blog/2022-08-09-slack-consolidate-slackbot-to-consolidate-messages.mdx @@ -13,7 +13,7 @@ date: '2022-08-09' toc_depth: 3 --- -Supabase is a platform-as-a-service built on top of PostgreSQL and [many other amazing open-source tools](https://supabase.com/docs/architecture). It’s a fantastic option to create data-intensive apps and tooling. Taking advantage of the community-made [Python SDK](https://github.com/supabase-community/supabase-py) and [Slack's Python SDK](https://slack.dev/python-slack-sdk/), you can automate tasks and build apps for several use cases. +Supabase is a platform-as-a-service built on top of PostgreSQL and [many other amazing open-source tools](https://supabase.com/docs/guides/getting-started/architecture). It’s a fantastic option to create data-intensive apps and tooling. Taking advantage of the community-made [Python SDK](https://github.com/supabase-community/supabase-py) and [Slack's Python SDK](https://slack.dev/python-slack-sdk/), you can automate tasks and build apps for several use cases. ## Prerequisites @@ -161,9 +161,9 @@ Slack links have the following format: https://ORGANIZATION.slack.com/archives/ channel_id/pmessage_id -
      +
      Organization: subdomain used in Slack -
      +
      Channel ID: It is the string that you'll need to enter in slack channels as the channel id e.g C0000ABC02DE @@ -418,7 +418,3 @@ If you have any questions please reach out via [Twitter](https://twitter.com/sup - [Python data loading with Supabase](https://supabase.com/blog/loading-data-supabase-python) - [Visualizing Supabase Data using Metabase](https://supabase.com/blog/visualizing-supabase-data-using-metabase) - [Supabase-py (Database) on Replit](https://replit.com/@Supabase/Supabase-py-Database?v=1) - - - - diff --git a/apps/www/_blog/2022-12-09-launch-week-6-hackathon.mdx b/apps/www/_blog/2022-12-09-launch-week-6-hackathon.mdx index 212e9cce132..5401d567ae6 100644 --- a/apps/www/_blog/2022-12-09-launch-week-6-hackathon.mdx +++ b/apps/www/_blog/2022-12-09-launch-week-6-hackathon.mdx @@ -113,3 +113,16 @@ Don't forget to checkout the new feature's being announced as part of [Launch We - Any intellectual property developed during the hackathon will belong to the team that developed it. We expect that each team will have an agreement between themselves regarding the IP, but this is not required - By making a submission you grant Supabase permission to use screenshots, code-snippets and/or links to your project or content of your README on our Twitter, blog, website, email updates, and in the Supabase discord server. Supabase does not make any claims over your IP. - $1500 prize will be paid by making a GitHub sponsorship to the winning repo, $500/month for 3 months. The goal here is to create a sustainable project that will be continue to be maintained for the duration of the sponsorship period (and hopefully beyond :) ) + +## More Launch Week 6 + +- [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) +- [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) +- [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) + diff --git a/apps/www/_blog/2022-12-10-postgres-crdt.mdx b/apps/www/_blog/2022-12-10-postgres-crdt.mdx index 066544d0003..143a356fee7 100644 --- a/apps/www/_blog/2022-12-10-postgres-crdt.mdx +++ b/apps/www/_blog/2022-12-10-postgres-crdt.mdx @@ -145,3 +145,15 @@ We're likely to discover more (no doubt from a few friendly HN comments). ## Next steps If you want to help with `pg_crdt` the best way is to get involved in the GitHub repo. We have enabled [Discussions](https://github.com/supabase/pg_crdt/discussions) for any and all ideas. If you have experience with CRDTs and you like this approach, don't hesitate to contact one of the team. + +## More Launch Week 6 + +- [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) +- [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) +- [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-12-new-supabase-docs-built-with-nextjs.mdx b/apps/www/_blog/2022-12-12-new-supabase-docs-built-with-nextjs.mdx index 41f8ef5ac1e..9f725b9ab84 100644 --- a/apps/www/_blog/2022-12-12-new-supabase-docs-built-with-nextjs.mdx +++ b/apps/www/_blog/2022-12-12-new-supabase-docs-built-with-nextjs.mdx @@ -94,6 +94,12 @@ Docs are more than just the tech behind them. The goal of docs is to give you, t ## More Launch Week 6 -- [Launch Week 6 Hackathon](https://supabase.com/blog/launch-week-6-hackathon) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) -- [pg_crdt - an experimental CRDT extension for Postgres](https://supabase.com/blog/postgres-crdt) +- [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) +- [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) + diff --git a/apps/www/_blog/2022-12-13-storage-image-resizing-smart-cdn.mdx b/apps/www/_blog/2022-12-13-storage-image-resizing-smart-cdn.mdx index 00f68ff0f90..deb677996d5 100644 --- a/apps/www/_blog/2022-12-13-storage-image-resizing-smart-cdn.mdx +++ b/apps/www/_blog/2022-12-13-storage-image-resizing-smart-cdn.mdx @@ -205,3 +205,14 @@ A few features to look out for in the future: - Check out the Docs for [Image Resizing](https://supabase.com/docs/guides/storage/image-transformations). - Check out the Docs for the [Storage CDN](https://supabase.com/docs/guides/storage/cdn). - Get Started today with the [JavaScript](https://supabase.com/docs/reference/javascript/storage-from-download) and [Dart](https://supabase.com/docs/reference/dart/storage-from-list) client libraries. + +## More Launch Week 6 + +- [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) +- [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx b/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx index b2b4cbedff0..bfb8e02b25d 100644 --- a/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx +++ b/apps/www/_blog/2022-12-14-mfa-auth-via-rls.mdx @@ -128,10 +128,14 @@ For starters, we are looking to support WebAuthn and FIDO2 compliant devices suc We are grateful to our early MFA users for the support and feedback provided throughout this period. In particular, we would like to thank [Fabian Beer](https://madebyfabian.com), [Cogram](https://www.cogram.com), and [Happl](https://happl.com) whose detailed feedback helped to shape our implementation. We would also like to specially thank the community behind the [pquerna/otp](https://github.com/pquerna/otp) and [ajstarks/svgo](https://github.com/ajstarks/svgo) libraries - their work is indispensable to this implementation. + ## More Launch Week 6 - [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) - [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) -- [Launch Week 6 Hackathon](https://supabase.com/blog/launch-week-6-hackathon) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) -- [pg_crdt - an experimental CRDT extension for Postgres](https://supabase.com/blog/postgres-crdt) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-15-postgres-foreign-data-wrappers-rust.mdx b/apps/www/_blog/2022-12-15-postgres-foreign-data-wrappers-rust.mdx index c746fd61ba4..62147a24dd0 100644 --- a/apps/www/_blog/2022-12-15-postgres-foreign-data-wrappers-rust.mdx +++ b/apps/www/_blog/2022-12-15-postgres-foreign-data-wrappers-rust.mdx @@ -259,6 +259,8 @@ If you're interested in getting involved or building your own Wrapper, don't hes - [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) - [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) - [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) -- [Launch Week 6 Hackathon](https://supabase.com/blog/launch-week-6-hackathon) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) -- [pg_crdt - an experimental CRDT extension for Postgres](https://supabase.com/blog/postgres-crdt) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-16-custom-domain-names.mdx b/apps/www/_blog/2022-12-16-custom-domain-names.mdx index 014255f71a8..79ca54ad805 100644 --- a/apps/www/_blog/2022-12-16-custom-domain-names.mdx +++ b/apps/www/_blog/2022-12-16-custom-domain-names.mdx @@ -62,6 +62,8 @@ We're working hard to fix these limitations, so stay tuned for future updates. - [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) - [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) - [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) -- [Launch Week 6 Hackathon](https://supabase.com/blog/launch-week-6-hackathon) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) -- [pg_crdt - an experimental CRDT extension for Postgres](https://supabase.com/blog/postgres-crdt) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-16-launch-week-6-community-day.mdx b/apps/www/_blog/2022-12-16-launch-week-6-community-day.mdx index 7e84894bfb6..81cbbfdf6d7 100644 --- a/apps/www/_blog/2022-12-16-launch-week-6-community-day.mdx +++ b/apps/www/_blog/2022-12-16-launch-week-6-community-day.mdx @@ -36,7 +36,7 @@ An integration between FlutterFlow and Supabase has been long awaited by the com This is just the beginning of our integration with FlutterFlow. We're working closely with the FlutterFlow team to deliver more features! -Watch John from the FlutterFlow team demonstrate how you can [get started with FlutterFlow and Supabase](https://youtu.be/TmViZsWEBY0). +Watch John from the FlutterFlow team demonstrate how you can [get started with FlutterFlow and Supabase](https://youtu.be/hw9Q-NjASbU). ### OneSignal @@ -237,4 +237,7 @@ We plan to continue our open and collaborative trend. There are many companies w - [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) - [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) - [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-16-launch-week-6-wrap-up.mdx b/apps/www/_blog/2022-12-16-launch-week-6-wrap-up.mdx index 1e25e3c1534..f8435ebed42 100644 --- a/apps/www/_blog/2022-12-16-launch-week-6-wrap-up.mdx +++ b/apps/www/_blog/2022-12-16-launch-week-6-wrap-up.mdx @@ -20,7 +20,7 @@ That's a wrap on Supabase Launch Week Day 6. Here's everything we shipped in one For a developer tool, documentation is more than a resource - it's part of the product. For the past two years at Supabase, this part of our product hasn't been great. Our new docs, built with Next.js, feature a completely new design, better navigation, and the promise of a fully-integrated experience. -- Read the [announcememt](/blog/new-supabase-docs-built-with-nextjs) +- Read the [announcement](/blog/new-supabase-docs-built-with-nextjs) - Watch the [recap on YouTube](https://www.youtube.com/watch?v=Q1Amk6iDlF8) - Check out [the new docs](https://supabase.com/docs) diff --git a/apps/www/_blog/2022-12-16-new-in-postgres-15.mdx b/apps/www/_blog/2022-12-16-new-in-postgres-15.mdx index d1b158b5a47..6eb78cee729 100644 --- a/apps/www/_blog/2022-12-16-new-in-postgres-15.mdx +++ b/apps/www/_blog/2022-12-16-new-in-postgres-15.mdx @@ -68,3 +68,15 @@ Before choosing to upgrade, don't forget to check the list of rare cases that ne - If you're self-hosting, upgrading between major PostgreSQL is easily done with [pg_upgrade](https://www.postgresql.org/docs/current/pgupgrade.html) utility or a set of recommended practices in the [official docs](https://www.postgresql.org/docs/current/upgrading.html). - If you're starting a new project on Supabase, you'll already be on PG15. - If you want to upgrade an existing project, check out our [Upgrading](https://supabase.com/docs/guides/platform/migrating-and-upgrading-projects#upgrade-your-project) documentation. + +## More Launch Week 6 + +- [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) +- [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) +- [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-16-pg-graphql-v1.mdx b/apps/www/_blog/2022-12-16-pg-graphql-v1.mdx index 30c6c59d777..d72dcdfd1d4 100644 --- a/apps/www/_blog/2022-12-16-pg-graphql-v1.mdx +++ b/apps/www/_blog/2022-12-16-pg-graphql-v1.mdx @@ -98,6 +98,9 @@ Longer term we look forward to experimenting with more ambitions features like a - [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) - [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) - [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) -- [Launch Week 6 Hackathon](https://supabase.com/blog/launch-week-6-hackathon) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) -- [pg_crdt - an experimental CRDT extension for Postgres](https://supabase.com/blog/postgres-crdt) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdx b/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdx index 243adfdb0e1..3e9007dbe0b 100644 --- a/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdx +++ b/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdx @@ -45,6 +45,8 @@ Enabling Point in Time Recovery could be done [in the Dashboard](https://app.sup - [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) - [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) - [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) -- [Launch Week 6 Hackathon](https://supabase.com/blog/launch-week-6-hackathon) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) -- [pg_crdt - an experimental CRDT extension for Postgres](https://supabase.com/blog/postgres-crdt) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-16-postgrest-11-prerelease.mdx b/apps/www/_blog/2022-12-16-postgrest-11-prerelease.mdx index bbef228a26d..138a576eefc 100644 --- a/apps/www/_blog/2022-12-16-postgrest-11-prerelease.mdx +++ b/apps/www/_blog/2022-12-16-postgrest-11-prerelease.mdx @@ -224,3 +224,15 @@ $ supabase start ``` Please try it and report any bugs, suggestions or ideas! + +## More Launch Week 6 + +- [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) +- [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) +- [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Day 5: Supabase Vault is now in Beta](https://supabase.com/blog/vault-now-in-beta) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/_blog/2022-12-16-vault-now-in-beta.mdx b/apps/www/_blog/2022-12-16-vault-now-in-beta.mdx index 3d1418be10d..141e75ed838 100644 --- a/apps/www/_blog/2022-12-16-vault-now-in-beta.mdx +++ b/apps/www/_blog/2022-12-16-vault-now-in-beta.mdx @@ -91,6 +91,8 @@ You'll see the Vault appear in the Dashboard over the next month. If you want to - [Day 1: New Supabase Docs, built with Next.js](https://supabase.com/blog/new-supabase-docs-built-with-nextjs) - [Day 2: Supabase Storage v2: Image resizing and Smart CDN](https://supabase.com/blog/storage-image-resizing-smart-cdn) - [Day 3: Multi-factor Authentication via Row Level Security Enforcement](https://supabase.com/blog/mfa-auth-via-rls) -- [Launch Week 6 Hackathon](https://supabase.com/blog/launch-week-6-hackathon) -- [Who We Hire at Supabase](https://supabase.com/blog/who-we-hire) -- [pg_crdt - an experimental CRDT extension for Postgres](https://supabase.com/blog/postgres-crdt) +- [Day 4: Supabase Wrappers, a Postgres FDW framework written in Rust](https://supabase.com/blog/postgres-foreign-data-wrappers-rust) +- [Community Day](https://supabase.com/blog/launch-week-6-community-day) +- [Point in Time Recovery is now available](https://supabase.com/blog/postgres-point-in-time-recovery) +- [Custom Domain Names are now available](https://supabase.com/blog/custom-domain-names) +- [Wrap Up: everything we shipped](https://supabase.com/blog/launch-week-6-wrap-up) diff --git a/apps/www/data/Developers.json b/apps/www/data/Developers.json index a29460f0c5b..df449e784ab 100644 --- a/apps/www/data/Developers.json +++ b/apps/www/data/Developers.json @@ -1,26 +1,20 @@ [ { "text": "Documentation", - "description": "Everything you need that makes it simple to get started.", + "description": "Everything you need to start building with Supabase.", "url": "/docs", "icon": "M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" }, { - "text": "API reference", - "description": "Examples and references for using API libraries.", - "url": "/docs/client/supabase-client", - "icon": "M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" - }, - { - "text": "Guides", - "description": "Examples and references for using Supabase.", - "url": "/docs/", + "text": "Changelog", + "description": "See the latest updates and product improvements.", + "url": "/changelog", "icon": "M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z" }, { "text": "Careers", "description": "Join the Supabase team and get involved.", - "url": "https://supabase.com/careers", + "url": "/careers", "icon": "M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" } ] diff --git a/apps/www/lib/redirects.js b/apps/www/lib/redirects.js index fd7ee2335d9..56951babe70 100644 --- a/apps/www/lib/redirects.js +++ b/apps/www/lib/redirects.js @@ -535,16 +535,20 @@ module.exports = [ source: '/docs/reference/postgres/publications', destination: '/docs/guides/database/replication', }, - { permanent: true, source: '/docs/guides/hosting/platform', destination: '/docs/guides/platform', }, { - permanent: false, - source: '/docs/guides/self-hosting', - destination: '/docs/guides/hosting/overview', + permanent: true, + source: '/docs/guides/hosting/platform/access-control', + destination: '/docs/guides/platform/access-control', + }, + { + permanent: true, + source: '/docs/guides/self-hosting/overview', + destination: '/docs/guides/self-hosting', }, { permanent: true, @@ -1707,6 +1711,11 @@ module.exports = [ source: '/docs/guides/auth/auth-workos', destination: '/docs/guides/auth/social-login/auth-workos', }, + { + permanent: true, + source: '/docs/guides/auth/auth-zoom', + destination: '/docs/guides/auth/social-login/auth-zoom', + }, { permanent: true, source: '/docs/guides/database', @@ -1787,25 +1796,25 @@ module.exports = [ source: '/docs/guides/with-ionic-angular', destination: '/docs/guides/getting-started/tutorials/with-ionic-angular', }, - { - permanent: true, - source: '/docs/guides/examples', - destination: '/docs/guides/resources/examples', - }, - { - permanent: true, - source: '/docs/guides/examples', - destination: '/docs/guides/resources/examples', - }, { permanent: true, source: '/docs/guides/hosting/overview', - destination: '/docs/guides/resources/self-hosting', + destination: '/docs/guides/self-hosting', }, { permanent: true, source: '/docs/guides/hosting/docker', - destination: '/docs/guides/resources/self-hosting/docker', + destination: '/docs/guides/self-hosting/docker', + }, + { + permanent: true, + source: '/docs/guides/resources/self-hosting', + destination: '/docs/guides/self-hosting', + }, + { + permanent: true, + source: '/docs/guides/resources/self-hosting/docker', + destination: '/docs/guides/self-hosting/docker', }, { permanent: true, diff --git a/apps/www/pages/launch-week/index.tsx b/apps/www/pages/launch-week/index.tsx index 225de69fcb0..10cddcf4113 100644 --- a/apps/www/pages/launch-week/index.tsx +++ b/apps/www/pages/launch-week/index.tsx @@ -38,7 +38,7 @@ export default function launchweek() { const { isDarkMode } = useTheme() const title = 'Launch Week 6' const description = 'Supabase Launch Week 6 | 12-18 Dec 2022' - const liveDay = 'Friday' + const liveDay = null const [supabase] = useState(() => createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!) @@ -102,7 +102,7 @@ export default function launchweek() { @@ -219,11 +219,6 @@ export default function launchweek() { )} >
      - -
      - Jump to current day -
      -
      {process.env.NEXT_PUBLIC_LW_STARTED && ( <> @@ -335,7 +330,7 @@ export default function launchweek() { >
      {day1.description} - + Redesigned
      @@ -380,7 +375,7 @@ export default function launchweek() { >
      {day2.steps[0].title}
      - + New
      @@ -459,7 +454,7 @@ export default function launchweek() {
      {day3.steps[0].title} - + Updated
      @@ -521,7 +516,7 @@ export default function launchweek() {
      {day4.steps[0].title} - + New
      @@ -590,7 +585,7 @@ export default function launchweek() { {day5.steps[0].title} - + New
      @@ -783,7 +778,7 @@ export default function launchweek() { />
      - + Updated @@ -828,7 +823,7 @@ export default function launchweek() { />
      - + New @@ -873,7 +868,7 @@ export default function launchweek() { />
      - + New @@ -918,7 +913,7 @@ export default function launchweek() { />
      - + Experimental @@ -963,7 +958,7 @@ export default function launchweek() { />
      - + Upgrade @@ -1008,7 +1003,7 @@ export default function launchweek() { />
      - + Upgrade @@ -1034,8 +1029,10 @@ export default function launchweek() {
      - - Happening all week + + Submissions Closed

      Launch Week Hackathon

      @@ -1217,8 +1214,14 @@ export default function launchweek() { })}

      - - Currently Happening + + Shipped

      The Supabase Content Storm

      diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 70da7c553bd..2eca99b5ab3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,8 +1,8 @@ # Usage -# Start: docker-compose up -# With helpers: docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up -# Stop: docker-compose down -# Destroy: docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down -v --remove-orphans +# Start: docker compose up +# With helpers: docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up +# Stop: docker compose down +# Destroy: docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down -v --remove-orphans version: "3.8" @@ -197,9 +197,15 @@ services: - log_min_messages=fatal # prevents Realtime polling queries from appearing in logs restart: unless-stopped ports: - - ${POSTGRES_PORT}:5432 + # Pass down internal port because it's set dynamically by other services + - ${POSTGRES_PORT}:${POSTGRES_PORT} environment: POSTGRES_HOST: /var/run/postgresql + PGPORT: ${POSTGRES_PORT} + POSTGRES_PORT: ${POSTGRES_PORT} + PGPASSWORD: ${POSTGRES_PASSWORD} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + PGDATABASE: ${POSTGRES_DB} + POSTGRES_DB: ${POSTGRES_DB} volumes: - ./volumes/db/roles.sql:/docker-entrypoint-initdb.d/roles.sql diff --git a/docker/volumes/db/roles.sql b/docker/volumes/db/roles.sql index b369bf5af99..a592043ee5b 100644 --- a/docker/volumes/db/roles.sql +++ b/docker/volumes/db/roles.sql @@ -1,5 +1,5 @@ -- NOTE: change to your own passwords for production environments -\set pgpass `echo "$PGPASSWORD"` +\set pgpass `echo "$POSTGRES_PASSWORD"` ALTER USER authenticator WITH PASSWORD :'pgpass'; ALTER USER pgbouncer WITH PASSWORD :'pgpass'; diff --git a/examples/caching/with-cloudflare-workers-kv/package-lock.json b/examples/caching/with-cloudflare-workers-kv/package-lock.json index f4c473270b7..a38f4405af4 100644 --- a/examples/caching/with-cloudflare-workers-kv/package-lock.json +++ b/examples/caching/with-cloudflare-workers-kv/package-lock.json @@ -54,217 +54,258 @@ "dev": true }, "node_modules/@miniflare/cache": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.5.1.tgz", - "integrity": "sha512-qH5PC4zb7mHdQHlcaOuP0KUXuRbNSuB/HU7gpoeplV8J6CgNJGceVmQCZVZLycgDKZtAlhyGE1gkpJmeW7GCyw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.11.0.tgz", + "integrity": "sha512-L/kc9AzidPwFuk2fwHpAEePi0kNBk6FWUq3ln+9beRCDrPEpfVrDRFpNleF1NFZz5//oeVMuo8F0IVUQGzR7+Q==", "dev": true, "dependencies": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", "http-cache-semantics": "^4.1.0", - "undici": "5.5.1" + "undici": "5.9.1" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/cli-parser": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/cli-parser/-/cli-parser-2.5.1.tgz", - "integrity": "sha512-itlMDe9jwO806mkNkg3G70QYoG9YQHW6V10AF9L5b8J4LYt/V78uCEJSwNnCpL7zfKrScRPtDfXZxhrFzMXiUw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/cli-parser/-/cli-parser-2.11.0.tgz", + "integrity": "sha512-JUmyRzEGAS6CouvXJwBh8p44onfw3KRpfq5JGXEuHModOGjTp6li7PQyCTNPV2Hv/7StAXWnTFGXeAqyDHuTig==", "dev": true, "dependencies": { - "@miniflare/shared": "2.5.1", + "@miniflare/shared": "2.11.0", "kleur": "^4.1.4" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/core": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.5.1.tgz", - "integrity": "sha512-0oEBLV5AM3xxs6TS+7/fn4MSGNBfhUFVv41R8uc72H1a89+kBfRoz+xYI2RnJ3Yo+we66UgU3fXdG+R2KyESlQ==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.11.0.tgz", + "integrity": "sha512-UFMFiCG0co36VpZkgFrSBnrxo71uf1x+cjlzzJi3khmMyDlnLu4RuIQsAqvKbYom6fi3G9Q8lTgM7JuOXFyjhw==", "dev": true, "dependencies": { "@iarna/toml": "^2.2.5", - "@miniflare/shared": "2.5.1", - "@miniflare/watcher": "2.5.1", + "@miniflare/queues": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/watcher": "2.11.0", "busboy": "^1.6.0", "dotenv": "^10.0.0", "kleur": "^4.1.4", "set-cookie-parser": "^2.4.8", - "undici": "5.5.1", + "undici": "5.9.1", "urlpattern-polyfill": "^4.0.3" }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/d1": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/d1/-/d1-2.11.0.tgz", + "integrity": "sha512-aDdBVQZ2C0Zs3+Y9ZbRctmuQxozPfpumwJ/6NG6fBadANvune/hW7ddEoxyteIEU9W3IgzVj8s4by4VvasX90A==", + "dev": true, + "dependencies": { + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0" + }, "engines": { "node": ">=16.7" } }, "node_modules/@miniflare/durable-objects": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/durable-objects/-/durable-objects-2.5.1.tgz", - "integrity": "sha512-AZEGSA9LMA6vBzwADAzr81RBSWYlMfa/cDHnHaFL31w4mQwMUcqXOvemoqe6sTSq1KI0TTtvYbxPt0Lui8tEPw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/durable-objects/-/durable-objects-2.11.0.tgz", + "integrity": "sha512-0cKJaMgraTEU1b4kqK8cjD2oTeOjA6QU3Y+lWiZT/k1PMHZULovrSFnjii7qZ8npf4VHSIN6XYPxhyxRyEM65Q==", "dev": true, "dependencies": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/storage-memory": "2.5.1", - "undici": "5.5.1" + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/storage-memory": "2.11.0", + "undici": "5.9.1" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/html-rewriter": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/html-rewriter/-/html-rewriter-2.5.1.tgz", - "integrity": "sha512-fdO1qme8ukucejRz5yXJN/F4B9qEDRbBLPOEG94zwx8bHGGIo5VX15+J6oHubhjifLwzNuvOcg16Bu5dyR1KxQ==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/html-rewriter/-/html-rewriter-2.11.0.tgz", + "integrity": "sha512-olTqmuYTHnoTNtiA0vjQ/ixRfbwgPzDrAUbtXDCYW45VFbHfDVJrJGZX3Jg0HpSlxy86Zclle1SUxGbVDzxsBg==", "dev": true, "dependencies": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", "html-rewriter-wasm": "^0.4.1", - "undici": "5.5.1" + "undici": "5.9.1" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/http-server": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/http-server/-/http-server-2.5.1.tgz", - "integrity": "sha512-K+VoBU0LN8/oku/JWLEyX8wrp9fiaTC8/dosbY/6VWizyIrgQze16uD21GnK5+NBtbCAtLRryS5dZ3PnhiTR1w==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/http-server/-/http-server-2.11.0.tgz", + "integrity": "sha512-sMLcrDFzqqAvnQmAUH0hRTo8sBjW79VZYfnIH5FAGSGcKX6kdAGs9RStdYZ4CftQCBAEQScX0KBsMx5FwJRe9Q==", "dev": true, "dependencies": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/web-sockets": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/web-sockets": "2.11.0", "kleur": "^4.1.4", "selfsigned": "^2.0.0", - "undici": "5.5.1", + "undici": "5.9.1", "ws": "^8.2.2", "youch": "^2.2.2" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/kv": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/kv/-/kv-2.5.1.tgz", - "integrity": "sha512-ODTUqI7on3egHluBpFHifO0a9QFQUZscciASWKxGOt8VDp1vp0vIfU9ykQZrdZYFVeSKNVlUNqNQx+NMYZ6gIg==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/kv/-/kv-2.11.0.tgz", + "integrity": "sha512-3m9dL2HBBN170V1JvwjjucR5zl4G3mlcsV6C1E7A2wLl2Z2TWvIx/tSY9hrhkD96dFnejwJ9qmPMbXMMuynhjg==", "dev": true, "dependencies": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/@miniflare/queues": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.11.0.tgz", + "integrity": "sha512-fLHjdrNLKhn0LZM/aii/9GsAttFd+lWlGzK8HOg1R0vhfKBwEub4zntjMmOfFbDm1ntc21tdMK7n3ldUphwh5w==", + "dev": true, + "dependencies": { + "@miniflare/shared": "2.11.0" }, "engines": { "node": ">=16.7" } }, + "node_modules/@miniflare/r2": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/r2/-/r2-2.11.0.tgz", + "integrity": "sha512-MKuyJ/gGNsK3eWbGdygvozqcyaZhM3C6NGHvoaZwH503dwN569j5DpatTWiHGFeDeSu64VqcIsGehz05GDUaag==", + "dev": true, + "dependencies": { + "@miniflare/shared": "2.11.0", + "undici": "5.9.1" + }, + "engines": { + "node": ">=16.13" + } + }, "node_modules/@miniflare/runner-vm": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.5.1.tgz", - "integrity": "sha512-7U7BPgzaikwWkAMonlmyy4lDpW1H7mqHFr7NdK9kA6BbXZ2GY6uro69QsGw0c4Y/vyKBodKiqXAq53iGdM3Kug==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.11.0.tgz", + "integrity": "sha512-bkVSuvCf5+VylqN8lTiLxIYqYcKFbl+BywZGwGQndPC/3wh42J00mM0jw4hRbvXgwuBhlUyCVpEXtYlftFFT/g==", "dev": true, "dependencies": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/scheduler": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/scheduler/-/scheduler-2.5.1.tgz", - "integrity": "sha512-ybho5Kg3Cfl4E0JleKAbiv/RTA+/PVqH6Y/PuCH2oowSM7qeAvFkrwiRvxtN7BuAl+5lsGyVxFe4gL+weXohEw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/scheduler/-/scheduler-2.11.0.tgz", + "integrity": "sha512-DPdzINhdWeS99eIicGoluMsD4pLTTAWNQbgCv3CTwgdKA3dxdvMSCkNqZzQLiALzvk9+rSfj46FlH++HE7o7/w==", "dev": true, "dependencies": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", "cron-schedule": "^3.0.4" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/shared": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.5.1.tgz", - "integrity": "sha512-DObgqbFml3qetIBtZa8fNqkBqUH9XtI6rdrWtTYVrx0rzKsd5PDf6gdMoxy7v1rr9zBAipKJxrcBqlEgjPl53Q==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.11.0.tgz", + "integrity": "sha512-fWMqq3ZkWAg+k7CnyzMV/rZHugwn+/JxvVzCxrtvxzwotTN547THlOxgZe8JAP23U9BiTxOfpTfnLvFEjAmegw==", "dev": true, "dependencies": { - "ignore": "^5.1.8", - "kleur": "^4.1.4" + "@types/better-sqlite3": "^7.6.0", + "kleur": "^4.1.4", + "npx-import": "^1.1.3", + "picomatch": "^2.3.1" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/sites": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/sites/-/sites-2.5.1.tgz", - "integrity": "sha512-7V/fAzR50LYgMcOfoCaoppqBCjagBpGWFbZgMyJi/Hj4oVlSIzxo+424hzdjitNzikCpv+AryF9tXfy9j6qiOg==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/sites/-/sites-2.11.0.tgz", + "integrity": "sha512-qbefKdWZUJgsdLf+kCw03sn3h/92LZgJAbkOpP6bCrfWkXlJ37EQXO4KWdhn4Ghc7A6GwU1s1I/mdB64B3AewQ==", "dev": true, "dependencies": { - "@miniflare/kv": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/storage-file": "2.5.1" + "@miniflare/kv": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/storage-file": "2.11.0" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/storage-file": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/storage-file/-/storage-file-2.5.1.tgz", - "integrity": "sha512-o12KFXgc1M0nHD98mrA/IqwBsJ6KYLWH9NaTwqLhxhpGz/KSo5kWb7z/vrz2I/Rk2XR/gHSYQm2XR9XE6IJCdA==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/storage-file/-/storage-file-2.11.0.tgz", + "integrity": "sha512-beWF/lTX74x7AiaSB+xQxywPSNdhtEKvqDkRui8eOJ5kqN2o4UaleLKQGgqmCw3WyHRIsckV7If1qpbNiLtWMw==", "dev": true, "dependencies": { - "@miniflare/shared": "2.5.1", - "@miniflare/storage-memory": "2.5.1" + "@miniflare/shared": "2.11.0", + "@miniflare/storage-memory": "2.11.0" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/storage-memory": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.5.1.tgz", - "integrity": "sha512-LIdBEFcwY7yLCeowO34p5bajRsvU1XuQjXIqcgfiCVt1+qa3D0seELTpW1NSFEJzxulVtu/KsScEug9GipEt7A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.11.0.tgz", + "integrity": "sha512-s0AhPww7fq/Jz80NbPb+ffhcVRKnfPi7H1dHTRTre2Ud23EVJjAWl2gat42x8NOT/Fu3/o/7A72DWQQJqfO98A==", "dev": true, "dependencies": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/watcher": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.5.1.tgz", - "integrity": "sha512-8oOdgWA7CZ7uIAwbjqSrhDnuQXRJqd9e3yDHsMa91E/jkC/GDmlt5SJh6VEMlNDtBGWd661IpVErZf7injI52w==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.11.0.tgz", + "integrity": "sha512-RUfjz2iYcsQXLcGySemJl98CJ2iierbWsPGWZhIVZI+NNhROkEy77g/Q+lvP2ATwexG3/dUSfdJ3P8aH+sI4Ig==", "dev": true, "dependencies": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@miniflare/web-sockets": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.5.1.tgz", - "integrity": "sha512-GyXHoDAI5LDF87rmD+d0cSoN7Xs2pCYjSyUR6Vf6exkS4CN6F/Rtr8vIM5+om9kRkS6qxAyOYjWeEqBOjLm/og==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.11.0.tgz", + "integrity": "sha512-NC8RKrmxrO0hZmwpzn5g4hPGA2VblnFTIBobmWoxuK95eW49zfs7dtE/PyFs+blsGv3CjTIjHVSQ782K+C6HFA==", "dev": true, "dependencies": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", - "undici": "5.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", + "undici": "5.9.1", "ws": "^8.2.2" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" } }, "node_modules/@supabase/functions-js": { @@ -320,6 +361,21 @@ "@supabase/storage-js": "^1.7.2" } }, + "node_modules/@types/better-sqlite3": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.3.tgz", + "integrity": "sha512-YS64N9SNDT/NAvou3QNdzAu3E2om/W/0dhORimtPGLef+zSK5l1vDzfsWb4xgXOgfhtOI5ZDTRxnvRPb22AIVQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "18.11.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz", + "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==", + "dev": true + }, "node_modules/@types/phoenix": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.5.4.tgz", @@ -355,6 +411,15 @@ "node": ">=6.14.2" } }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", @@ -390,6 +455,20 @@ "node-fetch": "2.6.7" } }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -822,6 +901,29 @@ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "dev": true }, + "node_modules/execa": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", + "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^3.0.1", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, "node_modules/ext": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.6.0.tgz", @@ -849,6 +951,18 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/html-rewriter-wasm": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/html-rewriter-wasm/-/html-rewriter-wasm-0.4.1.tgz", @@ -861,13 +975,25 @@ "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", "dev": true }, - "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "node_modules/human-signals": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", + "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==", "dev": true, "engines": { - "node": ">= 4" + "node": ">=12.20.0" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-typedarray": { @@ -875,6 +1001,12 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/itty-router": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/itty-router/-/itty-router-2.6.1.tgz", @@ -894,6 +1026,18 @@ "node": ">=6" } }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/magic-string": { "version": "0.25.9", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", @@ -903,6 +1047,12 @@ "sourcemap-codec": "^1.4.8" } }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "node_modules/mime": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", @@ -915,39 +1065,54 @@ "node": ">=10.0.0" } }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/miniflare": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-2.5.1.tgz", - "integrity": "sha512-PT56C/j7U6n7WDxnIUHu0d8EY/gedPRsta2b+LsrIHGZPSkxAcPzf2DgbbPU7obv0C4hT9H0GL1fWpWtr2SbDQ==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-2.11.0.tgz", + "integrity": "sha512-QA18I1VQXdCo4nBtPJUcUDxW8c9xbc5ex5F61jwhkGVOISSnYdEheolESmjr8MYk28xwi0XD1ozS4rLaTONd+w==", "dev": true, "dependencies": { - "@miniflare/cache": "2.5.1", - "@miniflare/cli-parser": "2.5.1", - "@miniflare/core": "2.5.1", - "@miniflare/durable-objects": "2.5.1", - "@miniflare/html-rewriter": "2.5.1", - "@miniflare/http-server": "2.5.1", - "@miniflare/kv": "2.5.1", - "@miniflare/runner-vm": "2.5.1", - "@miniflare/scheduler": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/sites": "2.5.1", - "@miniflare/storage-file": "2.5.1", - "@miniflare/storage-memory": "2.5.1", - "@miniflare/web-sockets": "2.5.1", + "@miniflare/cache": "2.11.0", + "@miniflare/cli-parser": "2.11.0", + "@miniflare/core": "2.11.0", + "@miniflare/d1": "2.11.0", + "@miniflare/durable-objects": "2.11.0", + "@miniflare/html-rewriter": "2.11.0", + "@miniflare/http-server": "2.11.0", + "@miniflare/kv": "2.11.0", + "@miniflare/queues": "2.11.0", + "@miniflare/r2": "2.11.0", + "@miniflare/runner-vm": "2.11.0", + "@miniflare/scheduler": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/sites": "2.11.0", + "@miniflare/storage-file": "2.11.0", + "@miniflare/storage-memory": "2.11.0", + "@miniflare/web-sockets": "2.11.0", "kleur": "^4.1.4", "semiver": "^1.1.0", "source-map-support": "^0.5.20", - "undici": "5.5.1" + "undici": "5.9.1" }, "bin": { "miniflare": "bootstrap.js" }, "engines": { - "node": ">=16.7" + "node": ">=16.13" }, "peerDependencies": { - "@miniflare/storage-redis": "2.5.1", + "@miniflare/storage-redis": "2.11.0", "cron-schedule": "^3.0.4", "ioredis": "^4.27.9" }, @@ -1032,12 +1197,93 @@ "node-gyp-build-test": "build-test.js" } }, + "node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npx-import": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/npx-import/-/npx-import-1.1.4.tgz", + "integrity": "sha512-3ShymTWOgqGyNlh5lMJAejLuIv3W1K3fbI5Ewc6YErZU3Sp0PqsNs8UIU1O8z5+KVl/Du5ag56Gza9vdorGEoA==", + "dev": true, + "dependencies": { + "execa": "^6.1.0", + "parse-package-name": "^1.0.0", + "semver": "^7.3.7", + "validate-npm-package-name": "^4.0.0" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-package-name": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-package-name/-/parse-package-name-1.0.0.tgz", + "integrity": "sha512-kBeTUtcj+SkyfaW4+KBe0HtsloBJ/mKTPoxpVdA57GZiPerREsUWJOhVj9anXweFiJkm5y8FG1sxFZkZ0SN6wg==", + "dev": true + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-to-regexp": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", "dev": true }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/rollup-plugin-inject": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz", @@ -1089,10 +1335,52 @@ "node": ">=6" } }, + "node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/set-cookie-parser": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.0.tgz", - "integrity": "sha512-cHMAtSXilfyBePduZEBVPTCftTQWz6ehWJD5YNUg4mqvRosrrjKbo4WS8JkB0/RxonMoohHm7cOGH60mDkRQ9w==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.1.tgz", + "integrity": "sha512-1jeBGaKNGdEq4FgIrORu/N570dwoPYio8lSoYLWmX7sQ//0JY08Xh9o5pBcgmHQ/MbsYp/aZnOe1s1lIsbLprQ==", + "dev": true + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "node_modules/source-map": { @@ -1138,6 +1426,18 @@ "node": ">=10.0.0" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -1157,9 +1457,9 @@ } }, "node_modules/undici": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.5.1.tgz", - "integrity": "sha512-MEvryPLf18HvlCbLSzCW0U00IMftKGI5udnjrQbC5D4P0Hodwffhv+iGfWuJwg16Y/TK11ZFK8i+BPVW2z/eAw==", + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.9.1.tgz", + "integrity": "sha512-6fB3a+SNnWEm4CJbgo0/CWR8RGcOCQP68SF4X0mxtYTq2VNN8T88NYrWVBAeSX+zb7bny2dx2iYhP3XHi00omg==", "dev": true, "engines": { "node": ">=12.18" @@ -1183,6 +1483,18 @@ "node": ">=6.14.2" } }, + "node_modules/validate-npm-package-name": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz", + "integrity": "sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q==", + "dev": true, + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -1213,6 +1525,21 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/wrangler": { "version": "2.0.16", "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-2.0.16.tgz", @@ -1243,9 +1570,9 @@ } }, "node_modules/ws": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz", - "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", "dev": true, "engines": { "node": ">=10.0.0" @@ -1277,6 +1604,12 @@ "node": ">=0.10.32" } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/youch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/youch/-/youch-2.2.2.tgz", @@ -1324,171 +1657,203 @@ "dev": true }, "@miniflare/cache": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.5.1.tgz", - "integrity": "sha512-qH5PC4zb7mHdQHlcaOuP0KUXuRbNSuB/HU7gpoeplV8J6CgNJGceVmQCZVZLycgDKZtAlhyGE1gkpJmeW7GCyw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.11.0.tgz", + "integrity": "sha512-L/kc9AzidPwFuk2fwHpAEePi0kNBk6FWUq3ln+9beRCDrPEpfVrDRFpNleF1NFZz5//oeVMuo8F0IVUQGzR7+Q==", "dev": true, "requires": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", "http-cache-semantics": "^4.1.0", - "undici": "5.5.1" + "undici": "5.9.1" } }, "@miniflare/cli-parser": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/cli-parser/-/cli-parser-2.5.1.tgz", - "integrity": "sha512-itlMDe9jwO806mkNkg3G70QYoG9YQHW6V10AF9L5b8J4LYt/V78uCEJSwNnCpL7zfKrScRPtDfXZxhrFzMXiUw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/cli-parser/-/cli-parser-2.11.0.tgz", + "integrity": "sha512-JUmyRzEGAS6CouvXJwBh8p44onfw3KRpfq5JGXEuHModOGjTp6li7PQyCTNPV2Hv/7StAXWnTFGXeAqyDHuTig==", "dev": true, "requires": { - "@miniflare/shared": "2.5.1", + "@miniflare/shared": "2.11.0", "kleur": "^4.1.4" } }, "@miniflare/core": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.5.1.tgz", - "integrity": "sha512-0oEBLV5AM3xxs6TS+7/fn4MSGNBfhUFVv41R8uc72H1a89+kBfRoz+xYI2RnJ3Yo+we66UgU3fXdG+R2KyESlQ==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/core/-/core-2.11.0.tgz", + "integrity": "sha512-UFMFiCG0co36VpZkgFrSBnrxo71uf1x+cjlzzJi3khmMyDlnLu4RuIQsAqvKbYom6fi3G9Q8lTgM7JuOXFyjhw==", "dev": true, "requires": { "@iarna/toml": "^2.2.5", - "@miniflare/shared": "2.5.1", - "@miniflare/watcher": "2.5.1", + "@miniflare/queues": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/watcher": "2.11.0", "busboy": "^1.6.0", "dotenv": "^10.0.0", "kleur": "^4.1.4", "set-cookie-parser": "^2.4.8", - "undici": "5.5.1", + "undici": "5.9.1", "urlpattern-polyfill": "^4.0.3" } }, - "@miniflare/durable-objects": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/durable-objects/-/durable-objects-2.5.1.tgz", - "integrity": "sha512-AZEGSA9LMA6vBzwADAzr81RBSWYlMfa/cDHnHaFL31w4mQwMUcqXOvemoqe6sTSq1KI0TTtvYbxPt0Lui8tEPw==", + "@miniflare/d1": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/d1/-/d1-2.11.0.tgz", + "integrity": "sha512-aDdBVQZ2C0Zs3+Y9ZbRctmuQxozPfpumwJ/6NG6fBadANvune/hW7ddEoxyteIEU9W3IgzVj8s4by4VvasX90A==", "dev": true, "requires": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/storage-memory": "2.5.1", - "undici": "5.5.1" + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0" + } + }, + "@miniflare/durable-objects": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/durable-objects/-/durable-objects-2.11.0.tgz", + "integrity": "sha512-0cKJaMgraTEU1b4kqK8cjD2oTeOjA6QU3Y+lWiZT/k1PMHZULovrSFnjii7qZ8npf4VHSIN6XYPxhyxRyEM65Q==", + "dev": true, + "requires": { + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/storage-memory": "2.11.0", + "undici": "5.9.1" } }, "@miniflare/html-rewriter": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/html-rewriter/-/html-rewriter-2.5.1.tgz", - "integrity": "sha512-fdO1qme8ukucejRz5yXJN/F4B9qEDRbBLPOEG94zwx8bHGGIo5VX15+J6oHubhjifLwzNuvOcg16Bu5dyR1KxQ==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/html-rewriter/-/html-rewriter-2.11.0.tgz", + "integrity": "sha512-olTqmuYTHnoTNtiA0vjQ/ixRfbwgPzDrAUbtXDCYW45VFbHfDVJrJGZX3Jg0HpSlxy86Zclle1SUxGbVDzxsBg==", "dev": true, "requires": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", "html-rewriter-wasm": "^0.4.1", - "undici": "5.5.1" + "undici": "5.9.1" } }, "@miniflare/http-server": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/http-server/-/http-server-2.5.1.tgz", - "integrity": "sha512-K+VoBU0LN8/oku/JWLEyX8wrp9fiaTC8/dosbY/6VWizyIrgQze16uD21GnK5+NBtbCAtLRryS5dZ3PnhiTR1w==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/http-server/-/http-server-2.11.0.tgz", + "integrity": "sha512-sMLcrDFzqqAvnQmAUH0hRTo8sBjW79VZYfnIH5FAGSGcKX6kdAGs9RStdYZ4CftQCBAEQScX0KBsMx5FwJRe9Q==", "dev": true, "requires": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/web-sockets": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/web-sockets": "2.11.0", "kleur": "^4.1.4", "selfsigned": "^2.0.0", - "undici": "5.5.1", + "undici": "5.9.1", "ws": "^8.2.2", "youch": "^2.2.2" } }, "@miniflare/kv": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/kv/-/kv-2.5.1.tgz", - "integrity": "sha512-ODTUqI7on3egHluBpFHifO0a9QFQUZscciASWKxGOt8VDp1vp0vIfU9ykQZrdZYFVeSKNVlUNqNQx+NMYZ6gIg==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/kv/-/kv-2.11.0.tgz", + "integrity": "sha512-3m9dL2HBBN170V1JvwjjucR5zl4G3mlcsV6C1E7A2wLl2Z2TWvIx/tSY9hrhkD96dFnejwJ9qmPMbXMMuynhjg==", "dev": true, "requires": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" + } + }, + "@miniflare/queues": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/queues/-/queues-2.11.0.tgz", + "integrity": "sha512-fLHjdrNLKhn0LZM/aii/9GsAttFd+lWlGzK8HOg1R0vhfKBwEub4zntjMmOfFbDm1ntc21tdMK7n3ldUphwh5w==", + "dev": true, + "requires": { + "@miniflare/shared": "2.11.0" + } + }, + "@miniflare/r2": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/r2/-/r2-2.11.0.tgz", + "integrity": "sha512-MKuyJ/gGNsK3eWbGdygvozqcyaZhM3C6NGHvoaZwH503dwN569j5DpatTWiHGFeDeSu64VqcIsGehz05GDUaag==", + "dev": true, + "requires": { + "@miniflare/shared": "2.11.0", + "undici": "5.9.1" } }, "@miniflare/runner-vm": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.5.1.tgz", - "integrity": "sha512-7U7BPgzaikwWkAMonlmyy4lDpW1H7mqHFr7NdK9kA6BbXZ2GY6uro69QsGw0c4Y/vyKBodKiqXAq53iGdM3Kug==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/runner-vm/-/runner-vm-2.11.0.tgz", + "integrity": "sha512-bkVSuvCf5+VylqN8lTiLxIYqYcKFbl+BywZGwGQndPC/3wh42J00mM0jw4hRbvXgwuBhlUyCVpEXtYlftFFT/g==", "dev": true, "requires": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" } }, "@miniflare/scheduler": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/scheduler/-/scheduler-2.5.1.tgz", - "integrity": "sha512-ybho5Kg3Cfl4E0JleKAbiv/RTA+/PVqH6Y/PuCH2oowSM7qeAvFkrwiRvxtN7BuAl+5lsGyVxFe4gL+weXohEw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/scheduler/-/scheduler-2.11.0.tgz", + "integrity": "sha512-DPdzINhdWeS99eIicGoluMsD4pLTTAWNQbgCv3CTwgdKA3dxdvMSCkNqZzQLiALzvk9+rSfj46FlH++HE7o7/w==", "dev": true, "requires": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", "cron-schedule": "^3.0.4" } }, "@miniflare/shared": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.5.1.tgz", - "integrity": "sha512-DObgqbFml3qetIBtZa8fNqkBqUH9XtI6rdrWtTYVrx0rzKsd5PDf6gdMoxy7v1rr9zBAipKJxrcBqlEgjPl53Q==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/shared/-/shared-2.11.0.tgz", + "integrity": "sha512-fWMqq3ZkWAg+k7CnyzMV/rZHugwn+/JxvVzCxrtvxzwotTN547THlOxgZe8JAP23U9BiTxOfpTfnLvFEjAmegw==", "dev": true, "requires": { - "ignore": "^5.1.8", - "kleur": "^4.1.4" + "@types/better-sqlite3": "^7.6.0", + "kleur": "^4.1.4", + "npx-import": "^1.1.3", + "picomatch": "^2.3.1" } }, "@miniflare/sites": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/sites/-/sites-2.5.1.tgz", - "integrity": "sha512-7V/fAzR50LYgMcOfoCaoppqBCjagBpGWFbZgMyJi/Hj4oVlSIzxo+424hzdjitNzikCpv+AryF9tXfy9j6qiOg==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/sites/-/sites-2.11.0.tgz", + "integrity": "sha512-qbefKdWZUJgsdLf+kCw03sn3h/92LZgJAbkOpP6bCrfWkXlJ37EQXO4KWdhn4Ghc7A6GwU1s1I/mdB64B3AewQ==", "dev": true, "requires": { - "@miniflare/kv": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/storage-file": "2.5.1" + "@miniflare/kv": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/storage-file": "2.11.0" } }, "@miniflare/storage-file": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/storage-file/-/storage-file-2.5.1.tgz", - "integrity": "sha512-o12KFXgc1M0nHD98mrA/IqwBsJ6KYLWH9NaTwqLhxhpGz/KSo5kWb7z/vrz2I/Rk2XR/gHSYQm2XR9XE6IJCdA==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/storage-file/-/storage-file-2.11.0.tgz", + "integrity": "sha512-beWF/lTX74x7AiaSB+xQxywPSNdhtEKvqDkRui8eOJ5kqN2o4UaleLKQGgqmCw3WyHRIsckV7If1qpbNiLtWMw==", "dev": true, "requires": { - "@miniflare/shared": "2.5.1", - "@miniflare/storage-memory": "2.5.1" + "@miniflare/shared": "2.11.0", + "@miniflare/storage-memory": "2.11.0" } }, "@miniflare/storage-memory": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.5.1.tgz", - "integrity": "sha512-LIdBEFcwY7yLCeowO34p5bajRsvU1XuQjXIqcgfiCVt1+qa3D0seELTpW1NSFEJzxulVtu/KsScEug9GipEt7A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/storage-memory/-/storage-memory-2.11.0.tgz", + "integrity": "sha512-s0AhPww7fq/Jz80NbPb+ffhcVRKnfPi7H1dHTRTre2Ud23EVJjAWl2gat42x8NOT/Fu3/o/7A72DWQQJqfO98A==", "dev": true, "requires": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" } }, "@miniflare/watcher": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.5.1.tgz", - "integrity": "sha512-8oOdgWA7CZ7uIAwbjqSrhDnuQXRJqd9e3yDHsMa91E/jkC/GDmlt5SJh6VEMlNDtBGWd661IpVErZf7injI52w==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/watcher/-/watcher-2.11.0.tgz", + "integrity": "sha512-RUfjz2iYcsQXLcGySemJl98CJ2iierbWsPGWZhIVZI+NNhROkEy77g/Q+lvP2ATwexG3/dUSfdJ3P8aH+sI4Ig==", "dev": true, "requires": { - "@miniflare/shared": "2.5.1" + "@miniflare/shared": "2.11.0" } }, "@miniflare/web-sockets": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.5.1.tgz", - "integrity": "sha512-GyXHoDAI5LDF87rmD+d0cSoN7Xs2pCYjSyUR6Vf6exkS4CN6F/Rtr8vIM5+om9kRkS6qxAyOYjWeEqBOjLm/og==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@miniflare/web-sockets/-/web-sockets-2.11.0.tgz", + "integrity": "sha512-NC8RKrmxrO0hZmwpzn5g4hPGA2VblnFTIBobmWoxuK95eW49zfs7dtE/PyFs+blsGv3CjTIjHVSQ782K+C6HFA==", "dev": true, "requires": { - "@miniflare/core": "2.5.1", - "@miniflare/shared": "2.5.1", - "undici": "5.5.1", + "@miniflare/core": "2.11.0", + "@miniflare/shared": "2.11.0", + "undici": "5.9.1", "ws": "^8.2.2" } }, @@ -1545,6 +1910,21 @@ "@supabase/storage-js": "^1.7.2" } }, + "@types/better-sqlite3": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.3.tgz", + "integrity": "sha512-YS64N9SNDT/NAvou3QNdzAu3E2om/W/0dhORimtPGLef+zSK5l1vDzfsWb4xgXOgfhtOI5ZDTRxnvRPb22AIVQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/node": { + "version": "18.11.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz", + "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==", + "dev": true + }, "@types/phoenix": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.5.4.tgz", @@ -1576,6 +1956,15 @@ "node-gyp-build": "^4.3.0" } }, + "builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "requires": { + "semver": "^7.0.0" + } + }, "busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", @@ -1605,6 +1994,17 @@ "node-fetch": "2.6.7" } }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, "d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -1837,6 +2237,23 @@ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "dev": true }, + "execa": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", + "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^3.0.1", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + } + }, "ext": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.6.0.tgz", @@ -1859,6 +2276,12 @@ "dev": true, "optional": true }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, "html-rewriter-wasm": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/html-rewriter-wasm/-/html-rewriter-wasm-0.4.1.tgz", @@ -1871,10 +2294,16 @@ "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", "dev": true }, - "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "human-signals": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", + "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==", + "dev": true + }, + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", "dev": true }, "is-typedarray": { @@ -1882,6 +2311,12 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "itty-router": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/itty-router/-/itty-router-2.6.1.tgz", @@ -1898,6 +2333,15 @@ "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", "dev": true }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "magic-string": { "version": "0.25.9", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", @@ -1907,36 +2351,51 @@ "sourcemap-codec": "^1.4.8" } }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "mime": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", "dev": true }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, "miniflare": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-2.5.1.tgz", - "integrity": "sha512-PT56C/j7U6n7WDxnIUHu0d8EY/gedPRsta2b+LsrIHGZPSkxAcPzf2DgbbPU7obv0C4hT9H0GL1fWpWtr2SbDQ==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-2.11.0.tgz", + "integrity": "sha512-QA18I1VQXdCo4nBtPJUcUDxW8c9xbc5ex5F61jwhkGVOISSnYdEheolESmjr8MYk28xwi0XD1ozS4rLaTONd+w==", "dev": true, "requires": { - "@miniflare/cache": "2.5.1", - "@miniflare/cli-parser": "2.5.1", - "@miniflare/core": "2.5.1", - "@miniflare/durable-objects": "2.5.1", - "@miniflare/html-rewriter": "2.5.1", - "@miniflare/http-server": "2.5.1", - "@miniflare/kv": "2.5.1", - "@miniflare/runner-vm": "2.5.1", - "@miniflare/scheduler": "2.5.1", - "@miniflare/shared": "2.5.1", - "@miniflare/sites": "2.5.1", - "@miniflare/storage-file": "2.5.1", - "@miniflare/storage-memory": "2.5.1", - "@miniflare/web-sockets": "2.5.1", + "@miniflare/cache": "2.11.0", + "@miniflare/cli-parser": "2.11.0", + "@miniflare/core": "2.11.0", + "@miniflare/d1": "2.11.0", + "@miniflare/durable-objects": "2.11.0", + "@miniflare/html-rewriter": "2.11.0", + "@miniflare/http-server": "2.11.0", + "@miniflare/kv": "2.11.0", + "@miniflare/queues": "2.11.0", + "@miniflare/r2": "2.11.0", + "@miniflare/runner-vm": "2.11.0", + "@miniflare/scheduler": "2.11.0", + "@miniflare/shared": "2.11.0", + "@miniflare/sites": "2.11.0", + "@miniflare/storage-file": "2.11.0", + "@miniflare/storage-memory": "2.11.0", + "@miniflare/web-sockets": "2.11.0", "kleur": "^4.1.4", "semiver": "^1.1.0", "source-map-support": "^0.5.20", - "undici": "5.5.1" + "undici": "5.9.1" } }, "ms": { @@ -1980,12 +2439,68 @@ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" }, + "npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "requires": { + "path-key": "^4.0.0" + }, + "dependencies": { + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + } + } + }, + "npx-import": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/npx-import/-/npx-import-1.1.4.tgz", + "integrity": "sha512-3ShymTWOgqGyNlh5lMJAejLuIv3W1K3fbI5Ewc6YErZU3Sp0PqsNs8UIU1O8z5+KVl/Du5ag56Gza9vdorGEoA==", + "dev": true, + "requires": { + "execa": "^6.1.0", + "parse-package-name": "^1.0.0", + "semver": "^7.3.7", + "validate-npm-package-name": "^4.0.0" + } + }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + }, + "parse-package-name": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-package-name/-/parse-package-name-1.0.0.tgz", + "integrity": "sha512-kBeTUtcj+SkyfaW4+KBe0HtsloBJ/mKTPoxpVdA57GZiPerREsUWJOhVj9anXweFiJkm5y8FG1sxFZkZ0SN6wg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, "path-to-regexp": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", "dev": true }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, "rollup-plugin-inject": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz", @@ -2030,10 +2545,40 @@ "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==", "dev": true }, + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, "set-cookie-parser": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.0.tgz", - "integrity": "sha512-cHMAtSXilfyBePduZEBVPTCftTQWz6ehWJD5YNUg4mqvRosrrjKbo4WS8JkB0/RxonMoohHm7cOGH60mDkRQ9w==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.1.tgz", + "integrity": "sha512-1jeBGaKNGdEq4FgIrORu/N570dwoPYio8lSoYLWmX7sQ//0JY08Xh9o5pBcgmHQ/MbsYp/aZnOe1s1lIsbLprQ==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "source-map": { @@ -2070,6 +2615,12 @@ "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", "dev": true }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true + }, "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -2089,9 +2640,9 @@ } }, "undici": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.5.1.tgz", - "integrity": "sha512-MEvryPLf18HvlCbLSzCW0U00IMftKGI5udnjrQbC5D4P0Hodwffhv+iGfWuJwg16Y/TK11ZFK8i+BPVW2z/eAw==", + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.9.1.tgz", + "integrity": "sha512-6fB3a+SNnWEm4CJbgo0/CWR8RGcOCQP68SF4X0mxtYTq2VNN8T88NYrWVBAeSX+zb7bny2dx2iYhP3XHi00omg==", "dev": true }, "urlpattern-polyfill": { @@ -2108,6 +2659,15 @@ "node-gyp-build": "^4.3.0" } }, + "validate-npm-package-name": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz", + "integrity": "sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q==", + "dev": true, + "requires": { + "builtins": "^5.0.0" + } + }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -2135,6 +2695,15 @@ "webidl-conversions": "^3.0.0" } }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, "wrangler": { "version": "2.0.16", "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-2.0.16.tgz", @@ -2156,9 +2725,9 @@ } }, "ws": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz", - "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", "dev": true, "requires": {} }, @@ -2173,6 +2742,12 @@ "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==" }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "youch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/youch/-/youch-2.2.2.tgz", diff --git a/examples/user-management/expo-user-management/package-lock.json b/examples/user-management/expo-user-management/package-lock.json index cf092799d1f..cd37665857e 100644 --- a/examples/user-management/expo-user-management/package-lock.json +++ b/examples/user-management/expo-user-management/package-lock.json @@ -7486,9 +7486,9 @@ } }, "node_modules/decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", "engines": { "node": ">=0.10" } @@ -25876,9 +25876,9 @@ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==" }, "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og==" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" }, "deep-equal": { "version": "1.1.1", diff --git a/examples/user-management/nuxtjs-user-management/package-lock.json b/examples/user-management/nuxtjs-user-management/package-lock.json index 9d71565dd1e..b56ae56ac2e 100644 --- a/examples/user-management/nuxtjs-user-management/package-lock.json +++ b/examples/user-management/nuxtjs-user-management/package-lock.json @@ -5135,9 +5135,9 @@ } }, "node_modules/decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", "engines": { "node": ">=0.10" } @@ -17870,9 +17870,9 @@ } }, "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" }, "deepmerge": { "version": "4.2.2", diff --git a/examples/user-management/react-user-management/package-lock.json b/examples/user-management/react-user-management/package-lock.json index bfbb8adf04f..534a7c7ab75 100644 --- a/examples/user-management/react-user-management/package-lock.json +++ b/examples/user-management/react-user-management/package-lock.json @@ -6397,9 +6397,9 @@ "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" }, "node_modules/decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", "engines": { "node": ">=0.10" } @@ -26699,9 +26699,9 @@ "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" }, "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" }, "dedent": { "version": "0.7.0", diff --git a/i18n/README.es.md b/i18n/README.es.md index a653d1b2492..602393663a2 100644 --- a/i18n/README.es.md +++ b/i18n/README.es.md @@ -71,17 +71,134 @@ Supabase es una [plataforma alojada](https://app.supabase.com). Te puedes regist Nuestra librería de cliente es modular. Cada sub-librería es una implementación independiente para cada sistema externo. Esta es una de las formas de apoyar las herramientas existentes. -- **`supabase-{lang}`**: Combina librerías y agrega mejoras. - - `postgrest-{lang}`: Librería de cliente para trabajar con [PostgREST](https://github.com/postgrest/postgrest) - - `realtime-{lang}`: Librería de cliente para trabajar con [Realtime](https://github.com/supabase/realtime) - - `gotrue-{lang}`: Librería de cliente para trabajar con [GoTrue](https://github.com/netlify/gotrue) - -| Repositorio | Oficial | Comunidad | -| --------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **`supabase-{lang}`** | [`JS`](https://github.com/supabase/supabase-js) | [`C#`](https://github.com/supabase/supabase-csharp) \| [`Flutter`](https://github.com/supabase/supabase-flutter) \| [`Python`](https://github.com/supabase/supabase-py) \| `Rust` | -| `postgrest-{lang}` | [`JS`](https://github.com/supabase/postgrest-js) | [`C#`](https://github.com/supabase/postgrest-csharp) \| [`Dart`](https://github.com/supabase/postgrest-dart) \| [`Python`](https://github.com/supabase/postgrest-py) \| [`Rust`](https://github.com/supabase/postgrest-rs) | -| `realtime-{lang}` | [`JS`](https://github.com/supabase/realtime-js) | [`C#`](https://github.com/supabase/realtime-csharp) \| [`Dart`](https://github.com/supabase/realtime-dart) \| [`Python`](https://github.com/supabase/realtime-py) \| `Rust` | -| `gotrue-{lang}` | [`JS`](https://github.com/supabase/gotrue-js) | [`C#`](https://github.com/supabase/gotrue-csharp) \| [`Dart`](https://github.com/supabase/gotrue-dart) \| [`Python`](https://github.com/supabase/gotrue-py) \| `Rust` | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      LenguajeClienteCaracterística - Clientes (incluido en el cliente de Supabase)
      SupabasePostgRESTGoTrueRealtimeStorageFunctions
      ⚡️ Oficial ⚡️
      JavaScript (TypeScript)supabase-jspostgrest-jsgotrue-jsrealtime-jsstorage-jsfunctions-js
      Fluttersupabase-flutterpostgrest-dartgotrue-dartrealtime-dartstorage-dartfunctions-dart
      💚 Comunidad 💚
      C#supabase-csharppostgrest-csharpgotrue-csharprealtime-csharpstorage-csharpfunctions-csharp
      Go-postgrest-gogotrue-go-storage-gofunctions-go
      Java--gotrue-java-storage-java-
      Kotlinsupabase-ktpostgrest-ktgotrue-ktrealtime-ktstorage-ktfunctions-kt
      Pythonsupabase-pypostgrest-pygotrue-pyrealtime-pystorage-pyfunctions-py
      Rubysupabase-rbpostgrest-rb----
      Rust-postgrest-rs----
      Swiftsupabase-swiftpostgrest-swiftgotrue-swiftrealtime-swiftstorage-swiftfunctions-swift
      Godot Engine (GDScript)supabase-gdscriptpostgrest-gdscriptgotrue-gdscriptrealtime-gdscriptstorage-gdscriptfunctions-gdscript
      diff --git a/package-lock.json b/package-lock.json index f0df444fb07..a623b4950f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9827,6 +9827,36 @@ "react-dom": "<18.0.0" } }, + "node_modules/@testing-library/react-hooks": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-8.0.1.tgz", + "integrity": "sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "react-error-boundary": "^3.1.0" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "@types/react": "^16.9.0 || ^17.0.0", + "react": "^16.9.0 || ^17.0.0", + "react-dom": "^16.9.0 || ^17.0.0", + "react-test-renderer": "^16.9.0 || ^17.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "react-test-renderer": { + "optional": true + } + } + }, "node_modules/@testing-library/user-event": { "version": "13.5.0", "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-13.5.0.tgz", @@ -9963,12 +9993,6 @@ "classnames": "*" } }, - "node_modules/@types/crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-BG7fQKZ689HIoc5h+6D2Dgq1fABRa0RbBWKBd9SP/MVRVXROflpm5fhwyATX5duFmbStzyzyycPB8qUYKDH3NA==", - "dev": true - }, "node_modules/@types/d3-color": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-2.0.3.tgz", @@ -11822,6 +11846,80 @@ "npm": ">=5" } }, + "node_modules/aws-sdk": { + "version": "2.1275.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1275.0.tgz", + "integrity": "sha512-GP7oS0BTh012pAMnNSVVQQrhfubeLH2moLUQQiuk9cPrqQYeP74BU3nnALM30CoFNzX+DwLanOeFU+KMfUGLHg==", + "dev": true, + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/aws-sdk/node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/aws-sdk/node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true + }, + "node_modules/aws-sdk/node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", + "dev": true + }, + "node_modules/aws-sdk/node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "dev": true, + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/aws-sdk/node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/aws-sdk/node_modules/uuid": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/axe-core": { "version": "4.5.2", "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.5.2.tgz", @@ -14256,11 +14354,6 @@ "node": "*" } }, - "node_modules/crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" - }, "node_modules/css-blank-pseudo": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-0.1.4.tgz", @@ -20160,6 +20253,21 @@ "node": ">=6" } }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -22379,6 +22487,15 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/join-component": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/join-component/-/join-component-1.1.0.tgz", @@ -29744,6 +29861,22 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, + "node_modules/react-error-boundary": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.4.tgz", + "integrity": "sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + }, + "peerDependencies": { + "react": ">=16.13.1" + } + }, "node_modules/react-fast-compare": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-2.0.4.tgz", @@ -32401,6 +32534,12 @@ "node": ">=12.0.0" } }, + "node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==", + "dev": true + }, "node_modules/saxes": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", @@ -36895,6 +37034,25 @@ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true }, + "node_modules/xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dev": true, + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", @@ -37435,7 +37593,6 @@ "common": "*", "config": "*", "configcat-js": "^5.6.0", - "crypto-js": "^4.1.1", "dayjs": "^1.11.0", "file-saver": "^2.0.5", "generate-password": "^1.7.0", @@ -37484,6 +37641,7 @@ "uniforms-bootstrap4": "^3.6.2", "uniforms-bridge-json-schema": "^3.6.2", "uuid": "^8.3.2", + "valtio": "^1.7.6", "yup": "^0.32.11", "yup-password": "^0.2.2", "zxcvbn": "^4.4.2" @@ -37497,11 +37655,11 @@ "@storybook/react": "^6.4.19", "@storybook/testing-library": "^0.0.9", "@tailwindcss/typography": "^0.5.2", - "@testing-library/dom": "^8.11.1", - "@testing-library/react": "^12.1.2", + "@testing-library/dom": "^8.19.0", + "@testing-library/react": "^12.1.5", + "@testing-library/react-hooks": "^8.0.1", "@testing-library/user-event": "^13.5.0", "@types/blueimp-md5": "^2.18.0", - "@types/crypto-js": "^4.0.2", "@types/file-saver": "^2.0.2", "@types/json-logic-js": "^1.2.1", "@types/lodash": "^4.14.172", @@ -37522,6 +37680,7 @@ "@types/uuid": "^8.3.4", "@types/zxcvbn": "^4.4.1", "autoprefixer": "10.4.2", + "aws-sdk": "^2.1275.0", "babel-loader": "^8.2.3", "common": "*", "config": "*", @@ -37705,6 +37864,11 @@ "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-9.3.1.tgz", "integrity": "sha512-/Yvsd2D7miYB4HLJ3hOOS0+vnowQpaT75FsHzr/y5M9P4q9bwa7RcbW2YdH6KZBn8ceLbKGnHxMZ1CHliGHUFw==" }, + "studio/node_modules/proxy-compare": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/proxy-compare/-/proxy-compare-2.3.0.tgz", + "integrity": "sha512-c3L2CcAi7f7pvlD0D7xsF+2CQIW8C3HaYx2Pfgq8eA4HAl3GAH6/dVYsyBbYF/0XJs2ziGLrzmz5fmzPm6A0pQ==" + }, "studio/node_modules/react-resize-detector": { "version": "6.7.8", "resolved": "https://registry.npmjs.org/react-resize-detector/-/react-resize-detector-6.7.8.tgz", @@ -37765,6 +37929,46 @@ "node": ">=4.2.0" } }, + "studio/node_modules/valtio": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/valtio/-/valtio-1.7.6.tgz", + "integrity": "sha512-zsGrCCYOIpy8egQxftduFyJusF/BMu3CganhHKUOE/I6t6V6yA1MDfZZkrYoWYCGkC3rSBYcIHEEsoYQM9lV2w==", + "dependencies": { + "proxy-compare": "2.3.0", + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@babel/helper-module-imports": ">=7.12", + "@babel/types": ">=7.13", + "aslemammad-vite-plugin-macro": ">=1.0.0-alpha.1", + "babel-plugin-macros": ">=3.0", + "react": ">=16.8", + "vite": ">=2.8.6" + }, + "peerDependenciesMeta": { + "@babel/helper-module-imports": { + "optional": true + }, + "@babel/types": { + "optional": true + }, + "aslemammad-vite-plugin-macro": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + }, + "react": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, "studio/node_modules/webpack-bundle-analyzer": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.3.0.tgz", @@ -44398,6 +44602,16 @@ "@types/react-dom": "<18.0.0" } }, + "@testing-library/react-hooks": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-8.0.1.tgz", + "integrity": "sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g==", + "dev": true, + "requires": { + "@babel/runtime": "^7.12.5", + "react-error-boundary": "^3.1.0" + } + }, "@testing-library/user-event": { "version": "13.5.0", "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-13.5.0.tgz", @@ -44523,12 +44737,6 @@ "classnames": "*" } }, - "@types/crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-BG7fQKZ689HIoc5h+6D2Dgq1fABRa0RbBWKBd9SP/MVRVXROflpm5fhwyATX5duFmbStzyzyycPB8qUYKDH3NA==", - "dev": true - }, "@types/d3-color": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-2.0.3.tgz", @@ -46055,6 +46263,73 @@ "awesome-imperative-promise": "^1.0.1" } }, + "aws-sdk": { + "version": "2.1275.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1275.0.tgz", + "integrity": "sha512-GP7oS0BTh012pAMnNSVVQQrhfubeLH2moLUQQiuk9cPrqQYeP74BU3nnALM30CoFNzX+DwLanOeFU+KMfUGLHg==", + "dev": true, + "requires": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.4.19" + }, + "dependencies": { + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", + "dev": true + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true + }, + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", + "dev": true + }, + "url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "uuid": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "dev": true + } + } + }, "axe-core": { "version": "4.5.2", "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.5.2.tgz", @@ -48012,11 +48287,6 @@ "randomfill": "^1.0.3" } }, - "crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" - }, "css-blank-pseudo": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-0.1.4.tgz", @@ -53030,6 +53300,15 @@ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -54820,6 +55099,12 @@ } } }, + "jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", + "dev": true + }, "join-component": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/join-component/-/join-component-1.1.0.tgz", @@ -60267,6 +60552,15 @@ } } }, + "react-error-boundary": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.4.tgz", + "integrity": "sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.12.5" + } + }, "react-fast-compare": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-2.0.4.tgz", @@ -62150,6 +62444,12 @@ "source-map-js": ">=0.6.2 <2.0.0" } }, + "sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==", + "dev": true + }, "saxes": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", @@ -63067,11 +63367,11 @@ "@tailwindcss/typography": "^0.5.2", "@tanstack/react-query": "^4.16.1", "@tanstack/react-query-devtools": "^4.16.1", - "@testing-library/dom": "^8.11.1", - "@testing-library/react": "^12.1.2", + "@testing-library/dom": "^8.19.0", + "@testing-library/react": "^12.1.5", + "@testing-library/react-hooks": "*", "@testing-library/user-event": "^13.5.0", "@types/blueimp-md5": "^2.18.0", - "@types/crypto-js": "^4.0.2", "@types/file-saver": "^2.0.2", "@types/json-logic-js": "^1.2.1", "@types/lodash": "^4.14.172", @@ -63095,13 +63395,13 @@ "analytics-node": "^3.5.0", "autoprefixer": "10.4.2", "awesome-debounce-promise": "^2.1.0", + "aws-sdk": "^2.1275.0", "babel-loader": "^8.2.3", "blueimp-md5": "^2.19.0", "clipboard": "^2.0.8", "common": "*", "config": "*", "configcat-js": "^5.6.0", - "crypto-js": "^4.1.1", "dayjs": "^1.11.0", "file-saver": "^2.0.5", "generate-password": "^1.7.0", @@ -63158,6 +63458,7 @@ "uniforms-bootstrap4": "^3.6.2", "uniforms-bridge-json-schema": "^3.6.2", "uuid": "^8.3.2", + "valtio": "^1.7.6", "yup": "^0.32.11", "yup-password": "^0.2.2", "zxcvbn": "^4.4.2" @@ -63308,6 +63609,11 @@ "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-9.3.1.tgz", "integrity": "sha512-/Yvsd2D7miYB4HLJ3hOOS0+vnowQpaT75FsHzr/y5M9P4q9bwa7RcbW2YdH6KZBn8ceLbKGnHxMZ1CHliGHUFw==" }, + "proxy-compare": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/proxy-compare/-/proxy-compare-2.3.0.tgz", + "integrity": "sha512-c3L2CcAi7f7pvlD0D7xsF+2CQIW8C3HaYx2Pfgq8eA4HAl3GAH6/dVYsyBbYF/0XJs2ziGLrzmz5fmzPm6A0pQ==" + }, "react-resize-detector": { "version": "6.7.8", "resolved": "https://registry.npmjs.org/react-resize-detector/-/react-resize-detector-6.7.8.tgz", @@ -63351,6 +63657,15 @@ "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true }, + "valtio": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/valtio/-/valtio-1.7.6.tgz", + "integrity": "sha512-zsGrCCYOIpy8egQxftduFyJusF/BMu3CganhHKUOE/I6t6V6yA1MDfZZkrYoWYCGkC3rSBYcIHEEsoYQM9lV2w==", + "requires": { + "proxy-compare": "2.3.0", + "use-sync-external-store": "1.2.0" + } + }, "webpack-bundle-analyzer": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.3.0.tgz", @@ -66375,6 +66690,22 @@ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", "dev": true }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dev": true, + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", + "dev": true + }, "xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", diff --git a/package.json b/package.json index 4a605d28309..bf893aa1978 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,10 @@ "dev:www": "turbo run dev --filter=www --parallel", "lint": "turbo run lint", "format": "prettier --write \"apps/**/*.{js,jsx,ts,tsx,css,md,json}\"", - "docker:dev": "cd docker && docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up --renew-anon-volumes", - "docker:up": "cd docker && docker-compose up", - "docker:down": "cd docker && docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down --remove-orphans", - "docker:remove": "cd docker && docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml rm -vfs", + "docker:dev": "cd docker && docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up --renew-anon-volumes", + "docker:up": "cd docker && docker compose up", + "docker:down": "cd docker && docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down --remove-orphans", + "docker:remove": "cd docker && docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml rm -vfs", "test": "jest", "test:studio": "turbo run test --filter=studio", "perf:kong": "ab -t 5 -c 20 -T application/json http://localhost:8000/", diff --git a/spec/cli_v1_commands.yaml b/spec/cli_v1_commands.yaml index e0799ffd7c0..fabffeb3733 100644 --- a/spec/cli_v1_commands.yaml +++ b/spec/cli_v1_commands.yaml @@ -1,7 +1,7 @@ clispec: '001' info: id: cli - version: 1.24.0 + version: 1.27.0 title: Supabase CLI language: sh source: https://github.com/supabase/cli @@ -58,6 +58,11 @@ commands: usage: supabase vanity-subdomains get subcommands: [] flags: + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' - id: project-ref name: --project-ref description: Project ref of the Supabase project. @@ -72,6 +77,11 @@ commands: usage: supabase vanity-subdomains delete subcommands: [] flags: + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' - id: project-ref name: --project-ref description: Project ref of the Supabase project. @@ -89,6 +99,11 @@ commands: description: | The desired vanity subdomain to use for your Supabase project. default_value: '' + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' - id: project-ref name: --project-ref description: Project ref of the Supabase project. @@ -111,6 +126,11 @@ commands: description: | The desired vanity subdomain to use for your Supabase project. default_value: '' + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' - id: project-ref name: --project-ref description: Project ref of the Supabase project. @@ -372,6 +392,11 @@ commands: name: --db-allow-cidr description: CIDR to allow DB connections from. default_value: '[]' + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' - id: project-ref name: --project-ref description: Project ref of the Supabase project. @@ -384,6 +409,63 @@ commands: usage: supabase network-restrictions get subcommands: [] flags: + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' + - id: project-ref + name: --project-ref + description: Project ref of the Supabase project. + default_value: '' + - id: supabase-network-bans + title: supabase network-bans + summary: Manage network bans + description: |- + Network bans are IPs that get temporarily blocked if their traffic pattern looks abusive (e.g. multiple failed auth attempts). + + The subcommands help you view the current bans, and unblock IPs if desired. + tags: + - management-api + links: [] + subcommands: + - supabase-network-bans-get + - supabase-network-bans-remove + flags: [] + - id: supabase-network-bans-remove + title: supabase network-bans remove + summary: Remove a network ban + tags: [] + links: [] + usage: supabase network-bans remove [flags] + subcommands: [] + flags: + - id: db-unban-ip + name: --db-unban-ip + description: IP to allow DB connections from. + default_value: '[]' + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' + - id: project-ref + name: --project-ref + description: Project ref of the Supabase project. + default_value: '' + - id: supabase-network-bans-get + title: supabase network-bans get + summary: Get the current network bans + tags: [] + links: [] + usage: supabase network-bans get + subcommands: [] + flags: + - id: experimental + name: --experimental + description: enable experimental features + required: true + default_value: 'false' - id: project-ref name: --project-ref description: Project ref of the Supabase project. @@ -407,6 +489,10 @@ commands: usage: supabase migration repair [flags] subcommands: [] flags: + - id: password + name: -p, --password + description: Password to your remote Postgres database. + default_value: '' - id: status name: --status <[ applied | reverted ]> description: Version status to update. @@ -722,6 +808,7 @@ commands: links: [] subcommands: - supabase-db-diff + - supabase-db-dump - supabase-db-lint - supabase-db-push - supabase-db-remote @@ -804,6 +891,22 @@ commands: name: -s, --schema description: List of schema to include. default_value: '[public]' + - id: supabase-db-dump + title: supabase db dump + summary: Dumps schemas from the remote database + tags: [] + links: [] + usage: supabase db dump [flags] + subcommands: [] + flags: + - id: file + name: -f, --file + description: File path to save the dumped schema. + default_value: '' + - id: password + name: -p, --password + description: Password to your remote Postgres database. + default_value: '' - id: supabase-db-diff title: supabase db diff summary: Diffs the local database for schema changes @@ -814,7 +917,7 @@ commands: flags: - id: file name: -f, --file - description: Saves schema diff to a file. + description: Saves schema diff to a new migration file. default_value: '' - id: linked name: --linked diff --git a/spec/common-cli-sections.json b/spec/common-cli-sections.json index 9ce2b34c7e0..4481a05bacf 100644 --- a/spec/common-cli-sections.json +++ b/spec/common-cli-sections.json @@ -17,33 +17,9 @@ "title": "general", "items": [ { - "id": "supabase-test", - "title": "supabase test", - "slug": "supabase-test", - "type": "cli-command" - }, - { - "id": "supabase-test-db", - "title": "supabase test db", - "slug": "supabase-test-db", - "type": "cli-command" - }, - { - "id": "supabase-stop", - "title": "supabase stop", - "slug": "supabase-stop", - "type": "cli-command" - }, - { - "id": "supabase-status", - "title": "supabase status", - "slug": "supabase-status", - "type": "cli-command" - }, - { - "id": "supabase-start", - "title": "supabase start", - "slug": "supabase-start", + "id": "supabase-init", + "title": "supabase init", + "slug": "supabase-init", "type": "cli-command" }, { @@ -59,9 +35,33 @@ "type": "cli-command" }, { - "id": "supabase-init", - "title": "supabase init", - "slug": "supabase-init", + "id": "supabase-start", + "title": "supabase start", + "slug": "supabase-start", + "type": "cli-command" + }, + { + "id": "supabase-stop", + "title": "supabase stop", + "slug": "supabase-stop", + "type": "cli-command" + }, + { + "id": "supabase-status", + "title": "supabase status", + "slug": "supabase-status", + "type": "cli-command" + }, + { + "id": "supabase-test", + "title": "supabase test", + "slug": "supabase-test", + "type": "cli-command" + }, + { + "id": "supabase-test-db", + "title": "supabase test db", + "slug": "supabase-test-db", "type": "cli-command" }, { @@ -88,12 +88,36 @@ "title": "Database", "items": [ { "id": "supabase-db", "title": "supabase db", "slug": "supabase-db", "type": "cli-command" }, + { + "id": "supabase-db-dump", + "title": "supabase db dump", + "slug": "supabase-db-dump", + "type": "cli-command" + }, + { + "id": "supabase-db-push", + "title": "supabase db push", + "slug": "supabase-db-push", + "type": "cli-command" + }, { "id": "supabase-db-reset", "title": "supabase db reset", "slug": "supabase-db-reset", "type": "cli-command" }, + { + "id": "supabase-db-diff", + "title": "supabase db diff", + "slug": "supabase-db-diff", + "type": "cli-command" + }, + { + "id": "supabase-db-lint", + "title": "supabase db lint", + "slug": "supabase-db-lint", + "type": "cli-command" + }, { "id": "supabase-db-remote", "title": "supabase db remote", @@ -105,24 +129,6 @@ "title": "supabase db remote commit", "slug": "supabase-db-remote-commit", "type": "cli-command" - }, - { - "id": "supabase-db-push", - "title": "supabase db push", - "slug": "supabase-db-push", - "type": "cli-command" - }, - { - "id": "supabase-db-lint", - "title": "supabase db lint", - "slug": "supabase-db-lint", - "type": "cli-command" - }, - { - "id": "supabase-db-diff", - "title": "supabase db diff", - "slug": "supabase-db-diff", - "type": "cli-command" } ] }, @@ -155,35 +161,6 @@ } ] }, - { - "title": "secrets", - "items": [ - { - "id": "supabase-secrets", - "title": "supabase secrets", - "slug": "supabase-secrets", - "type": "cli-command" - }, - { - "id": "supabase-secrets-unset", - "title": "supabase secrets unset", - "slug": "supabase-secrets-unset", - "type": "cli-command" - }, - { - "id": "supabase-secrets-set", - "title": "supabase secrets set", - "slug": "supabase-secrets-set", - "type": "cli-command" - }, - { - "id": "supabase-secrets-list", - "title": "supabase secrets list", - "slug": "supabase-secrets-list", - "type": "cli-command" - } - ] - }, { "title": "projects", "items": [ @@ -193,17 +170,17 @@ "slug": "supabase-projects", "type": "cli-command" }, - { - "id": "supabase-projects-list", - "title": "supabase projects list", - "slug": "supabase-projects-list", - "type": "cli-command" - }, { "id": "supabase-projects-create", "title": "supabase projects create", "slug": "supabase-projects-create", "type": "cli-command" + }, + { + "id": "supabase-projects-list", + "title": "supabase projects list", + "slug": "supabase-projects-list", + "type": "cli-command" } ] }, @@ -233,18 +210,18 @@ "slug": "supabase-functions", "type": "cli-command" }, - { - "id": "supabase-functions-serve", - "title": "supabase functions serve", - "slug": "supabase-functions-serve", - "type": "cli-command" - }, { "id": "supabase-functions-new", "title": "supabase functions new", "slug": "supabase-functions-new", "type": "cli-command" }, + { + "id": "supabase-functions-serve", + "title": "supabase functions serve", + "slug": "supabase-functions-serve", + "type": "cli-command" + }, { "id": "supabase-functions-deploy", "title": "supabase functions deploy", @@ -259,6 +236,35 @@ } ] }, + { + "title": "secrets", + "items": [ + { + "id": "supabase-secrets", + "title": "supabase secrets", + "slug": "supabase-secrets", + "type": "cli-command" + }, + { + "id": "supabase-secrets-set", + "title": "supabase secrets set", + "slug": "supabase-secrets-set", + "type": "cli-command" + }, + { + "id": "supabase-secrets-list", + "title": "supabase secrets list", + "slug": "supabase-secrets-list", + "type": "cli-command" + }, + { + "id": "supabase-secrets-unset", + "title": "supabase secrets unset", + "slug": "supabase-secrets-unset", + "type": "cli-command" + } + ] + }, { "title": "Domains", "items": [ @@ -269,21 +275,9 @@ "type": "cli-command" }, { - "id": "supabase-domains-reverify", - "title": "supabase domains reverify", - "slug": "supabase-domains-reverify", - "type": "cli-command" - }, - { - "id": "supabase-domains-get", - "title": "supabase domains get", - "slug": "supabase-domains-get", - "type": "cli-command" - }, - { - "id": "supabase-domains-delete", - "title": "supabase domains delete", - "slug": "supabase-domains-delete", + "id": "supabase-domains-activate", + "title": "supabase domains activate", + "slug": "supabase-domains-activate", "type": "cli-command" }, { @@ -293,9 +287,21 @@ "type": "cli-command" }, { - "id": "supabase-domains-activate", - "title": "supabase domains activate", - "slug": "supabase-domains-activate", + "id": "supabase-domains-get", + "title": "supabase domains get", + "slug": "supabase-domains-get", + "type": "cli-command" + }, + { + "id": "supabase-domains-reverify", + "title": "supabase domains reverify", + "slug": "supabase-domains-reverify", + "type": "cli-command" + }, + { + "id": "supabase-domains-delete", + "title": "supabase domains delete", + "slug": "supabase-domains-delete", "type": "cli-command" } ] @@ -309,28 +315,51 @@ "slug": "supabase-vanity-subdomains", "type": "cli-command" }, - { - "id": "supabase-vanity-subdomains-check-availability", - "title": "supabase vanity-subdomains check-availability", - "slug": "supabase-vanity-subdomains-check-availability", - "type": "cli-command" - }, { "id": "supabase-vanity-subdomains-activate", "title": "supabase vanity-subdomains activate", "slug": "supabase-vanity-subdomains-activate", "type": "cli-command" }, + { + "id": "supabase-vanity-subdomains-get", + "title": "supabase vanity-subdomains get", + "slug": "supabase-vanity-subdomains-get", + "type": "cli-command" + }, + { + "id": "supabase-vanity-subdomains-check-availability", + "title": "supabase vanity-subdomains check-availability", + "slug": "supabase-vanity-subdomains-check-availability", + "type": "cli-command" + }, { "id": "supabase-vanity-subdomains-delete", "title": "supabase vanity-subdomains delete", "slug": "supabase-vanity-subdomains-delete", "type": "cli-command" + } + ] + }, + { + "title": "Network Bans", + "items": [ + { + "id": "supabase-network-bans", + "title": "supabase network-bans", + "slug": "supabase-network-bans", + "type": "cli-command" }, { - "id": "supabase-vanity-subdomains-get", - "title": "supabase vanity-subdomains get", - "slug": "supabase-vanity-subdomains-get", + "id": "supabase-network-bans-get", + "title": "supabase network-bans get", + "slug": "supabase-network-bans-get", + "type": "cli-command" + }, + { + "id": "supabase-network-bans-remove", + "title": "supabase network-bans remove", + "slug": "supabase-network-bans-remove", "type": "cli-command" } ] diff --git a/spec/common-client-libs-sections.json b/spec/common-client-libs-sections.json index f1afe0b46b5..d80a1e8b3fb 100644 --- a/spec/common-client-libs-sections.json +++ b/spec/common-client-libs-sections.json @@ -616,107 +616,103 @@ "product": "auth", "type": "function", "libs": ["js"] - } - ] - }, - { - "title": "Auth Admin", - "libs": ["js", "js_v1"], - "items": [ + }, { "id": "admin-api", - "title": "Overview", + "title": "Auth Admin", "slug": "admin-api", "libs": ["js", "js_v1"], - "type": "function" - }, - { - "id": "get-user-by-id", - "title": "Retrieve a user", - "slug": "auth-admin-getuserbyid", - "product": "auth-admin", "type": "function", - "libs": ["js"] - }, - { - "id": "list-users", - "title": "List all users", - "slug": "auth-admin-listusers", - "product": "auth-admin", - "type": "function", - "libs": ["js", "js_v1"] - }, - { - "id": "create-user", - "title": "Create a user", - "slug": "auth-admin-createuser", - "product": "auth-admin", - "type": "function", - "libs": ["js", "js_v1"] - }, - { - "id": "delete-user", - "title": "Delete a user", - "slug": "auth-admin-deleteuser", - "product": "auth-admin", - "type": "function", - "libs": ["js", "js_v1"] - }, - { - "id": "invite-user-by-email", - "title": "Send an email invite link", - "slug": "auth-admin-inviteuserbyemail", - "product": "auth-admin", - "type": "function", - "libs": ["js", "js_v1"] - }, - { - "id": "reset-password-for-email", - "title": "Send a password reset request", - "slug": "auth-admin-resetpasswordforemail", - "product": "auth-admin", - "type": "function", - "libs": ["js"] - }, - { - "id": "generate-link", - "title": "Generate an email link", - "slug": "auth-admin-generatelink", - "product": "auth-admin", - "type": "function", - "libs": ["js"] - }, - { - "id": "send-mobile-otp", - "title": "Send a one-time passcode", - "slug": "auth-api-sendmobileotp", - "product": "auth-server", - "type": "function", - "libs": ["js_v1"] - }, - { - "id": "update-user-by-id", - "title": "Update a user", - "slug": "auth-admin-updateuserbyid", - "product": "auth-admin", - "type": "function", - "libs": ["js", "js_v1"] - }, - { - "id": "mfa-list-factors", - "title": "List all factors for a user", - "slug": "auth-admin-mfa-listfactors", - "product": "auth-admin", - "type": "function", - "libs": ["js"] - }, - { - "id": "mfa-delete-factor", - "title": "Delete a factor for a user", - "slug": "auth-admin-mfa-deletefactor", - "product": "auth-admin", - "type": "function", - "libs": ["js"] + "items": [ + { + "id": "get-user-by-id", + "title": "Retrieve a user", + "slug": "auth-admin-getuserbyid", + "product": "auth-admin", + "type": "function", + "libs": ["js"] + }, + { + "id": "list-users", + "title": "List all users", + "slug": "auth-admin-listusers", + "product": "auth-admin", + "type": "function", + "libs": ["js", "js_v1"] + }, + { + "id": "create-user", + "title": "Create a user", + "slug": "auth-admin-createuser", + "product": "auth-admin", + "type": "function", + "libs": ["js", "js_v1"] + }, + { + "id": "delete-user", + "title": "Delete a user", + "slug": "auth-admin-deleteuser", + "product": "auth-admin", + "type": "function", + "libs": ["js", "js_v1"] + }, + { + "id": "invite-user-by-email", + "title": "Send an email invite link", + "slug": "auth-admin-inviteuserbyemail", + "product": "auth-admin", + "type": "function", + "libs": ["js", "js_v1"] + }, + { + "id": "reset-password-for-email", + "title": "Send a password reset request", + "slug": "auth-admin-resetpasswordforemail", + "product": "auth-admin", + "type": "function", + "libs": ["js"] + }, + { + "id": "generate-link", + "title": "Generate an email link", + "slug": "auth-admin-generatelink", + "product": "auth-admin", + "type": "function", + "libs": ["js"] + }, + { + "id": "send-mobile-otp", + "title": "Send a one-time passcode", + "slug": "auth-api-sendmobileotp", + "product": "auth-server", + "type": "function", + "libs": ["js_v1"] + }, + { + "id": "update-user-by-id", + "title": "Update a user", + "slug": "auth-admin-updateuserbyid", + "product": "auth-admin", + "type": "function", + "libs": ["js", "js_v1"] + }, + { + "id": "mfa-list-factors", + "title": "List all factors for a user", + "slug": "auth-admin-mfa-listfactors", + "product": "auth-admin", + "type": "function", + "libs": ["js"] + }, + { + "id": "mfa-delete-factor", + "title": "Delete a factor for a user", + "slug": "auth-admin-mfa-deletefactor", + "product": "auth-admin", + "type": "function", + "libs": ["js"] + } + ] } ] }, diff --git a/spec/common-self-hosting-storage-sections.json b/spec/common-self-hosting-storage-sections.json index 323772b2a6a..cdcd9bcf537 100644 --- a/spec/common-self-hosting-storage-sections.json +++ b/spec/common-self-hosting-storage-sections.json @@ -135,13 +135,6 @@ "summary": "Retrieve object info", "type": "operation" }, - { - "id": "retrieve-object-info", - "title": "Retrieve object info", - "slug": "retrieve-object-info", - "summary": "Retrieve object info", - "type": "operation" - }, { "id": "copies-an-object", "title": "Copies an object", diff --git a/spec/examples/examples.yml b/spec/examples/examples.yml index d2bc4403b6e..393fc81e279 100644 --- a/spec/examples/examples.yml +++ b/spec/examples/examples.yml @@ -114,13 +114,13 @@ functions: title: 'signUp()' $ref: '@supabase/gotrue-js.GoTrueClient.signUp' notes: | - - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/settings). + - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/providers). - **Confirm email** determines if users need to confirm their email address after signing up. - If **Confirm email** is enabled, a `user` is returned but `session` is null. - If **Confirm email** is disabled, both a `user` and a `session` are returned. - - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings). + - By default, when the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/url-configuration). - If signUp() is called for an existing confirmed user: - - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned. + - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/providers), an obfuscated/fake user object is returned. - If **Confirm email** is disabled, the error message, `User already registered` is returned. - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser). examples: @@ -192,7 +192,7 @@ functions: - This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number. - If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP. - If you're using phone, you can configure whether you want the user to receive a OTP. - - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings). + - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/url-configuration). examples: - id: sign-in-with-email. name: Sign in with email. @@ -236,7 +236,7 @@ functions: isSpotlight: false description: | When the third-party provider successfully authenticates the user, the provider will redirect the user to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). It does not redirect the user immediately after invoking this method. - You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings). + You can modify the `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/url-configuration). js: | ```js const { data, error } = await supabase.auth.signInWithOAuth({ @@ -334,7 +334,7 @@ functions: notes: | - In order to use the `updateUser()` method, the user needs to be signed in first. - By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). + To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/providers). examples: - id: update-the-email-for-an-authenticated-user name: Update the email for an authenticated user diff --git a/spec/supabase_dart_v0--old.yml b/spec/supabase_dart_v0--old.yml deleted file mode 100644 index 90dab81a758..00000000000 --- a/spec/supabase_dart_v0--old.yml +++ /dev/null @@ -1,2183 +0,0 @@ -openref: 0.1 - -info: - id: reference/dart - title: Getting started - description: | - - Supabase Dart. - - definition: ../../spec/enrichments/tsdoc_v1/combined.json - slugPrefix: '/' - specUrl: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v0.yml - libraries: - - name: 'Dart' - id: 'dart' - version: '0.0.1' - -pages: - Installing: - description: | - ## Dart - - Dart libraries are built and supported by the community. - - ```bash - dart pub add supabase - ``` - - Find the source code on [GitHub](https://github.com/supabase/supabase-dart). - - ## Flutter - - For Flutter project, you can use [supabase_flutter](https://github.com/supabase/supabase-flutter). - - ```bash - flutter pub add supabase_flutter - ``` - - `supabase_flutter` plugin uses `supabase` plugin internally, and it adds some Flutter specific functionality such as handling deeplinks coming back from magic link verifications. - If you are creating a Flutter application, we recommend using `supabase_flutter` instead of `supabase`. - - For the most part `supabase_flutter` shares the same API as `supabase` with few exceptions such as initialization or OAuth sign in. - - Initializing: - description: | - ## Dart - You can initialize a new Supabase client using the `SupabaseClient()` method. - - The Supabase client is your entrypoint to the rest of the Supabase functionality - and is the easiest way to interact with everything we offer within the Supabase ecosystem. - - - ## Flutter - - For `supabase_flutter`, you will be using the static `initialize()` method on `Supabase` class. - - examples: - - name: Dart SupabaseClient() - dart: | - ```dart - final supabase = SupabaseClient('https://xyzcompany.supabase.co', 'public-anon-key'); - ``` - - name: Flutter initialize() - dart: | - ```dart title="main.dart" - Future main() async { - await Supabase.initialize(url: 'https://xyzcompany.supabase.co', anonKey: 'public-anon-key'); - runApp(MyApp()); - } - ``` - - auth.signUp(): - description: | - Creates a new user. - notes: | - - By default, the user will need to verify their email address before logging in. If you would like to change this, you can disable "Email Confirmations" by going to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - - If "Email Confirmations" is turned on, a user is returned but session will be null - - If "Email Confirmations" is turned off, both a `user` and a `session` will be returned - - When the user confirms their email address, they will be redirected to localhost:3000 by default. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - examples: - - name: Sign up. - isSpotlight: true - dart: | - ```dart - final res = await supabase.auth.signUp('example@email.com', 'example-password'); - - final user = res.data?.user; - final error = res.error; - ``` - - name: Sign up with third-party providers. - hideCodeBlock: true - description: | - If you are using Flutter, you can sign up with OAuth providers using the [`signInWithProvider()`](/docs/reference/dart/v0/auth-signinwithprovider) method available on `supabase_flutter`. - - auth.signIn(): - description: | - Log in an existing user, or login via a third-party provider. - notes: | - - A user can sign up via email, phone number. - - If you provide `email` without a `password`, the user will be sent a magic link. - - The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - - Similarly, if you provide `phone` without a `password`, the user will be sent a one time password. - - If you are looking to sign users in with OAuth in Flutter apps, go to [`signInWithProvider()`](/docs/reference/dart/v0/auth-signinwithprovider). - examples: - - name: Sign in with email. - isSpotlight: true - dart: | - ```dart - final res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password'); - - final user = res.data?.user; - final error = res.error; - ``` - - name: Sign in with magic link. - description: If email is provided, but no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds. - dart: | - ```dart - final res = await supabase.auth.signIn(email: 'example@email.com'); - - final error = res.error; - ``` - - name: Get OAuth sign in URL. - description: | - Passing provider parameter to `signIn()` will return a URL to sign your user in via OAuth. - If you are looking to sign in a user via OAuth on Flutter app, go to [`signInWithProvider()`](/docs/reference/dart/v0/auth-signinwithprovider). - dart: | - ```dart - final res = await supabase.auth.signIn(provider: Provider.github); - - final url = res.data?.url; - final error = res.error; - ``` - auth.signInWithProvider(): - description: | - Signs the user in using third party OAuth providers. - notes: | - - `auth.signInWithProvider()` is only available on `supabase_flutter` - - It will open the browser to the relevant login page. - examples: - - name: Sign in with provider. - isSpotlight: true - dart: | - ```dart - final res = await supabase.auth.signInWithProvider(Provider.github); - - final error = res.error; - ``` - - name: With `redirectTo` - description: | - Specify the redirect link to bring back the user via deeplink. - Note that `redirectTo` should be null for Flutter Web. - dart: | - ```dart - final res = await supabase.auth.signInWithProvider( - Provider.github, - options: AuthOptions( - redirectTo: kIsWeb - ? null - : 'io.supabase.flutter://reset-callback/'), - ); - - final error = res.error; - ``` - - name: With scopes - description: | - If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. - You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. - dart: | - ```dart - const { user, session, error } = await supabase.auth.signIn({ - provider: 'github' - }, { - scopes: 'repo gist notifications' - }) - const oAuthToken = session.provider_token // use to access provider API - ``` - auth.signOut(): - description: | - Signs out the current user, if there is a logged in user. - examples: - - name: Sign out - isSpotlight: true - dart: | - ```dart - final res = await supabase.auth.signOut(); - - final error = res.error; - ``` - - auth.session(): - description: | - Returns the session data, if there is an active session. - examples: - - name: Get the session data - isSpotlight: true - dart: | - ```dart - final session = supabase.auth.session(); - ``` - - auth.user(): - description: | - Returns the user data, if there is a logged in user. - examples: - - name: Get the logged in user - isSpotlight: true - dart: | - ```dart - final user = supabase.auth.user(); - ``` - - auth.update(): - description: | - Updates user data, if there is a logged in user. - notes: | - It's generally better to store user data in a table inside your public schema (i.e. `public.users`). - Use the `update()` method if you have data which rarely changes or is specific only to the logged in user. - examples: - - name: Update a user's metadata. - isSpotlight: true - dart: | - ```dart - final res = await supabase.auth.update( - UserAttributes(data: {'hello': 'world'}) - ); - - final error = res.error; - ``` - - auth.onAuthStateChange(): - description: | - Receive a notification every time an auth event happens. - examples: - - name: Listen to auth changes - isSpotlight: true - dart: | - ```dart - final subscription = supabase.auth.onAuthStateChange((event, session) { - print(session?.user?.id); - // handle auth state change - }); - ``` - - Reset Password (Email): - description: | - Sends a reset request to an email address. - notes: | - Sends a reset request to an email address. - - When the user clicks the reset link in the email they will be forwarded to: - - `#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery` - - Your app must detect `type=recovery` in the fragment and display a password reset form to the user. - - You should then use the access_token in the url and new password to update the user as follows: - - ```dart - final res = await supabase.auth.api.updateUser( - accessToken, - UserAttributes(password: 'NEW_PASSWORD'), - ); - ``` - examples: - - name: Reset password - isSpotlight: true - dart: | - ```dart - final res = await supabase.auth.api.resetPasswordForEmail('user@example.com'); - - final error = res.error; - ``` - - name: Reset password for Flutter - isSpotlight: true - dart: | - You can pass `redirectTo` to open the app via deeplink when user opens the password reset email. - ```dart - final res = await supabase.auth.api.resetPasswordForEmail( - 'user@example.com', - options: AuthOptions(redirectTo: kIsWeb - ? null - : 'io.supabase.flutter://reset-callback/'), - ); - - final error = res.error; - ``` - invoke(): - title: 'invoke()' - description: | - Invokes a Supabase Function. See the [guide](/docs/guides/functions) for details on writing Functions. - notes: | - - Requires an Authorization header. - - Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. - examples: - - name: Basic invocation. - isSpotlight: true - dart: | - ```dart - final res = await supabaseClient.functions.invoke('hello', body: {'foo': 'baa'}); - final data = res.data; - final error = res.error; - ``` - - name: Specifying response type. - description: | - By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`. - isSpotlight: true - dart: | - ```dart - final res = await supabaseClient.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - responseType: ResponseType.text, - ); - final data = res.data; - final error = res.error; - ``` - - name: Parsing custom headers. - description: | - Any `headers` will be passed through to the function. A common pattern is to pass a logged-in user's JWT token as an Authorization header. - isSpotlight: true - dart: | - ```dart - final res = await supabaseClient.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - headers: { - 'Authorization': 'Bearer ${supabase.auth.session()?.access_token}' - }, - ); - ``` - select(): - description: | - Performs vertical filtering with SELECT. - title: 'Fetch data: select()' - notes: | - - By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. - - `select()` can be combined with [Modifiers](/docs/reference/dart/using-modifiers) - - `select()` can be combined with [Filters](/docs/reference/dart/using-filters) - - If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - examples: - - name: Getting your data - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select() - .execute(); - - final data = res.data; - final error = res.error; - ``` - - name: Selecting specific columns - description: You can select specific fields from your tables. - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name') - .execute(); - ``` - - name: Query foreign tables - description: If your database has relationships, you can query related tables too. - dart: | - ```dart - final res = await supabase - .from('countries') - .select(''' - name, - cities ( - name - ) - ''') - .execute(); - ``` - - name: Query the same foreign table multiple times - description: | - Sometimes you will need to query the same foreign table twice. - In this case, you can use the name of the joined column to identify - which join you intend to use. For convenience, you can also give an - alias for each column. For example, if we had a shop of products, - and we wanted to get the supplier and the purchaser at the same time - (both in the users) table: - dart: | - ```dart - final res = await supabase - .from('products') - .select(''' - id, - supplier:supplier_id ( name ), - purchaser:purchaser_id ( name ) - ''') - .execute(); - ``` - - name: Filtering with inner joins - description: | - If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted - to select all rows in a `message` table which belong to a user with the `username` "Jane": - dart: | - ```dart - final res = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane') - .execute(); - ``` - - name: Querying with count option - description: | - You can get the number of rows by using the count option. - Allowed values for count option are [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count). - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name') - .execute(count: CountOption.exact); - - final count = res.count; - ``` - - name: Querying JSON data - description: | - If you have data inside of a JSONB column, you can apply select - and query filters to the data values. Postgres offers a - [number of operators](https://www.postgresql.org/docs/current/functions-json.html) - for querying JSON data. Also see - [PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details. - dart: | - ```dart - final res = await supabase - .from('users') - .select(''' - id, name, - address->street - ''') - .eq('address->postcode', 90210) - .execute(); - ``` - - name: Return data as CSV - description: | - By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values. - dart: | - ```dart - final res = await supabase - .from('users') - .select() - .csv() - .execute(); - ``` - - insert(): - description: | - Performs an INSERT into the table. - title: 'Create data: insert()' - notes: | - - By default, every time you run `insert()`, the client library will make a `select` to return the full record. - This is convenient, but it can also cause problems if your Policies are not configured to allow the `select` operation. - If you are using Row Level Security and you are encountering problems, try setting the `returning` param to `minimal`. - examples: - - name: Create a record - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554} - ]).execute(); - ``` - - name: Bulk create - dart: | - ```dart - final res = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554}, - {'name': 'Rohan', 'country_id': 555}, - ]).execute(); - ``` - - update(): - description: | - Performs an UPDATE on the table. - title: 'Modify data: update()' - notes: | - - `update()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to update. - examples: - - name: Updating your data - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Middle Earth' }) - .match({ 'name': 'Auckland' }) - .execute(); - ``` - - name: Updating JSON data - description: | - Postgres offers a - [number of operators](https://www.postgresql.org/docs/current/functions-json.html) - for working with JSON data. Right now it is only possible to update an entire JSON document, - but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys. - dart: | - ```dart - final res = await supabase - .from('users') - .update({ - 'address': { - 'street': 'Melrose Place', - 'postcode': 90210 - } - }) - .eq('address->postcode', 90210) - .execute(); - ``` - - upsert(): - description: | - Performs an UPSERT into the table. - title: 'Upsert data: upsert()' - notes: | - - Primary keys should be included in the data payload in order for an update to work correctly. - - Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys. - examples: - - name: Upsert your data - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('messages') - .upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' }) - .execute(); - ``` - - name: Upserting into tables with constraints - description: | - Running the following will cause supabase to upsert data into the `users` table. - If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row - based on the column passed into `onConflict`. - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('users') - .upsert({ 'username': 'supabot' }, { 'onConflict': 'username' }) - .execute(); - ``` - - name: Return the exact number of rows - description: | - Allowed values for count option are `exact`, `planned` and `estimated`. - dart: | - ```dart - final res = await supabase - .from('users') - .upsert({ - 'id': 3, - 'message': 'foo', - 'username': 'supabot' - }) - .execute(count: CountOption.exact); - ``` - - delete(): - description: | - Performs a DELETE on the table. - title: 'Delete data: delete()' - notes: | - - `delete()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to delete. - examples: - - name: Delete records - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .match({ 'id': 666 }) - .execute(); - ``` - - rpc(): - title: 'Stored Procedures: rpc()' - description: | - You can call stored procedures as a "Remote Procedure Call". - - That's a fancy way of saying that you can put some logic into your database then call it from anywhere. - It's especially useful when the logic rarely changes - like password resets and updates. - examples: - - name: Call a stored procedure - isSpotlight: true - description: This is an example invoking a stored procedure. - dart: | - ```dart - final res = await supabase - .rpc('hello_world') - .execute(); - ``` - - name: With Parameters - dart: | - ```dart - final res = await supabase - .rpc('echo_city', params: { 'name': 'The Shire' }) - .execute(); - ``` - - name: With count option - description: | - You can specify a count option to get the row count along with your data. - Allowed values for count option are `exact`, `planned` and `estimated`. - dart: | - ```dart - final res = await supabase - .rpc('hello_world') - .execute(count: CountOption.exact); - ``` - - subscribe(): - description: | - Subscribe to realtime changes in your database. - title: 'on().subscribe()' - notes: | - - Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime). - - If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;` - examples: - - name: Listen to all database changes - isSpotlight: true - dart: | - ```dart - final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.all, (payload) { - // Handle realtime payload - }) - .subscribe(); - ``` - - name: Listening to a specific table - dart: | - ```dart - final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.all, (payload) { - // Handle realtime payload - }) - .subscribe(); - ``` - - name: Listening to inserts - dart: | - ```dart - final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.insert, (payload) { - // Handle realtime payload - }) - .subscribe(); - ``` - - name: Listening to updates - description: | - By default, Supabase will send only the updated record. If you want to receive the previous values as well you can - enable full replication for the table you are listening too: - - ```sql - alter table "your_table" replica identity full; - ``` - dart: | - ```dart - final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.update, (payload) { - // Handle realtime payload - }) - .subscribe(); - ``` - - name: Listening to deletes - description: | - By default, Supabase does not send deleted records. If you want to receive the deleted record you can - enable full replication for the table you are listening too: - - ```sql - alter table "your_table" replica identity full; - ``` - dart: | - ```dart - final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.delete, (payload) { - // Handle realtime payload - }) - .subscribe(); - ``` - - name: Listening to multiple events - description: You can chain listeners if you want to listen to multiple events for each table. - dart: | - ```dart - final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.insert, handleInsert) - .on(SupabaseEventTypes.delete, handleDelete) - .subscribe(); - ``` - - name: Listening to row level changes - description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - dart: | - ```dart - final mySubscription = supabase - .from('countries:id=eq.200') - .on(SupabaseEventTypes.update, handleRecordUpdated) - .subscribe(); - ``` - - removeSubscription(): - description: | - Removes an active subscription and returns the number of open connections. - title: 'removeSubscription()' - notes: | - - Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed. - examples: - - name: Remove a subscription - isSpotlight: true - dart: | - ```dart - supabase.removeSubscription(mySubscription); - ``` - - getSubscriptions(): - description: | - Returns an array of all your subscriptions. - title: 'getSubscriptions()' - examples: - - name: Get all subscriptions - isSpotlight: true - dart: | - ```dart - final subscriptions = supabase.getSubscriptions(); - ``` - - stream(): - description: | - Notifies of data at the queried table. - title: 'stream()' - notes: | - - `stream()` will emit the initial data as well as any further change on the database as `Stream` of `List>` by combining Postgrest and Realtime. - - Takes a list of primary key columns as its argument. - examples: - - name: Listening to a specific table - isSpotlight: true - dart: | - ```dart - supabase - .from('countries') - .stream(['id']) - .execute(); - ``` - - name: Listening to a specific rows within a table - description: | - You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - This syntax is the as how you can filter data in Realtime - dart: | - ```dart - supabase - .from('countries:id=eq.120') - .stream(['id']) - .execute(); - ``` - - name: With `order()` - dart: | - ```dart - supabase - .from('countries') - .stream(['id']) - .order('name', ascending: false) - .execute(); - ``` - - name: With `limit()` - dart: | - ```dart - supabase - .from('countries') - .stream(['id']) - .order('name', ascending: false) - .limit(10) - .execute(); - ``` - - storage.listBuckets(): - description: | - Retrieves the details of all Storage buckets within an existing product. - title: 'listBuckets()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.listBuckets' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - examples: - - name: List buckets - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .listBuckets() - ``` - - storage.getBucket(): - description: | - Retrieves the details of an existing Storage bucket. - title: 'getBucket()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.getBucket' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - examples: - - name: Get bucket - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .getBucket('avatars') - ``` - - storage.createBucket(): - description: | - Creates a new Storage bucket - title: 'createBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `insert` - - `objects` permissions: none - examples: - - name: Create bucket - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .createBucket('avatars'); - ``` - - storage.emptyBucket(): - description: | - Removes all objects inside a single bucket. - title: 'emptyBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: `select` and `delete` - examples: - - name: Empty bucket - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .emptyBucket('avatars'); - ``` - storage.updateBucket(): - description: | - Updates a new Storage bucket - title: 'updateBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `update` - - `objects` permissions: none - examples: - - name: Update bucket - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .updateBucket('avatars', { public: false }); - ``` - - storage.deleteBucket(): - description: | - Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket. - title: 'deleteBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` and `delete` - - `objects` permissions: none - examples: - - name: Delete bucket - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .deleteBucket('avatars'); - ``` - - storage.from.upload(): - description: | - Uploads a file to an existing bucket. - title: 'from.upload()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.upload' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` - examples: - - name: Upload file - isSpotlight: true - dart: | - ```dart - final avatarFile = File('path/to/file'); - final res = await supabase - .storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, fileOptions: FileOptions( - cacheControl: '3600', - upsert: false - )); - ``` - - storage.from.update(): - description: | - Replaces an existing file at the specified path with a new one. - title: 'from.update()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - examples: - - name: Update file - isSpotlight: true - dart: | - ```dart - final avatarFile = File('path/to/file'); - final res = await supabase - .storage - .from('avatars') - .update('public/avatar1.png', avatarFile, fileOptions: FileOptions( - cacheControl: '3600', - upsert: false - )); - ``` - - storage.from.move(): - description: | - Moves an existing file, optionally renaming it at the same time. - title: 'from.move()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - examples: - - name: Move file - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png'); - ``` - - storage.from.createSignedUrl(): - description: | - Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds. - title: 'from.createSignedUrl()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: Create Signed URL - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .from('avatars') - .createSignedUrl('avatar1.png', 60); - - final signedURL = res.data; - ``` - - storage.from.getPublicUrl(): - description: | - Retrieve URLs for assets in public buckets - title: 'from.getPublicUrl()' - notes: | - - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: none - examples: - - name: Returns the URL for an asset in a public bucket - isSpotlight: true - dart: | - ```dart - final res = supabase - .storage - .from('public-bucket') - .getPublicUrl('avatar1.png'); - - final publicURL = res.data; - ``` - - storage.from.download(): - description: | - Downloads a file. - title: 'from.download()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: Download file - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .from('avatars') - .download('avatar1.png'); - ``` - - storage.from.remove(): - description: | - Deletes files within the same bucket - title: 'from.remove()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `delete` and `select` - examples: - - name: Delete file - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .from('avatars') - .remove(['avatar1.png']); - ``` - - storage.from.list(): - description: | - Lists all the files within a bucket. - title: 'from.list()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: List files in a bucket - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .from('avatars') - .list(); - ``` - Using Modifiers: - description: | - Modifiers can be used on `select()` queries. - - If a Stored Procedure returns a table response, you can also apply modifiers to the `rpc()` function. - - limit(): - description: | - Limits the result with the specified count. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .execute(); - ``` - - name: With embedded resources - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .limit(1, foreignTable: 'cities' ) - .execute(); - ``` - - order(): - description: | - Orders the result with the specified column. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .order('id', ascending: false ) - .execute(); - ``` - - name: With embedded resources - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .order('name', foreignTable: 'cities') - .execute(); - ``` - - range(): - description: | - Limits the result to rows within the specified range, inclusive. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .range(0,3) - .execute(); - ``` - - single(): - description: | - Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .single() - .execute(); - ``` - - Using Filters: - description: | - Filters can be used on `select()`, `update()`, and `delete()` queries. - - If a Stored Procedure returns a table response, you can also apply filters. - - ### Applying Filters - - You must apply your filters to the end of your query. For example: - - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire') // Correct - .execute(); - - final res = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id') - .execute(); - ``` - - ### Chaining - - Filters can be chained together to produce advanced queries. For example: - - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000) - .execute(); - ``` - - .or(): - description: | - Finds all rows satisfying at least one of the filters. - notes: | - - `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .or('id.in.(6,7),arraycol.cs.{"a","b"}') // Use Postgres list () and 'in' for in_ filter. Array {} and 'cs' for contains. - .or('id.in.(${mylist.join(',')}),arraycol.cs.{${mylistArray.join(',')}}') // You can insert a Dart list for list or array column. - .or('id.in.(${mylist.join(',')}),rangecol.cs.(${mylistRange.join(',')}]') // You can insert a Dart list for list or range column. - ``` - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') - .execute(); - ``` - - name: Use `or` with `and` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)') - .execute(); - ``` - # TODO Not available at the moment, so would have to fix the bug on postgrest-dart first - # - name: Use `or` on foreign tables - # isSpotlight: true - # dart: | - # ```dart - # final res = await supabase - # .from('countries') - # .select('id, cities(*)') - # .or('name.eq.Wellington,name.eq.Paris', { foreignTable: "cities" }) - # ``` - - .not(): - description: | - Finds all rows which doesn't satisfy the filter. - notes: | - - `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .not('name','eq','Paris') - .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .not('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .not('id','in','(${mylist.join(',')})') // You can insert a Dart list array. - ``` - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .not('name', 'eq', 'Paris') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .not('name', 'eq', 'Paris') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities) - .not('name', 'eq', 'Paris') - .execute(); - ``` - - .match(): - description: | - Finds all rows whose columns match the specified `query` object. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); - ``` - - .eq(): - description: | - Finds all rows whose value on the stated `column` exactly matches the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .eq('name', 'San Francisco') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .eq('name', 'Mordor') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .eq('name', 'San Francisco') - .execute(); - ``` - - .neq(): - description: | - Finds all rows whose value on the stated `column` doesn't match the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .neq('name', 'San Francisco') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .neq('name', 'Mordor') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .neq('name', 'Lagos') - .execute(); - ``` - - .gt(): - description: | - Finds all rows whose value on the stated `column` is greater than the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gt('country_id', 250) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .gt('country_id', 250) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .gt('country_id', 250) - .execute(); - ``` - - .gte(): - description: | - Finds all rows whose value on the stated `column` is greater than or equal to the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gte('country_id', 250) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .gte('country_id', 250) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .gte('country_id', 250) - .execute(); - ``` - - .lt(): - description: | - Finds all rows whose value on the stated `column` is less than the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lt('country_id', 250) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .lt('country_id', 250) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .lt('country_id', 250) - .execute(); - ``` - - .lte(): - description: | - Finds all rows whose value on the stated `column` is less than or equal to the specified `value`. - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.lte' - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lte('country_id', 250) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .lte('country_id', 250) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .lte('country_id', 250) - .execute(); - ``` - - .like(): - description: | - Finds all rows whose value in the stated `column` matches the supplied `pattern` (case sensitive). - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.like' - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .like('name', '%la%') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .like('name', '%la%') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .like('name', '%la%') - .execute(); - ``` - - .ilike(): - description: | - Finds all rows whose value in the stated `column` matches the supplied `pattern` (case insensitive). - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .ilike('name', '%la%') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .ilike('name', '%la%') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .ilike('name', '%la%') - .execute(); - ``` - - .is_(): - description: | - A check for exact equality (null, true, false), finds all rows whose value on the stated `column` exactly match the specified `value`. - - `is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .is_('name', null) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .is_('name', null) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .is_('name', null) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .is_('name', null) - .execute(); - ``` - - .in_(): - description: | - Finds all rows whose value on the stated `column` is found on the specified `values`. - - `is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); - ``` - - .contains(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .contains('main_exports', ['oil']) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .contains('main_exports', ['oil']) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .contains('main_exports', ['oil']) - .execute(); - ``` - - .containedBy(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .containedBy('main_exports', ['orks', 'surveillance', 'evil']) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .containedBy('main_exports', ['cars', 'food', 'machine']) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .containedBy('main_exports', ['cars', 'food', 'machine']) - .execute(); - ``` - - .rangeLt(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLt('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .rangeLt('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .rangeLt('population_range_millions', '[150, 250]') - .execute(); - ``` - - .rangeGt(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGt('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .rangeGt('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .rangeGt('population_range_millions', '[150, 250]') - .execute(); - ``` - - .rangeGte(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGte('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .rangeGte('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .rangeGte('population_range_millions', '[150, 250]') - .execute(); - ``` - - .rangeLte(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeLte' - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLte('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .rangeLte('population_range_millions', '[150, 250]') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .rangeLte('population_range_millions', [150, 250]) - .execute(); - ``` - - .rangeAdjacent(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); - ``` - - .overlaps(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('countries') - .delete() - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_countries') - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); - ``` - - .textSearch(): - description: | - Finds all rows whose tsvector value on the stated `column` matches to_tsquery(query). - examples: - - name: Text search - dart: | - ```dart - final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - config: 'english' - ) - .execute(); - ``` - - name: Basic normalization - description: Uses PostgreSQL's `plainto_tsquery` function. - dart: | - ```dart - final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.plain, - config: 'english' - ) - .execute(); - ``` - - name: Full normalization - description: Uses PostgreSQL's `phraseto_tsquery` function. - dart: | - ```dart - final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.phrase, - config: 'english' - ) - .execute(); - ``` - - name: Full normalization - description: | - Uses PostgreSQL's `websearch_to_tsquery` function. - This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used - with advanced operators. - - - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. - - `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. - - `OR`: the word “or” will be converted to the | operator. - - `-`: a dash will be converted to the ! operator. - - dart: | - ```dart - final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat or cat'", - type: TextSearchType.websearch, - config: 'english' - ) - .execute(); - ``` - - .filter(): - description: | - Finds all rows whose `column` satisfies the filter. - notes: | - - `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work. - ```dart - .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} and 'cs' for contains. - .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .filter('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .filter('id','cs','{${mylist.join(',')}}') // You can insert a Dart array list. - ``` - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') - .execute(); - ``` - - name: With `update()` - dart: | - ```dart - final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .filter('name', 'in', '("Paris","Tokyo")') - .execute(); - ``` - - name: With `delete()` - dart: | - ```dart - final res = await supabase - .from('cities') - .delete() - .filter('name', 'in', '("Paris","Tokyo")') - .execute(); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final res = await supabase - .rpc('echo_all_cities') - .filter('name', 'in', '("Paris","Tokyo")') - ``` - - name: Filter embedded resources - dart: | - ```dart - final res = await supabase - .from('cities') - .select('name, countries ( name )') - .filter('countries.name', 'in', '("France","Japan")') - .execute(); - ``` diff --git a/spec/supabase_dart_v1--old.yml b/spec/supabase_dart_v1--old.yml deleted file mode 100644 index 6f3ef71a653..00000000000 --- a/spec/supabase_dart_v1--old.yml +++ /dev/null @@ -1,2280 +0,0 @@ -openref: 0.1 - -info: - id: reference/dart - title: Getting started - description: | - - Supabase Dart. - - definition: ../../spec/enrichments/tsdoc_v2/combined.json - slugPrefix: '/' - specUrl: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1.yml - libraries: - - name: 'Dart' - id: 'dart' - version: '0.0.1' - -pages: - auth.signUp(): - title: 'signUp()' - description: | - Creates a new user. - notes: | - - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/settings). - - **Confirm email** determines if users need to confirm their email address after signing up. - - If **Confirm email** is enabled, a `user` is returned but `session` is null. - - If **Confirm email** is disabled, both a `user` and a `session` are returned. - - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings). - - If signUp() is called for an existing confirmed user: - - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned. - - If **Confirm email** is disabled, the error message, `User already registered` is returned. - examples: - - name: Sign up. - isSpotlight: true - dart: | - ```dart - final AuthResponse res = await supabase.auth.signUp( - email: 'example@email.com', - password: 'example-password', - ); - final Session? session = res.session; - final User? user = res.user; - ``` - - name: Sign up with third-party providers. - hideCodeBlock: true - description: | - If you are using Flutter, you can sign up with OAuth providers using the [`signInWithOAuth()`](/docs/reference/dart/auth-signinwithoauth) method available on `supabase_flutter`. - - auth.signInWithPassword(): - title: 'signInWithPassword()' - description: | - Log in an existing user using email or phone number with password. - notes: | - - Requires either an email and password or a phone number and password. - examples: - - name: Sign in with email and password - isSpotlight: true - dart: | - ```dart - final AuthResponse res = await supabase.auth.signInWithPassword( - email: 'example@email.com', - password: 'example-password', - ); - final Session? session = res.session; - final User? user = res.user; - ``` - - name: Sign in with phone and password - dart: | - ```dart - final AuthResponse res = await supabase.auth.signInWithPassword( - phone: '+13334445555', - password: 'example-password', - ); - final Session? session = res.session; - final User? user = res.user; - ``` - auth.signInWithOtp(): - title: 'signInWithOtp()' - notes: | - - Requires either an email or phone number. - - This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number. - - If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP. - - If you're using phone, you can configure whether you want the user to receive a OTP. - - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings). - examples: - - name: Sign in with email. - isSpotlight: true - description: | - The user will be sent an email which contains either a magiclink or a OTP or both. By default, a given user can only request a OTP once every 60 seconds. - You can pass `emailRedirectTo` with dynamic link to bring the users back to your app after they click on the magic link. - dart: | - ```dart - await supabase.auth.signInWithOtp( - email: 'example@email.com', - emailRedirectTo: kIsWeb ? null : 'io.supabase.flutter://signin-callback/', - ); - ``` - - name: Sign in with SMS OTP. - description: The user will be sent a SMS which contains a OTP. By default, a given user can only request a OTP once every 60 seconds. - dart: | - ```dart - await supabase.auth.signInWithOtp( - phone: '+13334445555', - ); - ``` - auth.signInWithOAuth(): - title: 'signInWithOAuth()' - description: | - Signs the user in using third party OAuth providers. - notes: | - - This method is used for signing in using a third-party provider. - - Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers). - examples: - - name: Sign in using a third-party provider - isSpotlight: true - dart: | - ```dart - await supabase.auth.signInWithOAuth(Provider.github); - ``` - - name: With `redirectTo` - description: | - Specify the redirect link to bring back the user via deeplink. - Note that `redirectTo` should be null for Flutter Web. - dart: | - ```dart - await supabase.auth.signInWithOAuth( - Provider.github, - redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/', - ); - ``` - - name: With scopes - description: | - If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. - You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. - dart: | - ```dart - await supabase.auth.signInWithOAuth( - Provider.github, - scopes: 'repo gist notifications' - ); - ... - // after user comes back from signin flow - - final Session? session = supabase.auth.currentSession; - final String? oAuthToken = session?.providerToken; - ``` - auth.signOut(): - title: 'signOut()' - description: | - Signs out the current user, if there is a logged in user. - notes: | - - In order to use the `signOut()` method, the user needs to be signed in first. - examples: - - name: Sign out - isSpotlight: true - dart: | - ```dart - await supabase.auth.signOut(); - ``` - auth.verifyOtp(): - title: 'verifyOtp()' - notes: | - - The `verifyOtp` method takes in different verification types. If a phone number is used, the type can either be `sms` or `phone_change`. If an email address is used, the type can be one of the following: `signup`, `magiclink`, `recovery`, `invite` or `email_change`. - - The verification type used should be determined based on the corresponding auth method called before `verifyOtp` to sign up / sign-in a user. - examples: - - name: Verify Sms One-Time Password (OTP) - isSpotlight: true - dart: | - ```dart - final AuthResponse res = await supabase.auth.verifyOTP( - type: OtpType.sms, - token: '111111', - phone: '+13334445555', - ); - final Session? session = res.session; - final User? user = res.user; - ``` - - name: Verify Signup One-Time Password (OTP) - isSpotlight: false - dart: | - ```dart - final AuthResponse res = await supabase.auth.verifyOTP( - type: OtpType.signup, - token: token, - phone: '+13334445555', - ); - final Session? session = res.session; - final User? user = res.user; - ``` - auth.currentSession: - title: 'currentSession' - description: | - Returns the session data, if there is an active session. - examples: - - name: Get the session data - isSpotlight: true - dart: | - ```dart - final Session? session = supabase.auth.currentSession; - ``` - auth.currentUser: - title: 'currentUser' - description: | - Returns the user data, if there is a logged in user. - examples: - - name: Get the logged in user - isSpotlight: true - dart: | - ```dart - final User? user = supabase.auth.currentUser; - ``` - auth.updateUser(): - title: 'updateUser()' - description: | - Updates user data, if there is a logged in user. - notes: | - - In order to use the `updateUser()` method, the user needs to be signed in first. - - By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). - examples: - - name: Update the email for an authenticated user - description: Sends a "Confirm Email Change" email to the new email address. - isSpotlight: true - dart: | - ```dart - final UserResponse res = await supabase.auth.updateUser( - UserAttributes( - email: 'example@email.com', - ), - ); - final User? updatedUser = res.user; - ``` - - name: Update the password for an authenticated user - isSpotlight: false - dart: | - ```dart - final UserResponse res = await supabase.auth.updateUser( - UserAttributes( - password: 'new password', - ), - ); - final User? updatedUser = res.user; - ``` - - name: Update the user's metadata - isSpotlight: true - dart: | - ```dart - final UserResponse res = await supabase.auth.updateUser( - UserAttributes( - data: { 'hello': 'world' }, - ), - ); - final User? updatedUser = res.user; - ``` - auth.onAuthStateChange(): - title: 'onAuthStateChange()' - description: | - Receive a notification every time an auth event happens. - notes: | - - Types of auth events: `AuthChangeEvent.passwordRecovery`, `AuthChangeEvent.signedIn`, `AuthChangeEvent.signedOut`, `AuthChangeEvent.tokenRefreshed`, `AuthChangeEvent.userUpdated`and `AuthChangeEvent.userDeleted` - examples: - - name: Listen to auth changes - isSpotlight: true - dart: | - ```dart - final authSubscription = supabase.auth.onAuthStateChange.listen((data) { - final AuthChangeEvent event = data.event; - final Session? session = data.session; - }); - ``` - - name: Listen to a specific event - dart: | - ```dart - final authSubscription = supabase.auth.onAuthStateChange.listen((data) { - final AuthChangeEvent event = data.event; - if (event == AuthChangeEvent.signedIn) { - // handle signIn - } - }); - ``` - - name: Unsubscribe from auth subscription - dart: | - ```dart - final authSubscription = supabase.auth.onAuthStateChange((event, session) {}); - - authSubscription.cancel(); - ``` - auth.resetPasswordForEmail: - title: 'resetPasswordForEmail()' - description: | - Sends a reset request to an email address. - notes: | - Sends a password reset request to an email address. When the user clicks the reset link in the email they are redirected back to your application. Prompt the user for a new password and call auth.updateUser(): - - ```dart - await supabase.auth.resetPasswordForEmail( - 'sample@email.com', - redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/', - ); - ``` - examples: - - name: Reset password for Flutter - isSpotlight: true - dart: | - `redirectTo` is used to open the app via deeplink when user opens the password reset email. - ```dart - await supabase.auth.resetPasswordForEmail( - 'sample@email.com', - redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/', - ); - ``` - invoke(): - title: 'invoke()' - description: | - Invokes a Supabase Function. See the [guide](/docs/guides/functions) for details on writing Functions. - notes: | - - Requires an Authorization header. - - Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. - examples: - - name: Basic invocation. - isSpotlight: true - dart: | - ```dart - final res = await supabase.functions.invoke('hello', body: {'foo': 'baa'}); - final data = res.data; - ``` - - name: Specifying response type. - description: | - By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`. - isSpotlight: true - dart: | - ```dart - final res = await supabase.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - responseType: ResponseType.text, - ); - final data = res.data; - ``` - - name: Parsing custom headers. - description: | - Any `headers` will be passed through to the function. A common pattern is to pass a logged-in user's JWT token as an Authorization header. - isSpotlight: true - dart: | - ```dart - final res = await supabase.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - headers: { - 'Authorization': 'Bearer ${supabase.auth.currentSession?.accessToken}' - }, - ); - ``` - select(): - description: | - Performs vertical filtering with SELECT. - title: 'Fetch data: select()' - notes: | - - By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. - - `select()` can be combined with [Modifiers](/docs/reference/dart/using-modifiers) - - `select()` can be combined with [Filters](/docs/reference/dart/using-filters) - - If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - examples: - - name: Getting your data - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name'); - ``` - - name: Selecting specific columns - description: You can select specific fields from your tables. - dart: | - ```dart - final data = await supabase - .from('countries') - .select(''' - name, - cities ( - name - ) - '''); - ``` - - name: Query foreign tables - description: If your database has relationships, you can query related tables too. - dart: | - ```dart - final data = await supabase - .from('products') - .select(''' - id, - supplier:supplier_id ( name ), - purchaser:purchaser_id ( name ) - '''); - ``` - - name: Query the same foreign table multiple times - description: | - Sometimes you will need to query the same foreign table twice. - In this case, you can use the name of the joined column to identify - which join you intend to use. For convenience, you can also give an - alias for each column. For example, if we had a shop of products, - and we wanted to get the supplier and the purchaser at the same time - (both in the users) table: - dart: | - ```dart - final data = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane'); - ``` - - name: Filtering with inner joins - description: | - If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted - to select all rows in a `message` table which belong to a user with the `username` "Jane": - dart: | - ```dart - final data = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane'); - ``` - - name: Querying with count option - description: | - You can get the number of rows by using the count option. - Allowed values for count option are [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count). - dart: | - ```dart - final res = await supabase.from('cities').select( - 'name', - const FetchOptions( - count: CountOption.exact, - ), - ); - - final count = res.count; - ``` - - name: Querying JSON data - description: | - If you have data inside of a JSONB column, you can apply select - and query filters to the data values. Postgres offers a - [number of operators](https://www.postgresql.org/docs/current/functions-json.html) - for querying JSON data. Also see - [PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details. - dart: | - ```dart - final data = await supabase - .from('users') - .select(''' - id, name, - address->street - ''') - .eq('address->postcode', 90210); - ``` - - name: Return data as CSV - description: | - By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values. - dart: | - ```dart - final data = await supabase - .from('users') - .select() - .csv(); - ``` - - insert(): - description: | - Performs an INSERT into the table. - title: 'Create data: insert()' - examples: - - name: Create a record - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .insert({'name': 'The Shire', 'country_id': 554}); - ``` - - name: Bulk create - dart: | - ```dart - final res = await supabase.from('cities').insert([ - {'name': 'The Shire', 'country_id': 554}, - {'name': 'Rohan', 'country_id': 555}, - ]); - ``` - - update(): - description: | - Performs an UPDATE on the table. - title: 'Modify data: update()' - notes: | - - `update()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to update. - examples: - - name: Updating your data - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Middle Earth' }) - .match({ 'name': 'Auckland' }); - ``` - - name: Updating JSON data - description: | - Postgres offers a - [number of operators](https://www.postgresql.org/docs/current/functions-json.html) - for working with JSON data. Right now it is only possible to update an entire JSON document, - but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys. - dart: | - ```dart - final data = await supabase - .from('users') - .update({ - 'address': { - 'street': 'Melrose Place', - 'postcode': 90210 - } - }) - .eq('address->postcode', 90210); - ``` - - upsert(): - description: | - Performs an UPSERT into the table. - title: 'Upsert data: upsert()' - notes: | - - Primary keys should be included in the data payload in order for an update to work correctly. - - Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys. - examples: - - name: Upsert your data - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('messages') - .upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' }); - ``` - - name: Upserting into tables with constraints - description: | - Running the following will cause supabase to upsert data into the `users` table. - If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row - based on the column passed into `onConflict`. - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('users') - .upsert({ 'username': 'supabot' }, { 'onConflict': 'username' }); - ``` - - name: Return the exact number of rows - description: | - Allowed values for count option are `exact`, `planned` and `estimated`. - dart: | - ```dart - final res = await supabase.from('users').upsert( - {'id': 3, 'message': 'foo', 'username': 'supabot'}, - options: const FetchOptions(count: CountOption.exact), - ); - - final data = res.data; - final count = res.count; - ``` - - delete(): - description: | - Performs a DELETE on the table. - title: 'Delete data: delete()' - notes: | - - `delete()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to delete. - examples: - - name: Delete records - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .match({ 'id': 666 }); - ``` - - rpc(): - title: 'Stored Procedures: rpc()' - description: | - You can call stored procedures as a "Remote Procedure Call". - - That's a fancy way of saying that you can put some logic into your database then call it from anywhere. - It's especially useful when the logic rarely changes - like password resets and updates. - examples: - - name: Call a stored procedure - isSpotlight: true - description: This is an example invoking a stored procedure. - dart: | - ```dart - final data = await supabase - .rpc('hello_world'); - ``` - - name: With Parameters - dart: | - ```dart - final data = await supabase - .rpc('echo_city', params: { 'name': 'The Shire' }); - ``` - - subscribe(): - description: | - Subscribe to realtime changes in your database. - title: 'on().subscribe()' - notes: | - - Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime). - - If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;` - examples: - - name: Listen to all database changes - isSpotlight: true - dart: | - ```dart - supabase.channel('*').on( - RealtimeListenTypes.postgresChanges, - ChannelFilter(event: '*', schema: '*'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }, - ).subscribe(); - ``` - - name: Listening to a specific table - dart: | - ```dart - supabase.channel('public:countries').on( - RealtimeListenTypes.postgresChanges, - ChannelFilter(event: '*', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }, - ).subscribe(); - ``` - - name: Listening to inserts - dart: | - ```dart - supabase.channel('public:countries').on( - RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'INSERT', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }, - ).subscribe(); - ``` - - name: Listening to updates - description: | - By default, Supabase will send only the updated record. If you want to receive the previous values as well you can - enable full replication for the table you are listening too: - - ```sql - alter table "your_table" replica identity full; - ``` - dart: | - ```dart - supabase.channel('public:countries').on( - RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'UPDATE', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }, - ).subscribe(); - ``` - - name: Listening to deletes - description: | - By default, Supabase does not send deleted records. If you want to receive the deleted record you can - enable full replication for the table you are listening too: - - ```sql - alter table "your_table" replica identity full; - ``` - dart: | - ```dart - supabase.channel('public:countries').on( - RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'DELETE', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }, - ).subscribe(); - ``` - - name: Listening to multiple events - description: You can chain listeners if you want to listen to multiple events for each table. - dart: | - ```dart - supabase.channel('public:countries').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'INSERT', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }).on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'DELETE', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }).subscribe(); - ``` - - name: Listening to row level changes - description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - dart: | - ```dart - supabase.channel('public:countries:id=eq.200').on( - RealtimeListenTypes.postgresChanges, - ChannelFilter( - event: 'UPDATE', - schema: 'public', - table: 'countries', - filter: 'id=eq.200', - ), (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }).subscribe(); - ``` - - removeChannel(): - description: | - Unsubscribes and removes Realtime channel from Realtime client. - title: 'removeChannel()' - notes: | - - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - examples: - - name: Remove a channel - isSpotlight: true - dart: | - ```dart - final status = await supabase.removeChannel(channel); - ``` - - removeAllChannels(): - description: | - Unsubscribes and removes all Realtime channels from Realtime client. - title: 'removeAllChannels()' - notes: | - - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - examples: - - name: Remove all channels - isSpotlight: true - dart: | - ```dart - final statuses = await supabase.removeAllChannels(); - ``` - - getChannels(): - description: | - Returns all Realtime channels. - title: 'getChannels()' - examples: - - name: Get all channels - isSpotlight: true - dart: | - ```dart - final channels = supabase.getChannels(); - ``` - - stream(): - description: | - Notifies of data at the queried table. - title: 'stream()' - notes: | - - `stream()` will emit the initial data as well as any further change on the database as `Stream` of `List>` by combining Postgrest and Realtime. - - Takes a list of primary key columns as its argument. - examples: - - name: Listening to a specific table - isSpotlight: true - dart: | - ```dart - supabase.from('countries') - .stream(primaryKey: ['id']) - .listen((List> data) { - // Do something awesome with the data - }); - ``` - - name: Listening to a specific rows within a table - description: | - You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - This syntax is the as how you can filter data in Realtime - dart: | - ```dart - supabase.from('countries') - .stream(primaryKey: ['id']) - .eq('id', '120') - .listen((List> data) { - // Do something awesome with the data - }); - ``` - - name: With `order()` - dart: | - ```dart - supabase.from('countries') - .stream(primaryKey: ['id']) - .order('name', ascending: true) - .listen((List> data) { - // Do something awesome with the data - }); - ``` - - name: With `limit()` - dart: | - ```dart - supabase.from('countries') - .stream(primaryKey: ['id']) - .order('name', ascending: true) - .limit(10) - .listen((List> data) { - // Do something awesome with the data - }); - ``` - - name: Using `stream()` with `StreamBuilder` - description: | - When using `stream()` with a `StreamBuilder` within your Flutter application, make sure to store your stream in a variable to prevent refetching upon rebuilding. - dart: | - ```dart - final supabase = Supabase.instance.client; - - class MyWidget extends StatefulWidget { - const MyWidget({Key? key}) : super(key: key); - - @override - State createState() => _MyWidgetState(); - } - - class _MyWidgetState extends State { - // Persist the stream in a local variable to prevent refetching upon rebuilds - final _stream = supabase.from('countries').stream(primaryKey: ['id']); - - @override - Widget build(BuildContext context) { - return StreamBuilder( - stream: _stream, - builder: (context, snapshot) { - // Return your widget with the data from the snapshot - }, - ); - } - } - ``` - - storage.listBuckets(): - description: | - Retrieves the details of all Storage buckets within an existing product. - title: 'listBuckets()' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - examples: - - name: List buckets - isSpotlight: true - dart: | - ```dart - final List buckets = await supabase - .storage - .listBuckets(); - ``` - - storage.getBucket(): - description: | - Retrieves the details of an existing Storage bucket. - title: 'getBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - examples: - - name: Get bucket - isSpotlight: true - dart: | - ```dart - final Bucket bucket = await supabase - .storage - .getBucket('avatars'); - ``` - - storage.createBucket(): - description: | - Creates a new Storage bucket - title: 'createBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `insert` - - `objects` permissions: none - examples: - - name: Create bucket - isSpotlight: true - dart: | - ```dart - final String bucketId = await supabase - .storage - .createBucket('avatars'); - ``` - - storage.emptyBucket(): - description: | - Removes all objects inside a single bucket. - title: 'emptyBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: `select` and `delete` - examples: - - name: Empty bucket - isSpotlight: true - dart: | - ```dart - final String result = await supabase - .storage - .emptyBucket('avatars'); - ``` - storage.updateBucket(): - description: | - Updates a new Storage bucket - title: 'updateBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `update` - - `objects` permissions: none - examples: - - name: Update bucket - isSpotlight: true - dart: | - ```dart - final res = await supabase - .storage - .updateBucket('avatars', const BucketOptions(public: false)); - ``` - - storage.deleteBucket(): - description: | - Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket. - title: 'deleteBucket()' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` and `delete` - - `objects` permissions: none - examples: - - name: Delete bucket - isSpotlight: true - dart: | - ```dart - final String result = await supabase - .storage - .deleteBucket('avatars'); - ``` - - storage.from.upload(): - description: | - Uploads a file to an existing bucket. - title: 'from.upload()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` - examples: - - name: Upload file - isSpotlight: true - dart: | - ```dart - final avatarFile = File('path/to/file'); - final String path = await supabase.storage.from('avatars').upload( - 'public/avatar1.png', - avatarFile, - fileOptions: const FileOptions(cacheControl: '3600', upsert: false), - ); - ``` - - storage.from.update(): - description: | - Replaces an existing file at the specified path with a new one. - title: 'from.update()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - examples: - - name: Update file - isSpotlight: true - dart: | - ```dart - final avatarFile = File('path/to/local/file'); - final String path = await supabase.storage.from('avatars').update( - 'public/avatar1.png', - avatarFile, - fileOptions: const FileOptions(cacheControl: '3600', upsert: false), - ); - ``` - - storage.from.move(): - description: | - Moves an existing file, optionally renaming it at the same time. - title: 'from.move()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - examples: - - name: Move file - isSpotlight: true - dart: | - ```dart - final String result = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png'); - ``` - - storage.from.createSignedUrl(): - description: | - Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds. - title: 'from.createSignedUrl()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: Create Signed URL - isSpotlight: true - dart: | - ```dart - final String signedUrl = await supabase - .storage - .from('avatars') - .createSignedUrl('avatar1.png', 60); - ``` - - storage.from.createSignedUrls(): - title: 'from.createSignedUrls()' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Create Signed URLs - isSpotlight: true - dart: | - ```dart - final List signedUrls = await supabase - .storage - .from('avatars') - .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60); - ``` - - storage.from.getPublicUrl(): - description: | - Retrieve URLs for assets in public buckets - title: 'from.getPublicUrl()' - notes: | - - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: none - examples: - - name: Returns the URL for an asset in a public bucket - isSpotlight: true - dart: | - ```dart - final String publicUrl = supabase - .storage - .from('public-bucket') - .getPublicUrl('avatar1.png'); - ``` - - storage.from.download(): - description: | - Downloads a file. - title: 'from.download()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: Download file - isSpotlight: true - dart: | - ```dart - final Uint8List file = await supabase - .storage - .from('avatars') - .download('avatar1.png'); - ``` - - storage.from.remove(): - description: | - Deletes files within the same bucket - title: 'from.remove()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `delete` and `select` - examples: - - name: Delete file - isSpotlight: true - dart: | - ```dart - final List objects = await supabase - .storage - .from('avatars') - .remove(['avatar1.png']); - ``` - - storage.from.list(): - description: | - Lists all the files within a bucket. - title: 'from.list()' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: List files in a bucket - isSpotlight: true - dart: | - ```dart - final List objects = await supabase - .storage - .from('avatars') - .list(); - ``` - Using Modifiers: - description: | - Filters work on the row level—they allow you to return rows that - only match certain conditions without changing the shape of the rows. - Modifiers are everything that don't fit that definition—allowing you to - change the format of the response (e.g., returning a CSV string). - - Modifiers must be specified after filters. Some modifiers only apply for - queries that return rows (e.g., `select()` or `rpc()` on a function that - returns a table response). - - limit(): - description: | - Limits the result with the specified count. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .limit(1); - ``` - - name: With embedded resources - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .limit(1, foreignTable: 'cities' ); - ``` - - order(): - description: | - Orders the result with the specified column. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .order('id', ascending: false ); - ``` - - name: With embedded resources - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .order('name', foreignTable: 'cities'); - ``` - - range(): - description: | - Limits the result to rows within the specified range, inclusive. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .range(0,3); - ``` - - single(): - description: | - Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .single(); - ``` - - Using Filters: - description: | - Filters allow you to only return rows that match certain conditions. - - Filters can be used on `select()`, `update()`, and `delete()` queries. - - If a Database function returns a table response, you can also apply filters. - - ### Applying Filters - - Filters must be applied after any of `select()`, `update()`, `upsert()`, - `delete()`, and `rpc()` and before - [modifiers](/docs/reference/dart/using-modifiers). - - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire'); // Correct - - final data = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id'); - ``` - - ### Chaining - - Filters can be chained together to produce advanced queries. For example, - to query cities with population between 1,000 and 10,000: - - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000); - ``` - - ### Conditional Chaining - - Filters can be built up one step at a time and then executed. For example: - - ```dart - final filterByName = null; - final filterPopLow = 1000; - final filterPopHigh = 10000; - - var query = supabase - .from('cities') - .select('name, country_id'); - - if (filterByName != null) { query = query.eq('name', filterByName); } - if (filterPopLow != null) { query = query.gte('population', filterPopLow); } - if (filterPopHigh != null) { query = query.lt('population', filterPopHigh); } - - final data = await query; - ``` - - ### Filter by values within a JSON column - - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210 }'), - (2, 'Jane', null); - ``` - - - - - ```dart - final data = await supabase - .from('users') - .select() - .eq('address->postcode', 90210); - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Michael", - "address": { - "postcode": 90210 - } - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - ### Filter Foreign Tables - - You can filter on foreign tables in your `select()` query using dot - notation: - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```dart - final data = await supabase - .from('countries') - .select(''' - name, - cities!inner ( - name - ) - ''') - .eq('cities.name', 'Bali'); - ``` - - - - - ```json - { - "data": [ - { - "name": "Indonesia", - "cities": [ - { - "name": "Bali" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - .or(): - description: | - Finds all rows satisfying at least one of the filters. - notes: | - - `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .or('id.in.(6,7),arraycol.cs.{"a","b"}') // Use Postgres list () and 'in' for in_ filter. Array {} and 'cs' for contains. - .or('id.in.(${mylist.join(',')}),arraycol.cs.{${mylistArray.join(',')}}') // You can insert a Dart list for list or array column. - .or('id.in.(${mylist.join(',')}),rangecol.cs.(${mylistRange.join(',')}]') // You can insert a Dart list for list or range column. - ``` - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30'); - ``` - - name: Use `or` with `and` - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)'); - ``` - - .not(): - description: | - Finds all rows which doesn't satisfy the filter. - notes: | - - `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .not('name','eq','Paris') - .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .not('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .not('id','in','(${mylist.join(',')})') // You can insert a Dart list array. - ``` - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .not('name', 'eq', 'Paris'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .not('name', 'eq', 'Paris'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities) - .not('name', 'eq', 'Paris'); - ``` - - .match(): - description: | - Finds all rows whose columns match the specified `query` object. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .match({'name': 'Beijing', 'country_id': 156}); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .match({'name': 'Beijing', 'country_id': 156}); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .match({'name': 'Beijing', 'country_id': 156}); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .match({'name': 'Beijing', 'country_id': 156}); - ``` - - .eq(): - description: | - Finds all rows whose value on the stated `column` exactly matches the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .eq('name', 'San Francisco'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .eq('name', 'Mordor'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .eq('name', 'San Francisco'); - ``` - - .neq(): - description: | - Finds all rows whose value on the stated `column` doesn't match the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .neq('name', 'San Francisco'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .neq('name', 'Mordor'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .neq('name', 'Lagos'); - ``` - - .gt(): - description: | - Finds all rows whose value on the stated `column` is greater than the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gt('country_id', 250); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .gt('country_id', 250); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .gt('country_id', 250); - ``` - - .gte(): - description: | - Finds all rows whose value on the stated `column` is greater than or equal to the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gte('country_id', 250); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .gte('country_id', 250); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .gte('country_id', 250); - ``` - - .lt(): - description: | - Finds all rows whose value on the stated `column` is less than the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lt('country_id', 250); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .lt('country_id', 250); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .lt('country_id', 250); - ``` - - .lte(): - description: | - Finds all rows whose value on the stated `column` is less than or equal to the specified `value`. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lte('country_id', 250); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .lte('country_id', 250); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .lte('country_id', 250); - ``` - - .like(): - description: | - Finds all rows whose value in the stated `column` matches the supplied `pattern` (case sensitive). - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .like('name', '%la%'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .like('name', '%la%'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .like('name', '%la%'); - ``` - - .ilike(): - description: | - Finds all rows whose value in the stated `column` matches the supplied `pattern` (case insensitive). - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .ilike('name', '%la%'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .ilike('name', '%la%'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .ilike('name', '%la%'); - ``` - - .is_(): - description: | - A check for exact equality (null, true, false), finds all rows whose value on the stated `column` exactly match the specified `value`. - - `is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .is_('name', null); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .is_('name', null); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .is_('name', null); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .is_('name', null); - ``` - - .in_(): - description: | - Finds all rows whose value on the stated `column` is found on the specified `values`. - - `is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .in_('name', ['Rio de Janeiro', 'San Francisco']); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .in_('name', ['Rio de Janeiro', 'San Francisco']); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .in_('name', ['Rio de Janeiro', 'San Francisco']); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .in_('name', ['Rio de Janeiro', 'San Francisco']); - ``` - - .contains(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .contains('main_exports', ['oil']); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .contains('main_exports', ['oil']); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .contains('main_exports', ['oil']); - ``` - - .containedBy(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .containedBy('main_exports', ['orks', 'surveillance', 'evil']); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .containedBy('main_exports', ['cars', 'food', 'machine']); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .containedBy('main_exports', ['cars', 'food', 'machine']); - ``` - - .rangeLt(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLt('population_range_millions', '[150, 250]'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .rangeLt('population_range_millions', '[150, 250]'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .rangeLt('population_range_millions', '[150, 250]'); - ``` - - .rangeGt(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGt('population_range_millions', '[150, 250]'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .rangeGt('population_range_millions', '[150, 250]'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .rangeGt('population_range_millions', '[150, 250]'); - ``` - - .rangeGte(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGte('population_range_millions', '[150, 250]'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .rangeGte('population_range_millions', '[150, 250]'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .rangeGte('population_range_millions', '[150, 250]'); - ``` - - .rangeLte(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLte('population_range_millions', '[150, 250]'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .rangeLte('population_range_millions', '[150, 250]'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .rangeLte('population_range_millions', [150, 250]); - ``` - - .rangeAdjacent(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeAdjacent('population_range_millions', '[70, 185]'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .rangeAdjacent('population_range_millions', '[70, 185]'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .rangeAdjacent('population_range_millions', '[70, 185]'); - ``` - - .overlaps(): - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .overlaps('main_exports', ['computers', 'minerals']); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('countries') - .delete() - .overlaps('main_exports', ['computers', 'minerals']); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_countries') - .overlaps('main_exports', ['computers', 'minerals']); - ``` - - .textSearch(): - description: | - Finds all rows whose tsvector value on the stated `column` matches to_tsquery(query). - examples: - - name: Text search - dart: | - ```dart - final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - config: 'english' - ); - ``` - - name: Basic normalization - description: Uses PostgreSQL's `plainto_tsquery` function. - dart: | - ```dart - final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.plain, - config: 'english' - ); - ``` - - name: Full normalization - description: Uses PostgreSQL's `phraseto_tsquery` function. - dart: | - ```dart - final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.phrase, - config: 'english' - ); - ``` - - name: Full normalization - description: | - Uses PostgreSQL's `websearch_to_tsquery` function. - This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used - with advanced operators. - - - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. - - `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. - - `OR`: the word “or” will be converted to the | operator. - - `-`: a dash will be converted to the ! operator. - - dart: | - ```dart - final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat or cat'", - type: TextSearchType.websearch, - config: 'english' - ); - ``` - - .filter(): - description: | - Finds all rows whose `column` satisfies the filter. - notes: | - - `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work. - ```dart - .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} and 'cs' for contains. - .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .filter('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .filter('id','cs','{${mylist.join(',')}}') // You can insert a Dart array list. - ``` - examples: - - name: With `select()` - isSpotlight: true - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")'); - ``` - - name: With `update()` - dart: | - ```dart - final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .filter('name', 'in', '("Paris","Tokyo")'); - ``` - - name: With `delete()` - dart: | - ```dart - final data = await supabase - .from('cities') - .delete() - .filter('name', 'in', '("Paris","Tokyo")'); - ``` - - name: With `rpc()` - dart: | - ```dart - // Only valid if the Stored Procedure returns a table type. - final data = await supabase - .rpc('echo_all_cities') - .filter('name', 'in', '("Paris","Tokyo")'); - ``` - - name: Filter embedded resources - dart: | - ```dart - final data = await supabase - .from('cities') - .select('name, countries ( name )') - .filter('countries.name', 'in', '("France","Japan")'); - ``` diff --git a/spec/supabase_dart_v1.yml b/spec/supabase_dart_v1.yml index 073ec4d6f10..9c61cc1ee20 100644 --- a/spec/supabase_dart_v1.yml +++ b/spec/supabase_dart_v1.yml @@ -21,13 +21,13 @@ functions: description: | Creates a new user. notes: | - - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/settings). + - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/providers). - **Confirm email** determines if users need to confirm their email address after signing up. - If **Confirm email** is enabled, a `user` is returned but `session` is null. - If **Confirm email** is disabled, both a `user` and a `session` are returned. - - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings). + - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/url-configuration). - If signUp() is called for an existing confirmed user: - - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned. + - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/providers), an obfuscated/fake user object is returned. - If **Confirm email** is disabled, the error message, `User already registered` is returned. examples: - id: sign-up @@ -85,7 +85,7 @@ functions: - This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number. - If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP. - If you're using phone, you can configure whether you want the user to receive a OTP. - - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings). + - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/url-configuration). examples: - id: sign-in-with-email name: Sign in with email. @@ -229,7 +229,7 @@ functions: notes: | - In order to use the `updateUser()` method, the user needs to be signed in first. - By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). + To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/providers). examples: - id: update-the-email-for-an-authenticated-user name: Update the email for an authenticated user diff --git a/spec/supabase_js_v1--old.yml b/spec/supabase_js_v1--old.yml deleted file mode 100644 index 0daa83daa92..00000000000 --- a/spec/supabase_js_v1--old.yml +++ /dev/null @@ -1,2533 +0,0 @@ -openref: 0.1 - -info: - id: reference/supabase-js - title: Supabase Client - description: | - - Supabase JavaScript. - - definition: ../../spec/enrichments/tsdoc_v1/combined.json - specUrl: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1.yml - slugPrefix: '/' - libraries: - - name: 'JavaScript' - id: 'js' - version: '0.0.1' - -pages: - auth.signUp(): - title: 'signUp()' - $ref: '@supabase/gotrue-js.GoTrueClient.signUp' - notes: | - - By default, the user will need to verify their email address before logging in. If you would like to change this, you can disable "Email Confirmations" by going to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - - If "Email Confirmations" is turned on, a `user` is returned but `session` will be null - - If "Email Confirmations" is turned off, both a `user` and a `session` will be returned - - When the user confirms their email address, they will be redirected to localhost:3000 by default. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - - If signUp() is called for an existing confirmed user: - - If "Enable email confirmations" is enabled on the "Authentication" -> "Settings" page, an obfuscated / fake user object will be returned. - - If "Enable email confirmations" is disabled, an error with a message "User already registered" will be returned. - - To check if a user already exists, refer to getUser(). - examples: - - name: Sign up. - isSpotlight: true - js: | - ```js - const { user, session, error } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', - }) - ``` - - name: Sign up with additional user meta data. - isSpotlight: true - js: | - ```js - const { user, session, error } = await supabase.auth.signUp( - { - email: 'example@email.com', - password: 'example-password', - }, - { - data: { - first_name: 'John', - age: 27, - } - } - ) - ``` - - name: Sign up with third-party providers. - hideCodeBlock: true - description: | - You can sign up with OAuth providers using the [`signIn()`](/docs/reference/javascript/v1/auth-signin#sign-in-using-third-party-providers) method. - - name: Sign up with Phone. - description: | - Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/v1/auth-signin#sign-in-using-phone) method. - js: | - ```js - const { user, session, error } = await supabase.auth.signUp({ - phone: '+13334445555', - password: 'some-password', - }) - - // After receiving an SMS with One Time Password. - let { session, error } = await supabase.auth.verifyOTP({ - phone: '+13334445555', - token: '123456', - }) - ``` - - auth.signIn(): - title: 'signIn()' - $ref: '@supabase/gotrue-js.GoTrueClient.signIn' - notes: | - - A user can sign up either via email or OAuth. - - If you provide `email` without a `password`, the user will be sent a magic link. - - The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - - Specifying a `provider` will open the browser to the relevant login page. - examples: - - name: Sign in with email. - isSpotlight: true - js: | - ```js - const { user, session, error } = await supabase.auth.signIn({ - email: 'example@email.com', - password: 'example-password', - }) - ``` - - name: Sign in with magic link. - description: If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds. - js: | - ```js - const { user, session, error } = await supabase.auth.signIn({ - email: 'example@email.com' - }) - ``` - - name: Sign in using third-party providers. - description: Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers). - js: | - ```js - const { user, session, error } = await supabase.auth.signIn({ - // provider can be 'github', 'google', 'gitlab', and more - provider: 'github' - }) - ``` - - name: Sign in with Phone. - description: Supabase supports Phone Auth. - js: | - ```js - const { user, session, error } = await supabase.auth.signIn({ - phone: '+13334445555', - password: 'some-password', - }) - ``` - - name: Sign in with redirect. - description: | - Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by - the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template). - - Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for - any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]). - js: | - ```js - const { user, session, error } = await supabase.auth.signIn({ - provider: 'github' - }, { - redirectTo: 'https://example.com/welcome' - }) - ``` - - name: Sign in with scopes. - description: | - If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. - You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. - js: | - ```js - const { user, session, error } = await supabase.auth.signIn({ - provider: 'github' - }, { - scopes: 'repo gist notifications' - }) - const oAuthToken = session.provider_token // use to access provider API - ``` - - name: Sign in using a refresh token (e.g. in React Native). - description: | - If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session. - js: | - ```js - // An example using Expo's `AuthSession` - const redirectUri = AuthSession.makeRedirectUri({ useProxy: false }); - const provider = 'google'; - - AuthSession.startAsync({ - authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`, - returnUrl: redirectUri, - }).then(async (response: any) => { - if (!response) return; - const { user, session, error } = await supabase.auth.signIn({ - refreshToken: response.params?.refresh_token, - }); - }); - ``` - - auth.signOut(): - title: 'signOut()' - $ref: '@supabase/gotrue-js.GoTrueClient.signOut' - examples: - - name: Sign out - isSpotlight: true - js: | - ```js - const { error } = await supabase.auth.signOut() - ``` - - auth.session(): - title: 'session()' - $ref: '@supabase/gotrue-js.GoTrueClient.session' - examples: - - name: Get the session data - isSpotlight: true - js: | - ```js - const session = supabase.auth.session() - ``` - - auth.user(): - title: 'user()' - $ref: '@supabase/gotrue-js.GoTrueClient.user' - notes: | - This method gets the user object from memory. - examples: - - name: Get the logged in user - isSpotlight: true - js: | - ```js - const user = supabase.auth.user() - ``` - - auth.update(): - title: 'update()' - $ref: '@supabase/gotrue-js.GoTrueClient.update' - notes: | - User email: By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). - - User metadata: It's generally better to store user data in a table within your public schema (i.e., `public.users`). - Use the `update()` method if you have data which rarely changes or is specific only to the logged in user. - examples: - - name: Update the email for an authenticated user - description: Sends a "Confirm Email Change" email to the new email address. - isSpotlight: true - js: | - ```js - const { user, error } = await supabase.auth.update({email: 'new@email.com'}) - ``` - - name: Update the password for an authenticated user - isSpotlight: true - js: | - ```js - const { user, error } = await supabase.auth.update({password: 'new password'}) - ``` - - name: Update the user's metadata - isSpotlight: true - js: | - ```js - const { user, error } = await supabase.auth.update({ - data: { hello: 'world' } - }) - ``` - - auth.setAuth(): - title: 'setAuth()' - $ref: '@supabase/gotrue-js.GoTrueClient.setAuth' - examples: - - name: Basic example. - description: This is most useful on server-side functions where you cannot log the user in, but have access to the user's access token. - isSpotlight: true - js: | - ```js - function apiFunction(req, res) { - // Assuming the access token was sent as a header "X-Supabase-Auth" - const { access_token } = req.get('X-Supabase-Auth') - - // You can now use it within a Supabase Client - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key") - const { user, error } = supabase.auth.setAuth(access_token) - - // This client will now send requests as this user - const { data } = await supabase.from('your_table').select() - } - ``` - - name: With Express. - isSpotlight: true - js: | - ```js - - /** - * Make a request from the client to your server function - */ - async function makeApiRequest() { - const token = newClient.session()?.access_token - - await fetch('https://example.com/withAuth', { - method: 'GET', - withCredentials: true, - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - 'Authorization': bearer, // Your own auth - 'X-Supabase-Auth': token, // Set the Supabase user - } - }) - } - - /** - * Use the Auth token in your server-side function. - */ - async function apiFunction(req, res) { - const { access_token } = req.get('X-Supabase-Auth') - - // You can now use it within a Supabase Client - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key") - const { user, error } = supabase.auth.setAuth(access_token) - - // This client will now send requests as this user - const { data } = await supabase.from('your_table').select() - } - ``` - - auth.onAuthStateChange(): - title: 'onAuthStateChange()' - $ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange' - examples: - - name: Listen to auth changes - isSpotlight: true - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - console.log(event, session) - }) - ``` - - name: Listen to sign in - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_IN') console.log('SIGNED_IN', session) - }) - ``` - - name: Listen to sign out - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_OUT') console.log('SIGNED_OUT', session) - }) - ``` - - name: Listen to token refresh - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'TOKEN_REFRESHED') console.log('TOKEN_REFRESHED', session) - }) - ``` - - name: Listen to user updates - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_UPDATED') console.log('USER_UPDATED', session) - }) - ``` - - name: Listen to user deleted - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_DELETED') console.log('USER_DELETED', session) - }) - ``` - - name: Listen to password recovery events - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session) - }) - ``` - auth.api.getUser(): - title: 'getUser()' - $ref: '@supabase/gotrue-js.GoTrueApi.getUser' - notes: | - - Fetches the user object from the database instead of local storage. - - Note that user() fetches the user object from local storage which might not be the most updated. - - Requires the user's access_token. - examples: - - name: Fetch the user object using the access_token jwt. - isSpotlight: true - js: | - ```js - const { user, error } = await supabase.auth.api.getUser( - 'ACCESS_TOKEN_JWT', - ) - ``` - - auth.api.listUsers(): - title: 'listUsers()' - $ref: '@supabase/gotrue-js.GoTrueApi.listUsers' - notes: | - - Requires a `service_role` key. - - This function should be called on a server. Never expose your `service_role` key in the browser. - examples: - - name: Get a full list of users. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.listUsers() - ``` - - auth.api.createUser(): - title: 'createUser()' - $ref: '@supabase/gotrue-js.GoTrueApi.createUser' - notes: | - - Requires a `service_role` key. - - This function should be called on a server. Never expose your `service_role` key in the browser. - - If you do not provide the `email_confirm` and `phone_confirm` options to this function, both will default to false. - examples: - - name: Create a new user. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.createUser({ - email: 'user@email.com', - password: 'password', - user_metadata: { name: 'Yoda' } - }) - ``` - - name: Auto-confirm email. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.createUser({ - email: 'user@email.com', - email_confirm: true - }) - ``` - - name: Auto-confirm phone. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.createUser({ - phone: '1234567890', - phone_confirm: true - }) - ``` - - auth.api.deleteUser(): - title: 'deleteUser()' - $ref: '@supabase/gotrue-js.GoTrueApi.deleteUser' - notes: | - - Requires a `service_role` key. - - This function should be called on a server. Never expose your `service_role` key in the browser. - examples: - - name: Remove a user completely. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.deleteUser( - '715ed5db-f090-4b8c-a067-640ecee36aa0' - ) - ``` - - auth.api.inviteUserByEmail(): - title: 'inviteUserByEmail()' - $ref: '@supabase/gotrue-js.GoTrueApi.inviteUserByEmail' - notes: | - - Requires a `service_role` key. - - This function should only be called on a server. Never expose your `service_role` key in the browser. - examples: - - name: Basic example. - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth - .api - .inviteUserByEmail('email@example.com') - ``` - - auth.api.sendMobileOTP(): - title: 'sendMobileOTP()' - $ref: '@supabase/gotrue-js.GoTrueApi.sendMobileOTP' - notes: | - - Requires a `service_role` key. - - This function should only be called on a server. Never expose your `service_role` key in the browser. - examples: - - name: Basic example. - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth - .api - .sendMobileOTP('12345879') - ``` - - auth.api.resetPasswordForEmail(): - title: 'resetPasswordForEmail()' - $ref: '@supabase/gotrue-js.GoTrueApi.resetPasswordForEmail' - notes: | - Sends a password reset request to an email address. - When the user clicks the reset link in the email they are redirected back to your application. - Prompt the user for a new password and call `auth.update()`: - ```js - const { data, error } = await supabase.auth.update({ - password: new_password, - }) - ``` - examples: - - name: Reset password - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.api.resetPasswordForEmail( - 'user@email.com' - ) - ``` - - name: Reset password (React) - isSpotlight: true - js: | - ```js - /** - * Step 1: Send the user an email to get a password reset token. - * This email contains a link which sends the user back to your application. - */ - const { data, error } = await supabase.auth.api.resetPasswordForEmail( - 'user@email.com' - ) - - /** - * Step 2: Once the user is redirected back to your application, - * ask the user to reset their password. - */ - useEffect(() => { - supabase.auth.onAuthStateChange(async (event, session) => { - if (event == "PASSWORD_RECOVERY") { - const newPassword = prompt("What would you like your new password to be?"); - const { data, error } = await supabase.auth.update({ - password: newPassword, - }) - - if (data) alert("Password updated successfully!") - if (error) alert("There was an error updating your password.") - } - }) - }, []) - ``` - - auth.api.generateLink(): - title: 'generateLink()' - $ref: '@supabase/gotrue-js.GoTrueApi.generateLink' - notes: | - - Requires a `service_role` key. - - This function should only be called on a server. Never expose your `service_role` key in the browser. - examples: - - name: Generate an invite link - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth.api.generateLink( - 'invite', - 'email@example.com' - ) - ``` - - auth.api.updateUserById(): - title: 'updateUserById()' - $ref: '@supabase/gotrue-js.GoTrueApi.updateUserById' - notes: | - - Requires a `service_role` key. - - This function should only be called on a server. Never expose your `service_role` key in the browser. - examples: - - name: Updates a user's email. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email: 'new@email.com' } - ) - ``` - - name: Updates a user's password. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { password: 'new_password' } - ) - ``` - - name: Updates a user's metadata. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { user_metadata: { hello: 'world' } } - ) - ``` - - name: Updates a user's app_metadata. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { app_metadata: { plan: 'trial' } } - ) - ``` - - name: Confirms a user's email address. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email_confirm: true } - ) - ``` - - name: Confirms a user's phone number. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { phone_confirm: true } - ) - ``` - invoke(): - title: 'invoke()' - description: | - Invokes a Supabase Function. - $ref: '@supabase/functions-js.FunctionsClient.invoke' - notes: | - - Requires an Authorization header. - - Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. - examples: - - name: Basic invocation. - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.functions.invoke('hello', { - body: JSON.stringify({ foo: 'bar' }) - }) - ``` - - name: Specifying response type. - description: | - By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`. - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.functions.invoke('hello', { - responseType: 'text', - body: JSON.stringify({ foo: 'bar' }) - }) - ``` - - name: Parsing custom headers. - description: | - You can pass custom headers to your function. Note: supabase-js automatically passes the `Authorization` header with the signed in user's JWT. - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.functions.invoke('hello', { - headers: { - "my-custom-header": 'my-custom-header-value' - }, - body: JSON.stringify({ foo: 'bar' }) - }) - ``` - - select(): - title: 'Fetch data: select()' - $ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.select' - notes: | - - By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. - - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers) - - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters) - - If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - examples: - - name: Getting your data - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select() - ``` - - name: Selecting specific columns - description: You can select specific fields from your tables. - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name') - ``` - - name: Query foreign tables - description: If your database has foreign key relationships, you can query related tables too. - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities ( - name - ) - `) - ``` - note: | - What about join tables - If you're in a situation where your tables are **NOT** directly related, but instead are joined by a _join table_, - you can still use the `select()` method to query the related data. The PostgREST engine detects the relationship automatically. - For more details, [follow the link](https://postgrest.org/en/latest/api.html#embedding-through-join-tables). - - name: Query the same foreign table multiple times - description: | - Sometimes you will need to query the same foreign table twice. - In this case, you can use the name of the joined column to identify - which join you intend to use. For convenience, you can also give an - alias for each column. For example, if we had a shop of products, - and we wanted to get the supplier and the purchaser at the same time - (both in the users) table: - js: | - ```js - const { data, error } = await supabase - .from('products') - .select(` - id, - supplier:supplier_id ( name ), - purchaser:purchaser_id ( name ) - `) - ``` - - name: Filtering with inner joins - description: | - If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted - to select all rows in a `message` table which belong to a user with the `username` "Jane": - js: | - ```js - const { data, error } = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane') - ``` - - name: Querying with count option - description: | - You can get the number of rows by using the count option. - Allowed values for count option are `null`, [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count). - js: | - ```js - const { data, error, count } = await supabase - .from('cities') - .select('name', { count: 'exact' }) // if you don't want to return any rows, you can use { count: 'exact', head: true } - ``` - - name: Querying JSON data - description: | - If you have data inside of a JSONB column, you can apply select - and query filters to the data values. Postgres offers a - [number of operators](https://www.postgresql.org/docs/current/functions-json.html) - for querying JSON data. Also see - [PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details. - js: | - ```js - const { data, error } = await supabase - .from('users') - .select(` - id, name, - address->street - `) - .eq('address->postcode', 90210) - ``` - - name: Return data as CSV - description: | - By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values. - js: | - ```js - const { data, error } = await supabase - .from('users') - .select() - .csv() - ``` - - name: Aborting requests in-flight - description: | - You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` doesn't mean anything for aborted requests, since the request wasn't actually fulfilled. - js: | - ```js - const ac = new AbortController() - supabase - .from('very_big_table') - .select() - .abortSignal(ac.signal) - .then(console.log) - ac.abort() - // { - // error: { - // message: 'FetchError: The user aborted a request.', - // details: '', - // hint: '', - // code: '' - // }, - // data: null, - // body: null, - // count: null, - // status: 400, - // statusText: 'Bad Request' - // } - ``` - - insert(): - title: 'Create data: insert()' - $ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.insert' - notes: | - - By default, every time you run `insert()`, the client library will make a `select` to return the full record. - This is convenient, but it can also cause problems if your Policies are not configured to allow the `select` operation. - If you are using Row Level Security and you are encountering problems, try setting the `returning` param to `minimal`. - examples: - - name: Create a record - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .insert([ - { name: 'The Shire', country_id: 554 } - ]) - ``` - - name: Bulk create - description: | - When running a bulk create, the operation is handled in a single transaction. If any of the inserts fail, all other operations are - rolled back. - js: | - ```js - const { data, error } = await supabase - .from('cities') - .insert([ - { name: 'The Shire', country_id: 554 }, - { name: 'Rohan', country_id: 555 }, - ]) - ``` - - name: Upsert - description: | - For upsert, if set to true, primary key columns would need to be included - in the data parameter in order for an update to properly happen. Also, primary keys - used must be natural, not surrogate. There are however, - [workarounds](https://github.com/PostgREST/postgrest/issues/1118) - for surrogate primary keys. - js: | - ```js - const { data, error } = await supabase - .from('cities') - .insert( - [ - { name: 'The Shire', country_id: 554 }, - { name: 'Rohan', country_id: 555 }, - { name: 'City by the Bay', country_id:840} - ], - { upsert: true }) - ``` - - update(): - title: 'Modify data: update()' - $ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.update' - notes: | - - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update. - examples: - - name: Updating your data - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Middle Earth' }) - .match({ name: 'Auckland' }) - ``` - - name: Updating JSON data - description: | - Postgres offers a - [number of operators](https://www.postgresql.org/docs/current/functions-json.html) - for working with JSON data. Right now it is only possible to update an entire JSON document, - but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys. - js: | - ```js - const { data, error } = await supabase - .from('users') - .update(` - address: { - street: 'Melrose Place', - postcode: 90210 - } - `) - .eq('address->postcode', 90210) - ``` - - upsert(): - title: 'Upsert data: upsert()' - $ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.upsert' - notes: | - - Primary keys should be included in the data payload in order for an update to work correctly. - - Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys. - - If you need to insert new data and update existing data at the same time, use [Postgres triggers](https://github.com/supabase/postgrest-js/issues/173#issuecomment-825124550). - examples: - - name: Upsert your data - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('messages') - .upsert({ id: 3, message: 'foo', username: 'supabot' }) - ``` - - name: Bulk Upsert your data - isSpotlight: false - js: | - ```js - const { data, error } = await supabase - .from('messages') - .upsert([ - { id: 3, message: 'foo', username: 'supabot' }, - { id: 4, message: 'bar', username: 'supabot' } - ]) - ``` - - name: Upserting into tables with constraints - description: | - Running the following will cause supabase to upsert data into the `users` table. - If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row - based on the column passed into `onConflict`. - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('users') - .upsert({ username: 'supabot' }, { onConflict: 'username' }) - ``` - - name: Return the exact number of rows - isSpotlight: true - js: | - ```js - const { data, error, count } = await supabase - .from('users') - .upsert({ - id: 3, message: 'foo', - username: 'supabot' - }, { - count: 'exact' - }) - ``` - - delete(): - title: 'Delete data: delete()' - $ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.delete' - notes: | - - `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete. - - If you use `delete()` with filters and you have - [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only - rows visible through `SELECT` policies are deleted. Note that by default - no rows are visible, so you need at least one `SELECT`/`ALL` policy that - makes the rows visible. - examples: - - name: Delete records - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .match({ id: 666 }) - ``` - - rpc(): - title: 'Postgres functions: rpc()' - description: | - You can call Postgres functions as _Remote Procedure Calls_, logic in your database that you can execute from anywhere. - Functions are useful when the logic rarely changes—like for password resets and updates. - - ```sql - create or replace function hello_world() returns text as $$ - select 'Hello world'; - $$ language sql; - ``` - $ref: '@supabase/postgrest-js."lib/PostgrestRpcBuilder".PostgrestRpcBuilder.rpc' - examples: - - name: Call a Postgres function without arguments - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .rpc('hello_world') - ``` - - name: Call a Postgres function with arguments - js: | - ```js - const { data, error } = await supabase - .rpc('echo_city', { name: 'The Shire' }) - ``` - - name: Bulk processing - description: You can process large payloads at once using [array parameters](https://postgrest.org/en/stable/api.html#calling-functions-with-array-parameters). - js: | - ```js - const { data, error } = await postgrest - .rpc('echo_cities', { names: ['The Shire', 'Mordor'] }) - ``` - - name: Call a Postgres function with filters - description: | - Postgres functions that return tables can also be combined with - [Modifiers](/docs/reference/javascript/using-modifiers) and - [Filters](/docs/reference/javascript/using-filters). - js: | - ```js - const { data, error } = await supabase - .rpc('echo_all_cities') - .select('name, population') - .eq('name', 'The Shire') - ``` - - name: Call a Postgres function with a count option - description: | - You can specify a count option to get the row count along with your data. - Allowed values for count option are `null`, `exact`, `planned` and `estimated`. - js: | - ```js - const { data, error, count } = await supabase - .rpc('hello_world', {}, { count: 'exact' }) - ``` - - subscribe(): - title: 'on().subscribe()' - $ref: '@supabase/supabase-js.lib/SupabaseQueryBuilder.SupabaseQueryBuilder.on' - notes: | - - Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime). - - If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;` - examples: - - name: Listen to all database changes - isSpotlight: true - js: | - ```js - const mySubscription = supabase - .from('*') - .on('*', payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to a specific table - js: | - ```js - const mySubscription = supabase - .from('countries') - .on('*', payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to inserts - js: | - ```js - const mySubscription = supabase - .from('countries') - .on('INSERT', payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to updates - description: | - By default, Supabase will send only the updated record. If you want to receive the previous values as well you can - enable full replication for the table you are listening too: - - ```sql - alter table "your_table" replica identity full; - ``` - js: | - ```js - const mySubscription = supabase - .from('countries') - .on('UPDATE', payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to deletes - description: | - By default, Supabase does not send deleted records. If you want to receive the deleted record you can - enable full replication for the table you are listening too: - - ```sql - alter table "your_table" replica identity full; - ``` - js: | - ```js - const mySubscription = supabase - .from('countries') - .on('DELETE', payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to multiple events - description: You can chain listeners if you want to listen to multiple events for each table. - js: | - ```js - const mySubscription = supabase - .from('countries') - .on('INSERT', handleRecordInserted) - .on('DELETE', handleRecordDeleted) - .subscribe() - ``` - - name: Listening to row level changes - description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - notes: | - - ``eq`` filter works with all database types as under the hood, it's casting both the filter value and the database value to the correct type and then comparing them. - js: | - ```js - const mySubscription = supabase - .from('countries:id=eq.200') - .on('UPDATE', handleRecordUpdated) - .subscribe() - ``` - - removeSubscription(): - title: 'removeSubscription()' - $ref: '@supabase/supabase-js.index.SupabaseClient.removeSubscription' - notes: | - - Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed. - examples: - - name: Remove a subscription - isSpotlight: true - js: | - ```js - supabase.removeSubscription(mySubscription) - ``` - - removeAllSubscriptions(): - title: 'removeAllSubscriptions()' - $ref: '@supabase/supabase-js.index.SupabaseClient.removeAllSubscriptions' - notes: | - - Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed. - examples: - - name: Removes all subscriptions - isSpotlight: true - js: | - ```js - supabase.removeAllSubscriptions() - ``` - - getSubscriptions(): - title: 'getSubscriptions()' - $ref: '@supabase/supabase-js.index.SupabaseClient.getSubscriptions' - examples: - - name: Get all subscriptions - isSpotlight: true - js: | - ```js - const subscriptions = supabase.getSubscriptions() - ``` - - storage.listBuckets(): - title: 'listBuckets()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.listBuckets' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - examples: - - name: List buckets - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .listBuckets() - ``` - - storage.getBucket(): - title: 'getBucket()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.getBucket' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - examples: - - name: Get bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .getBucket('avatars') - ``` - - storage.createBucket(): - title: 'createBucket()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.createBucket' - notes: | - - Policy permissions required: - - `buckets` permissions: `insert` - - `objects` permissions: none - examples: - - name: Create bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .createBucket('avatars', { public: false }) - ``` - - storage.emptyBucket(): - title: 'emptyBucket()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.emptyBucket' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: `select` and `delete` - examples: - - name: Empty bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .emptyBucket('avatars') - ``` - storage.updateBucket(): - title: 'updateBucket()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.updateBucket' - notes: | - - Policy permissions required: - - `buckets` permissions: `update` - - `objects` permissions: none - examples: - - name: Update bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .updateBucket('avatars', { public: false }) - ``` - - storage.deleteBucket(): - title: 'deleteBucket()' - $ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.deleteBucket' - notes: | - - Policy permissions required: - - `buckets` permissions: `select` and `delete` - - `objects` permissions: none - examples: - - name: Delete bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .deleteBucket('avatars') - ``` - - storage.from.upload(): - title: 'from.upload()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.upload' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` - - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below. - examples: - - name: Upload file - isSpotlight: true - js: | - ```js - const avatarFile = event.target.files[0] - const { data, error } = await supabase - .storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false - }) - ``` - - name: Upload file using `ArrayBuffer` from base64 file data - js: | - ```js - import { decode } from 'base64-arraybuffer' - - const { data, error } = await supabase - .storage - .from('avatars') - .upload('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png' - }) - ``` - - storage.from.update(): - title: 'from.update()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.update' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below. - examples: - - name: Update file - isSpotlight: true - js: | - ```js - const avatarFile = event.target.files[0] - const { data, error } = await supabase - .storage - .from('avatars') - .update('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false - }) - ``` - - name: Update file using `ArrayBuffer` from base64 file data - js: | - ```js - import {decode} from 'base64-arraybuffer' - - const { data, error } = await supabase - .storage - .from('avatars') - .update('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png' - }) - ``` - - storage.from.move(): - title: 'from.move()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.move' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - examples: - - name: Move file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png') - ``` - - storage.from.copy(): - title: 'from.copy()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.copy' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` and `select` - examples: - - name: Copy file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .copy('public/avatar1.png', 'private/avatar2.png') - ``` - - storage.from.createSignedUrl(): - title: 'from.createSignedUrl()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.createSignedUrl' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: Create Signed URL - isSpotlight: true - js: | - ```js - const { signedURL, error } = await supabase - .storage - .from('avatars') - .createSignedUrl('folder/avatar1.png', 60) - ``` - - storage.from.createSignedUrls(): - title: 'from.createSignedUrls()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.createSignedUrls' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: Create Signed URLs - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) - ``` - - storage.from.getPublicUrl(): - title: 'from.getPublicUrl()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.getPublicUrl' - notes: | - - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: none - examples: - - name: Returns the URL for an asset in a public bucket - isSpotlight: true - js: | - ```js - const { publicURL, error } = supabase - .storage - .from('public-bucket') - .getPublicUrl('folder/avatar1.png') - ``` - - storage.from.download(): - title: 'from.download()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.download' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: Download file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .download('folder/avatar1.png') - ``` - - storage.from.remove(): - title: 'from.remove()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.remove' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `delete` and `select` - examples: - - name: Delete file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .remove(['folder/avatar1.png']) - ``` - - storage.from.list(): - title: 'from.list()' - $ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.list' - notes: | - - Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - examples: - - name: List files in a bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, - }) - ``` - - name: Search files in a bucket - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, - search: 'jon' - }) - ``` - - Using Modifiers: - description: | - Modifiers can be used on `select()` queries. - - If a Postgres function returns a table response, you can also apply modifiers to the `rpc()` function. - - limit(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.limit' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - ``` - - name: With embedded resources - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .limit(1, { foreignTable: 'cities' }) - ``` - - order(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.order' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .order('id', { ascending: false }) - ``` - - name: With embedded resources - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .order('name', {foreignTable: 'cities'}) - ``` - - name: Ordering multiple columns - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name', 'country_id') - .order('country_id', { ascending: false }) - .order('name', { ascending: false }) - ``` - range(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.range' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .range(0,3) - ``` - - single(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.single' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .single() - ``` - - maybeSingle(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.maybeSingle' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'Singapore') - .maybeSingle() - ``` - - Using Filters: - description: | - Filters can be used on `select()`, `update()`, and `delete()` queries. - - If a Postgres function returns a table response, you can also apply filters. - - ### Applying Filters - - You must apply your filters to the end of your query. For example: - - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire') // Correct - - const { data, error } = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id') - ``` - - ### Chaining - - Filters can be chained together to produce advanced queries. For example: - - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000) - ``` - - ### Conditional Chaining - - Filters can be built up one step at a time and then executed. For example: - - ```js - const filterByName = null - const filterPopLow = 1000 - const filterPopHigh = 10000 - - let query = supabase - .from('cities') - .select('name, country_id') - - if (filterByName) { query = query.eq('name', filterByName) } - if (filterPopLow) { query = query.gte('population', filterPopLow) } - if (filterPopHigh) { query = query.lt('population', filterPopHigh) } - - const { data, error } = await query - ``` - - .or(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.or' - notes: | - - `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```js - .or('id.in.(6,7), arraycol.cs.{"a","b"}') // Use Postgres list () for in filter. Array {} for array column and 'cs' for contains. - .or(`id.in.(${arrList}),arraycol.cs.{${arr}}`) // You can insert a javascipt array for list or array on array column. - .or(`id.in.(${arrList}),rangecol.cs.[${arrRange})`) // You can insert a javascipt array for list or range on a range column. - ``` - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') - ``` - - name: Use `or` with `and` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)') - ``` - - name: Use `or` on foreign tables - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('id, cities(*)') - .or('name.eq.Wellington,name.eq.Paris', { foreignTable: "cities" }) - ``` - - .not(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.not' - notes: | - - `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```js - .not('name','eq','Paris') - .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .not('id','in','(6,7)') // Use Postgres list () for in filter. - .not('id','in',`(${arr})`) // You can insert a javascript array. - ``` - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .not('name', 'eq', 'Paris') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .not('name', 'eq', 'Paris') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .not('name', 'eq', 'Paris') - ``` - - .match(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.match' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .match({name: 'Beijing', country_id: 156}) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .match({name: 'Beijing', country_id: 156}) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .match({name: 'Beijing', country_id: 156}) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .match({name: 'Beijing', country_id: 156}) - ``` - - .eq(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.eq' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .eq('name', 'San Francisco') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .eq('name', 'Mordor') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .eq('name', 'San Francisco') - ``` - - .neq(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.neq' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .neq('name', 'San Francisco') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .neq('name', 'Mordor') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .neq('name', 'Lagos') - ``` - - .gt(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.gt' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .gt('country_id', 250) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .gt('country_id', 250) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .gt('country_id', 250) - ``` - - .gte(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.gte' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .gte('country_id', 250) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .gte('country_id', 250) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .gte('country_id', 250) - ``` - - .lt(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.lt' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .lt('country_id', 250) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .lt('country_id', 250) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .lt('country_id', 250) - ``` - - .lte(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.lte' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .lte('country_id', 250) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .lte('country_id', 250) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .lte('country_id', 250) - ``` - - .like(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.like' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .like('name', '%la%') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .like('name', '%la%') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .like('name', '%la%') - ``` - - .ilike(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.ilike' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .ilike('name', '%la%') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .ilike('name', '%la%') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .ilike('name', '%la%') - ``` - - .is(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.is' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .is('name', null) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .is('name', null) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .is('name', null) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .is('name', null) - ``` - - .in(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.in' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .in('name', ['Rio de Janeiro', 'San Francisco']) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .in('name', ['Rio de Janeiro', 'San Francisco']) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .in('name', ['Rio de Janeiro', 'San Francisco']) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .in('name', ['Rio de Janeiro', 'San Francisco']) - ``` - - .contains(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.contains' - notes: | - - `.contains()` can work on array columns or range columns. - It is very useful for finding rows where a tag array contains all the values in the filter array. - - ```js - .contains('arraycol',["a","b"]) // You can use a javascript array for an array column - .contains('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .contains('rangecol','(1,2]') // Use Postgres range syntax for range column. - .contains('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .contains('main_exports', ['oil']) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .contains('main_exports', ['oil']) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .contains('main_exports', ['oil']) - ``` - - .containedBy(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.containedBy' - notes: | - - `.containedBy()` can work on array columns or range columns. - - ```js - .containedBy('arraycol',["a","b"]) // You can use a javascript array for an array column - .containedBy('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .containedBy('rangecol','(1,2]') // Use Postgres range syntax for range column. - .containedBy('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .containedBy('main_exports', ['orks', 'surveillance', 'evil']) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .containedBy('main_exports', ['cars', 'food', 'machine']) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .containedBy('main_exports', ['cars', 'food', 'machine']) - ``` - - .rangeLt(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeLt' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeLt('population_range_millions', '[150, 250]') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .rangeLt('population_range_millions', '[150, 250]') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeLt('population_range_millions', '[150, 250]') - ``` - - .rangeGt(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeGt' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeGt('population_range_millions', '[150, 250]') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .rangeGt('population_range_millions', '[150, 250]') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeGt('population_range_millions', '[150, 250]') - ``` - - .rangeGte(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeGte' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeGte('population_range_millions', '[150, 250]') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .rangeGte('population_range_millions', '[150, 250]') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeGte('population_range_millions', '[150, 250]') - ``` - - .rangeLte(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeLte' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeLte('population_range_millions', '[150, 250]') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .rangeLte('population_range_millions', '[150, 250]') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeLte('population_range_millions', '[150, 250]') - ``` - - .rangeAdjacent(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeAdjacent' - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeAdjacent('population_range_millions', '[70, 185]') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .rangeAdjacent('population_range_millions', '[70, 185]') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeAdjacent('population_range_millions', '[70, 185]') - ``` - - .overlaps(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.overlaps' - notes: | - - `.overlaps()` can work on array columns or range columns. - - ```js - .overlaps('arraycol',["a","b"]) // You can use a javascript array for an array column - .overlaps('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .overlaps('rangecol','(1,2]') // Use Postgres range syntax for range column. - .overlaps('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) - ``` - - name: With `update()` - js: | - ```js - let countries = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .overlaps('main_exports', ['computers', 'minerals']) - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('countries') - .delete() - .overlaps('main_exports', ['computers', 'minerals']) - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_countries') - .overlaps('main_exports', ['computers', 'minerals']) - ``` - - .textSearch(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.textSearch' - examples: - - name: Text search - js: | - ```js - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - config: 'english' - }) - ``` - - name: Basic normalization - description: Uses PostgreSQL's `plainto_tsquery` function. - js: | - ```js - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'plain', - config: 'english' - }) - ``` - - name: Full normalization - description: Uses PostgreSQL's `phraseto_tsquery` function. - js: | - ```js - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'phrase', - config: 'english' - }) - ``` - - name: Websearch - description: | - Uses PostgreSQL's `websearch_to_tsquery` function. - This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used - with advanced operators. - - - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. - - `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. - - `OR`: the word “or” will be converted to the | operator. - - `-`: a dash will be converted to the ! operator. - - js: | - ```js - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat or cat'`, { - type: 'websearch', - config: 'english' - }) - ``` - - .filter(): - $ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.filter' - notes: | - - `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work. - ```js - .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .filter('id','in','(6,7)') // Use Postgres list () for in filter. - .filter('id','in',`(${arr})`) // You can insert a javascript array. - ``` - examples: - - name: With `select()` - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') - ``` - - name: With `update()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .filter('name', 'in', '("Paris","Tokyo")') - ``` - - name: With `delete()` - js: | - ```js - const { data, error } = await supabase - .from('cities') - .delete() - .filter('name', 'in', '("Paris","Tokyo")') - ``` - - name: With `rpc()` - js: | - ```js - // Only valid if the Postgres function returns a table type. - const { data, error } = await supabase - .rpc('echo_all_cities') - .filter('name', 'in', '("Paris","Tokyo")') - ``` - - name: Filter embedded resources - js: | - ```js - const { data, error } = await supabase - .from('cities') - .select('name, countries ( name )') - .filter('countries.name', 'in', '("France","Japan")') - ``` diff --git a/spec/supabase_js_v1.yml b/spec/supabase_js_v1.yml index b56b1390eac..810e46d2036 100644 --- a/spec/supabase_js_v1.yml +++ b/spec/supabase_js_v1.yml @@ -285,7 +285,7 @@ functions: $ref: '@supabase/gotrue-js.GoTrueClient.update' notes: | User email: By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). + To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/providers). User metadata: It's generally better to store user data in a table within your public schema (i.e., `public.users`). Use the `update()` method if you have data which rarely changes or is specific only to the logged in user. diff --git a/spec/supabase_js_v2--old.yml b/spec/supabase_js_v2--old.yml deleted file mode 100644 index f245467e26c..00000000000 --- a/spec/supabase_js_v2--old.yml +++ /dev/null @@ -1,5390 +0,0 @@ -openref: 0.1 - -info: - id: reference/supabase-js - title: Supabase Client - description: | - - Supabase JavaScript. - - definition: ../../spec/enrichments/tsdoc_v2/combined.json - specUrl: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2.yml - slugPrefix: '/' - libraries: - - name: 'JavaScript' - id: 'js' - version: '0.0.1' - -pages: - Initializing: - $ref: '@supabase/supabase-js.index.SupabaseClient.constructor' - description: | - You can initialize a new Supabase client using the `createClient()` method. - - The Supabase client is your entrypoint to the rest of the Supabase functionality - and is the easiest way to interact with everything we offer within the Supabase ecosystem. - - examples: - - name: createClient() - js: | - ```js - import { createClient } from '@supabase/supabase-js' - - // Create a single supabase client for interacting with your database - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key') - ``` - - name: With additional parameters - js: | - ```js - import { createClient } from '@supabase/supabase-js' - - const options = { - db: { - schema: 'public', - }, - auth: { - autoRefreshToken: true, - persistSession: true, - detectSessionInUrl: true - }, - global: { - headers: { 'x-my-custom-header': 'my-app-name' }, - }, - } - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", options) - ``` - - name: API schemas - js: | - ```js - import { createClient } from '@supabase/supabase-js' - - // Provide a custom schema. Defaults to "public". - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { - db: { schema: 'other_schema' } - }) - ``` - - By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. - Go to `Settings > API > Schema` and add the schema which you want to expose to the API. - - Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema. - - name: Custom `fetch` implementation - js: | - ```js - import { createClient } from '@supabase/supabase-js' - - const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { - global: { fetch: fetch.bind(globalThis) } - }) - ``` - - `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, - but an alternative `fetch` implementation can be provided as an option. - This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers). - - name: React Native options - js: | - ```js - import { createClient } from '@supabase/supabase-js' - import AsyncStorage from "@react-native-async-storage/async-storage"; - - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", { - auth: { - storage: AsyncStorage, - autoRefreshToken: true, - persistSession: true, - detectSessionInUrl: false, - }, - }); - ``` - - For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth. - auth.signUp(): - title: 'signUp()' - $ref: '@supabase/gotrue-js.GoTrueClient.signUp' - notes: | - - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/settings). - - **Confirm email** determines if users need to confirm their email address after signing up. - - If **Confirm email** is enabled, a `user` is returned but `session` is null. - - If **Confirm email** is disabled, both a `user` and a `session` are returned. - - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings). - - If signUp() is called for an existing confirmed user: - - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned. - - If **Confirm email** is disabled, the error message, `User already registered` is returned. - - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser). - examples: - - name: Sign up. - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', - }) - ``` - - name: Sign up with additional user metadata. - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.signUp( - { - email: 'example@email.com', - password: 'example-password', - options: { - data: { - first_name: 'John', - age: 27, - } - } - } - ) - ``` - auth.signInWithPassword(): - title: 'signInWithPassword()' - $ref: '@supabase/gotrue-js.GoTrueClient.signInWithPassword' - notes: | - - Requires either an email and password or a phone number and password. - examples: - - name: Sign in with email and password - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.signInWithPassword({ - email: 'example@email.com', - password: 'example-password', - }) - ``` - - name: Sign in with phone and password - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.signInWithPassword({ - phone: '+13334445555', - password: 'some-password', - }) - - // After receiving a SMS with a OTP. - const { data, error } = await supabase.auth.verifyOtp({ - phone: '+13334445555', - token: '123456', - }) - ``` - auth.signInWithOtp(): - title: 'signInWithOtp()' - $ref: '@supabase/gotrue-js.GoTrueClient.signInWithOtp' - notes: | - - Requires either an email or phone number. - - This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number. - - If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP. - - If you're using phone, you can configure whether you want the user to receive a OTP. - - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings). - examples: - - name: Sign in with email. - isSpotlight: true - description: The user will be sent an email which contains either a magiclink or a OTP or both. By default, a given user can only request a OTP once every 60 seconds. - js: | - ```js - const { data, error } = await supabase.auth.signInWithOtp({ - email: 'example@email.com', - }) - ``` - - name: Sign in with SMS OTP. - isSpotlight: false - description: The user will be sent a SMS which contains a OTP. By default, a given user can only request a OTP once every 60 seconds. - js: | - ```js - const { data, error } = await supabase.auth.signInWithOtp({ - phone: '+13334445555', - }) - ``` - auth.signInWithOAuth(): - title: 'signInWithOAuth()' - $ref: '@supabase/gotrue-js.GoTrueClient.signInWithOAuth' - notes: | - - This method is used for signing in using a third-party provider. - - Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers). - examples: - - name: Sign in using a third-party provider - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'github' - }) - ``` - - name: Sign in using a third-party provider with redirect - isSpotlight: false - description: | - When the third-party provider successfully authenticates the user, the provider redirects the user to the Supabase Auth callback URL where they are further redirected to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](/docs/reference/auth/config#site_url). - You can modify the `SITE_URL` or [add additional redirect URLs](https://app.supabase.com/project/_/auth/settings). You can use [wildcard match patterns](/docs/guides/auth#redirect-urls-and-wildcards) to support preview URLs from providers like Netlify and Vercel. - js: | - ```js - const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'github' - options: { - redirectTo: 'https://example.com/welcome' - } - } - ``` - - name: Sign in with scopes - isSpotlight: false - description: | - If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. - You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. The list of scopes will be documented by the third-party provider you are using and specifying scopes will enable you to use the OAuth provider token to call additional APIs supported by the third-party provider to get more information. - js: | - ```js - const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'github' - options: { - scopes: 'repo gist notifications' - } - }) - const oAuthToken = data.session.provider_token // use to access provider API - ``` - auth.signOut(): - title: 'signOut()' - $ref: '@supabase/gotrue-js.GoTrueClient.signOut' - notes: | - - In order to use the `signOut()` method, the user needs to be signed in first. - examples: - - name: Sign out - isSpotlight: true - js: | - ```js - const { error } = await supabase.auth.signOut() - ``` - auth.verifyOtp(): - title: 'verifyOtp()' - $ref: '@supabase/gotrue-js.GoTrueClient.verifyOtp' - notes: | - - The `verifyOtp` method takes in different verification types. If a phone number is used, the type can either be `sms` or `phone_change`. If an email address is used, the type can be one of the following: `signup`, `magiclink`, `recovery`, `invite` or `email_change`. - - The verification type used should be determined based on the corresponding auth method called before `verifyOtp` to sign up / sign-in a user. - examples: - - name: Verify Sms One-Time Password (OTP) - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.verifyOtp({ phone, token, type: 'sms'}) - ``` - - name: Verify Signup One-Time Password (OTP) - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.verifyOtp({ email, token, type: 'signup'}) - ``` - auth.getSession(): - title: 'getSession()' - $ref: '@supabase/gotrue-js.GoTrueClient.getSession' - examples: - - name: Get the session data - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.getSession() - ``` - auth.getUser(): - title: 'getUser()' - $ref: '@supabase/gotrue-js.GoTrueClient.getUser' - notes: | - - This method gets the user object from the current session. - - Fetches the user object from the database instead of local session. - examples: - - name: Get the logged in user with the current existing session - isSpotlight: true - js: | - ```js - const { data: { user } } = await supabase.auth.getUser() - ``` - - name: Get the logged in user with a custom access token jwt. - isSpotlight: false - js: | - ```js - const { data: { user } } = await supabase.auth.getUser(jwt) - ``` - auth.updateUser(): - title: 'updateUser()' - $ref: '@supabase/gotrue-js.GoTrueClient.updateUser' - notes: | - - In order to use the `updateUser()` method, the user needs to be signed in first. - - By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). - examples: - - name: Update the email for an authenticated user - description: Sends a "Confirm Email Change" email to the new email address. - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.updateUser({email: 'new@email.com'}) - ``` - - name: Update the password for an authenticated user - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.updateUser({password: 'new password'}) - ``` - - name: Update the user's metadata - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.updateUser({ - data: { hello: 'world' } - }) - ``` - auth.setSession(): - title: 'setSession()' - $ref: '@supabase/gotrue-js.GoTrueClient.setSession' - notes: | - - `setSession()` takes in a refresh token and access token to get a new session. - - The refresh token can only be used once to obtain a new session. - - [Refresh token rotation](/docs/reference/auth/config#refresh_token_rotation_enabled) is enabled by default on all projects to guard against replay attacks. - - You can configure the [`REFRESH_TOKEN_REUSE_INTERVAL`](https://supabase.com/docs/reference/auth/config#refresh_token_reuse_interval) which provides a short window in which the same refresh token can be used multiple times in the event of concurrency or offline issues. - - If you are using React Native, you will need to install a Buffer polyfill via a library such as [rn-nodeify](https://github.com/tradle/rn-nodeify) to properly use the library. - examples: - - name: Set the session - description: Sets the session data from a `refresh_token` and `access_token` and returns the current session or an error if the tokens are invalid. - isSpotlight: true - js: | - ```js - const { data, error } = supabase.auth.setSession({refresh_token, access_token}) - ``` - auth.refreshSession(): - title: 'refreshSession()' - $ref: '@supabase/gotrue-js.GoTrueClient.refreshSession' - notes: | - - This method will refresh the session whether the current one is expired or not. - - Both examples destructure `user` and `session` from `data`. This is not required; so `const { data, error } =` is also valid. - examples: - - name: Refresh session using the current session - isSpotlight: true - js: | - ```js - const { data: { user, session }, error } = await supabase.auth.refreshSession() - ``` - - name: Refresh session using a passed-in session - isSpotlight: true - js: | - ```js - const { data: { user, session }, error } = await supabase.auth.refreshSession({ refresh_token }) - ``` - auth.onAuthStateChange(): - title: 'onAuthStateChange()' - $ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange' - notes: | - - Types of auth events: `SIGNED_IN`, `SIGNED_OUT`, `TOKEN_REFRESHED`, `USER_UPDATED`, `USER_DELETED`, `PASSWORD_RECOVERY` - examples: - - name: Listen to auth changes - isSpotlight: true - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - console.log(event, session) - }) - ``` - - name: Listen to sign in - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_IN') console.log('SIGNED_IN', session) - }) - ``` - - name: Listen to sign out - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_OUT') console.log('SIGNED_OUT', session) - }) - ``` - - name: Listen to token refresh - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'TOKEN_REFRESHED') console.log('TOKEN_REFRESHED', session) - }) - ``` - - name: Listen to user updates - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_UPDATED') console.log('USER_UPDATED', session) - }) - ``` - - name: Listen to user deleted - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_DELETED') console.log('USER_DELETED', session) - }) - ``` - - name: Listen to password recovery events - js: | - ```js - supabase.auth.onAuthStateChange((event, session) => { - if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session) - }) - ``` - Supabase Auth Admin Api: - title: 'Overview' - notes: | - - Any method under the `supabase.auth.admin` namespace requires a `service_role` key. - - These methods are considered admin methods and should be called on a trusted server. Never expose your `service_role` key in the browser. - - auth.admin.getUserById(): - title: 'getUserById()' - $ref: '@supabase/gotrue-js.GoTrueAdminApi.getUserById' - notes: | - - Fetches the user object from the database based on the user's id. - - The `getUserById()` method requires the user's id which maps to the `auth.users.id` column. - examples: - - name: Fetch the user object using the access_token jwt. - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.admin.getUserById(1) - ``` - - auth.admin.listUsers(): - title: 'listUsers()' - $ref: '@supabase/gotrue-js.GoTrueAdminApi.listUsers' - examples: - - name: Get a full list of users. - isSpotlight: true - js: | - ```js - const { data: { users }, error } = await supabase.auth.admin.listUsers() - ``` - auth.admin.createUser(): - title: 'createUser()' - $ref: '@supabase/gotrue-js.GoTrueAdminApi.createUser' - notes: | - - To confirm the user's email address or phone number, set `email_confirm` or `phone_confirm` to true. Both arguments default to false. - examples: - - name: Create a new user with custom user metadata - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.admin.createUser({ - email: 'user@email.com', - password: 'password', - user_metadata: { name: 'Yoda' } - }) - ``` - - name: Auto-confirm the user's email - js: | - ```js - const { data, error } = await supabase.auth.admin.createUser({ - email: 'user@email.com', - email_confirm: true - }) - ``` - - name: Auto-confirm the user's phone number - js: | - ```js - const { data, error } = await supabase.auth.admin.createUser({ - phone: '1234567890', - phone_confirm: true - }) - ``` - auth.admin.deleteUser(): - title: 'deleteUser()' - $ref: '@supabase/gotrue-js.GoTrueAdminApi.deleteUser' - notes: | - - The `deleteUser()` method requires the user's ID, which maps to the `auth.users.id` column. - examples: - - name: Removes a user - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.admin.deleteUser( - '715ed5db-f090-4b8c-a067-640ecee36aa0' - ) - ``` - - auth.admin.inviteUserByEmail(): - title: 'inviteUserByEmail()' - $ref: '@supabase/gotrue-js.GoTrueAdminApi.inviteUserByEmail' - notes: | - - Sends an invite link to the user's email address. - examples: - - name: Invite a user - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.admin.inviteUserByEmail('email@example.com') - ``` - - auth.resetPasswordForEmail(): - title: 'resetPasswordForEmail()' - $ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail' - notes: | - Sends a password reset request to an email address. - When the user clicks the reset link in the email they are redirected back to your application. - Prompt the user for a new password and call `auth.updateUser()`: - ```js - const { data, error } = await supabase.auth - .updateUser({ password: new_password }) - ``` - examples: - - name: Reset password - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.resetPasswordForEmail(email, { - redirectTo: 'https://example.com/update-password', - }) - ``` - - name: Reset password (React) - isSpotlight: true - js: | - ```js - /** - * Step 1: Send the user an email to get a password reset token. - * This email contains a link which sends the user back to your application. - */ - const { data, error } = await supabase.auth - .resetPasswordForEmail('user@email.com') - - /** - * Step 2: Once the user is redirected back to your application, - * ask the user to reset their password. - */ - useEffect(() => { - supabase.auth.onAuthStateChange(async (event, session) => { - if (event == "PASSWORD_RECOVERY") { - const newPassword = prompt("What would you like your new password to be?"); - const { data, error } = await supabase.auth - .updateUser({ password: newPassword }) - - if (data) alert("Password updated successfully!") - if (error) alert("There was an error updating your password.") - } - }) - }, []) - ``` - - auth.admin.generateLink(): - title: 'generateLink()' - $ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink' - examples: - - name: Generate a signup link - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.auth.admin.generateLink({ - type: 'signup', - email: 'email@example.com', - options: { - 'password': 'secret' - } - }) - ``` - - name: Generate an invite link - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.admin.generateLink({ - type: 'invite', - email: 'email@example.com' - }) - ``` - - name: Generate a magic link - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.admin.generateLink({ - type: 'magiclink', - email: 'email@example.com' - }) - ``` - - name: Generate a recovery link - isSpotlight: false - js: | - ```js - const { data, error } = await supabase.auth.admin.generateLink({ - type: 'recovery', - email: 'email@example.com' - }) - ``` - - name: Generate links to change current email address - isSpotlight: false - js: | - ```js - // generate an email change link to be sent to the current email address - const { data, error } = await supabase.auth.admin.generateLink({ - type: 'email_change_current', - email: 'current.email@example.com', - newEmail: 'new.email@example.com' - }) - - // generate an email change link to be sent to the new email address - const { data, error } = await supabase.auth.admin.generateLink({ - type: 'email_change_new', - email: 'current.email@example.com', - newEmail: 'new.email@example.com' - }) - ``` - - auth.admin.updateUserById(): - title: 'updateUserById()' - $ref: '@supabase/gotrue-js.GoTrueAdminApi.updateUserById' - examples: - - name: Updates a user's email. - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email: 'new@email.com' } - ) - ``` - - name: Updates a user's password. - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { password: 'new_password' } - ) - ``` - - name: Updates a user's metadata. - isSpotlight: true - js: | - ```js - const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { user_metadata: { hello: 'world' } } - ) - ``` - - name: Updates a user's app_metadata. - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { app_metadata: { plan: 'trial' } } - ) - ``` - - name: Confirms a user's email address. - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email_confirm: true } - ) - ``` - - name: Confirms a user's phone number. - isSpotlight: false - js: | - ```js - const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { phone_confirm: true } - ) - ``` - - select(): - title: 'Fetch data: select()' - $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.select' - notes: | - - By default, Supabase projects return a maximum of 1,000 rows. This setting can be changed in your project's [API settings](https://app.supabase.com/project/_/settings/api). It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. - - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters) - - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers) - - `apikey` is a reserved keyword if you're using the [Supabase Platform](/docs/guides/platform) and should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - examples: - - name: Getting your data - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Afghanistan" - }, - { - "id": 2, - "name": "Albania" - }, - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - name: Selecting specific columns - description: | - You can select specific fields from your tables. - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - ``` - - - - - ```json - { - "data": [ - { - "name": "Afghanistan" - }, - { - "name": "Albania" - }, - { - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Query foreign tables - description: | - If your database has foreign key relationships, you can query related tables too. - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities ( - name - ) - `) - ``` - - - - - ```json - { - "data": [ - { - "name": "Germany", - "cities": [ - { - "name": "Munich" - } - ] - }, - { - "name": "Indonesia", - "cities": [ - { - "name": "Bali" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Query foreign tables through a join table - description: | - If you're in a situation where your tables are **NOT** directly - related, but instead are joined by a _join table_, you can still use - the `select()` method to query the related data. The join table needs - to have the foreign keys as part of its composite primary key. - - - - - ```sql - create table - users ( - id int8 primary key, - name text - ); - create table - teams ( - id int8 primary key, - name text - ); - -- join table - create table - users_teams ( - user_id int8 not null references users, - team_id int8 not null references teams, - -- both foreign keys must be part of a composite primary key - primary key (user_id, team_id) - ); - - insert into - users (id, name) - values - (1, 'Kiran'), - (2, 'Evan'); - insert into - teams (id, name) - values - (1, 'Green'), - (2, 'Blue'); - insert into - users_teams (user_id, team_id) - values - (1, 1), - (1, 2), - (2, 2); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select(` - name, - teams ( - name - ) - `) - ``` - - - - - ```json - { - "data": [ - { - "name": "Kiran", - "teams": [ - { - "name": "Green" - }, - { - "name": "Blue" - } - ] - }, - { - "name": "Evan", - "teams": [ - { - "name": "Blue" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Query the same foreign table multiple times - description: | - If you need to query the same foreign table twice, use the name of the - joined column to identify which join to use. You can also give each - column an alias. - - - - - ```sql - create table - users (id int8 primary key, name text); - - create table - messages ( - sender_id int8 not null references users, - receiver_id int8 not null references users, - content text - ); - - insert into - users (id, name) - values - (1, 'Kiran'), - (2, 'Evan'); - - insert into - messages (sender_id, receiver_id, content) - values - (1, 2, '👋'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('messages') - .select(` - content, - from:sender_id(name), - to:receiver_id(name) - `) - ``` - - - - - ```json - { - "data": [ - { - "content": "👋", - "from": { - "name": "Kiran" - }, - "to": { - "name": "Evan" - } - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Filtering through foreign tables - description: | - If the filter on a foreign table's column is not satisfied, the foreign - table returns `[]` or `null` but the parent table is not filtered out. - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('cities') - .select('name, countries(*)') - .eq('countries.name', 'Estonia') - ``` - - - - - ```json - { - "data": [ - { - "name": "Bali", - "countries": null - }, - { - "name": "Munich", - "countries": null - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - If you want to filter out the parent table rows, use the `!inner` hint: - - - - - ```ts - const { data, error } = await supabase - .from('cities') - .select('name, countries!inner(*)') - .eq('countries.name', 'Estonia') - ``` - - - - - ```json - { - "data": [], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Querying with count option - description: | - You can get the number of rows by using the - [count](/docs/reference/javascript/select#parameters) option. For - example, to get the table count without returning all rows: - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { count, error } = await supabase - .from('countries') - .select('*', { count: 'exact', head: true }) - ``` - - - - - ```json - { - "count": 3, - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Querying JSON data - description: | - You can select and filter data inside of - [JSON](/docs/guides/database/json) columns. Postgres offers some - [operators](/docs/guides/database/json#query-the-jsonb-data) for - querying JSON data. - - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Avdotya', '{"city":"Saint Petersburg"}'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select(` - id, name, - address->city - `) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Avdotya", - "city": "Saint Petersburg" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - insert(): - title: 'Create data: insert()' - $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.insert' - examples: - - name: Create a record - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .insert({ id: 1, name: 'Denmark' }) - ``` - - - - - ```json - { - "status": 201, - "statusText": "Created" - } - ``` - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Denmark" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { error } = await supabase - .from('countries') - .insert({ id: 1, name: 'Denmark' }) - ``` - - name: Create a record and return it - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .insert({ id: 1, name: 'Denmark' }) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Denmark" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - - hideCodeBlock: true - - name: Bulk create - description: | - A bulk create operation is handled in a single transaction. - If any of the inserts fail, none of the rows are inserted. - - - - - ```sql - create table - countries (id int8 primary key, name text); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .insert([ - { id: 1, name: 'Nepal' }, - { id: 1, name: 'Vietnam' }, - ]) - ``` - - - - - ```json - { - "error": { - "code": "23505", - "details": "Key (id)=(1) already exists.", - "hint": null, - "message": "duplicate key value violates unique constraint \"countries_pkey\"" - }, - "status": 409, - "statusText": "Conflict" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - update(): - title: 'Modify data: update()' - $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.update' - notes: | - - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update. - examples: - - name: Updating your data - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Taiwan'); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .update({ name: 'Australia' }) - .eq('id', 1) - ``` - - - - - ```json - { - "status": 204, - "statusText": "No Content" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Australia" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { error } = await supabase - .from('countries') - .update({ name: 'Australia' }) - .eq('id', 1) - ``` - - name: Update a record and return it - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Taiwan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .update({ name: 'Australia' }) - .eq('id', 1) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Australia" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Updating JSON data - description: | - Postgres offers some - [operators](/docs/guides/database/json#query-the-jsonb-data) for - working with JSON data. - - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210 }'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .update({ - address: { - street: 'Melrose Place', - postcode: 90210 - } - }) - .eq('address->postcode', 90210) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Michael", - "address": { - "street": "Melrose Place", - "postcode": 90210 - } - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - Currently, it is only possible to update the entire JSON document. - hideCodeBlock: true - - upsert(): - title: 'Upsert data: upsert()' - $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.upsert' - notes: | - - Primary keys must be included in `values` to use upsert. - examples: - - name: Upsert your data - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Albania' }) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Albania" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Albania' }) - .select() - ``` - - name: Bulk Upsert your data - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert([ - { id: 1, name: 'Albania' }, - { id: 2, name: 'Algeria' }, - ]) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Albania" - }, - { - "id": 2, - "name": "Algeria" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - - hideCodeBlock: true - - name: Upserting into tables with constraints - description: | - In the following query, `upsert()` implicitly uses the `id` - (primary key) column to determine conflicts. If there is no existing - row with the same `id`, `upsert()` inserts a new row, which - will fail in this case as there is already a row with `handle` `"saoirse"`. - - - - - ```sql - create table - users ( - id int8 generated by default as identity primary key, - handle text not null unique, - display_name text - ); - - insert into - users (id, handle, display_name) - values - (1, 'saoirse', null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' }) - .select() - ``` - - - - - ```json - { - "error": { - "code": "23505", - "details": "Key (handle)=(saoirse) already exists.", - "hint": null, - "message": "duplicate key value violates unique constraint \"users_handle_key\"" - }, - "status": 409, - "statusText": "Conflict" - } - ``` - - - - - Using the `onConflict` option, you can instruct `upsert()` to use - another column with a unique constraint to determine conflicts: - - - - - ```ts - await supabase - .from('users') - .upsert( - { id: 42, handle: 'saoirse', display_name: 'Saoirse' }, - { onConflict: 'handle' }, - ) - const { data, error } = await supabase - .from('users') - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 42, - "handle": "saoirse", - "display_name": "Saoirse" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - delete(): - title: 'Delete data: delete()' - $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.delete' - notes: | - - `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete. - - If you use `delete()` with filters and you have - [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only - rows visible through `SELECT` policies are deleted. Note that by default - no rows are visible, so you need at least one `SELECT`/`ALL` policy that - makes the rows visible. - examples: - - name: Delete records - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Spain'); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .delete() - .eq('id', 1) - ``` - - - - - ```json - { - "status": 204, - "statusText": "No Content" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { error } = await supabase - .from('countries') - .delete() - .eq('id', 1) - ``` - - rpc(): - title: 'Postgres functions: rpc()' - description: | - You can call Postgres functions as _Remote Procedure Calls_, logic in your database that you can execute from anywhere. - Functions are useful when the logic rarely changes—like for password resets and updates. - - ```sql - create or replace function hello_world() returns text as $$ - select 'Hello world'; - $$ language sql; - ``` - $ref: '@supabase/postgrest-js.PostgrestClient.rpc' - examples: - - name: Call a Postgres function without arguments - description: | - - - - ```sql - create function hello_world() returns text as $$ - select 'Hello world'; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase.rpc('hello_world') - ``` - - - - - ```json - { - "data": "Hello world", - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase.rpc('hello_world') - ``` - - name: Call a Postgres function with arguments - description: | - - - - ```sql - create function echo(say text) returns text as $$ - select say; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase.rpc('echo', { say: '👋' }) - ``` - - - - - ```json - { - "data": "👋", - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Bulk processing - description: | - You can process large payloads by passing in an array as an argument: - - - - - ```sql - create function add_one_each(arr int[]) returns int[] as $$ - select array_agg(n + 1) from unnest(arr) as n; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase.rpc('add_one_each', { arr: [1, 2, 3] }) - ``` - - - - - ```json - { - "data": [ - 2, - 3, - 4 - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Call a Postgres function with filters - description: | - Postgres functions that return tables can also be combined with - [Filters](/docs/reference/javascript/using-filters) and - [Modifiers](/docs/reference/javascript/using-modifiers). - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'France'), - (2, 'United Kingdom'); - - create function list_stored_countries() returns setof countries as $$ - select * from countries; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase - .rpc('list_stored_countries') - .eq('id', 1) - .single() - ``` - - - - - ```json - { - "data": { - "id": 1, - "name": "France" - }, - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - Using Filters: - description: | - Filters allow you to only return rows that match certain conditions. - - Filters can be used on `select()`, `update()`, `upsert()`, and `delete()` queries. - - If a Postgres function returns a table response, you can also apply filters. - - ### Applying Filters - - Filters must be applied after any of `select()`, `update()`, `upsert()`, - `delete()`, and `rpc()` and before - [modifiers](/docs/reference/javascript/using-modifiers). - - ```ts - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire') // Correct - - const { data, error } = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id') - ``` - - ### Chaining - - Filters can be chained together to produce advanced queries. For example, - to query cities with population between 1,000 and 10,000: - - ```ts - const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000) - ``` - - ### Conditional Chaining - - Filters can be built up one step at a time and then executed. For example: - - ```ts - const filterByName = null - const filterPopLow = 1000 - const filterPopHigh = 10000 - - let query = supabase - .from('cities') - .select('name, country_id') - - if (filterByName) { query = query.eq('name', filterByName) } - if (filterPopLow) { query = query.gte('population', filterPopLow) } - if (filterPopHigh) { query = query.lt('population', filterPopHigh) } - - const { data, error } = await query - ``` - - ### Filter by values within a JSON column - - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210 }'), - (2, 'Jane', null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select() - .eq('address->postcode', 90210) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Michael", - "address": { - "postcode": 90210 - } - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - ### Filter Foreign Tables - - You can filter on foreign tables in your `select()` query using dot - notation: - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities!inner ( - name - ) - `) - .eq('cities.name', 'Bali') - ``` - - - - - ```json - { - "data": [ - { - "name": "Indonesia", - "cities": [ - { - "name": "Bali" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - eq(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.eq' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', 'Albania') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', 'Albania') - ``` - - neq(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.neq' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .neq('name', 'Albania') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Afghanistan" - }, - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .neq('name', 'Albania') - ``` - - gt(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.gt' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .gt('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .gt('id', 2) - ``` - - gte(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.gte' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .gte('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - }, - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .gte('id', 2) - ``` - - lt(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lt' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .lt('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .lt('id', 2) - ``` - - lte(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lte' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .lte('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Afghanistan" - }, - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .lte('id', 2) - ``` - - like(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.like' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .like('name', '%Alba%') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .like('name', '%Alba%') - ``` - - ilike(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.ilike' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .ilike('name', '%alba%') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .ilike('name', '%alba%') - ``` - - is(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.is' - examples: - - name: Checking nullness - description: | - Using the `eq()` filter doesn't work when filtering for `null`: - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'null'), - (2, null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', null) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "null" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - Instead, you need to use `is()`: - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .is('name', null) - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": null - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .is('name', null) - ``` - - in(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.in' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .in('name', ['Albania', 'Algeria']) - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - }, - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .in('name', ['Albania', 'Algeria']) - ``` - - contains(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.contains' - examples: - - name: On array columns - description: | - - - - ```sql - create table - issues ( - id int8 primary key, - title text, - tags text[] - ); - - insert into - issues (id, title, tags) - values - (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']), - (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('issues') - .select('title') - .contains('tags', ['is:open', 'severity:high']) - ``` - - - - - ```json - { - "data": [ - { - "title": "Cache invalidation is not working" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('users') - .select() - .contains('name', ['is:online', 'faction:red']) - ``` - - name: On range columns - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: On `jsonb` columns - description: | - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'), - (2, 'Jane', '{}'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select('name') - .contains('address', { postcode: 90210 }) - ``` - - - - - ```json - { - "data": [ - { - "name": "Michael" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - containedBy(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.containedBy' - examples: - - name: On array columns - description: | - - - - ```sql - create table - classes ( - id int8 primary key, - name text, - days text[] - ); - - insert into - classes (id, name, days) - values - (1, 'Chemistry', array['monday', 'friday']), - (2, 'History', array['monday', 'wednesday', 'thursday']); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('classes') - .select('name') - .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday']) - ``` - - - - - ```json - { - "data": [ - { - "name": "Chemistry" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('classes') - .select('name') - .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday']) - ``` - - name: On range columns - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: On `jsonb` columns - description: | - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'), - (2, 'Jane', '{}'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select('name') - .containedBy('address', {}) - ``` - - - - - ```json - { - "data": [ - { - "name": "Jane" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - rangeGt(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeGt' - examples: - - name: With `select()` - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "room_name": "Topaz", - "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)') - ``` - - rangeGte(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeGte' - examples: - - name: With `select()` - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "room_name": "Topaz", - "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)') - ``` - - rangeLt(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeLt' - examples: - - name: With `select()` - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)') - ``` - - rangeLte(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeLte' - examples: - - name: With `select()` - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)') - ``` - - rangeAdjacent(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeAdjacent' - examples: - - name: With `select()` - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)') - ``` - - overlaps(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.overlaps' - examples: - - name: On array columns - description: | - - - - ```sql - create table - issues ( - id int8 primary key, - title text, - tags text[] - ); - - insert into - issues (id, title, tags) - values - (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']), - (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('issues') - .select('title') - .overlaps('tags', ['is:closed', 'severity:high']) - ``` - - - - - ```json - { - "data": [ - { - "title": "Cache invalidation is not working" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('issues') - .select('title') - .overlaps('tags', ['is:closed', 'severity:high']) - ``` - - name: On range columns - description: | - Postgres supports a number of [range - types](https://www.postgresql.org/docs/current/rangetypes.html). You - can filter on range columns using the string representation of range - values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - # TODO: schema & result - textSearch(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.textSearch' - notes: - - For more information, see [Postgres full text search](/docs/guides/database/full-text-search). - examples: - - name: Text search - js: | - ```ts - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - config: 'english' - }) - ``` - - name: Basic normalization - description: Uses PostgreSQL's `plainto_tsquery` function. - js: | - ```ts - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'plain', - config: 'english' - }) - ``` - - name: Full normalization - description: Uses PostgreSQL's `phraseto_tsquery` function. - js: | - ```ts - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'phrase', - config: 'english' - }) - ``` - - name: Websearch - description: | - Uses PostgreSQL's `websearch_to_tsquery` function. - This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used - with advanced operators. - - - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. - - `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. - - `OR`: the word “or” will be converted to the | operator. - - `-`: a dash will be converted to the ! operator. - - js: | - ```ts - const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat or cat'`, { - type: 'websearch', - config: 'english' - }) - ``` - - match(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.match' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .match({ id: 2, name: 'Albania' }) - ``` - - - - - ```json - { - "data": [ - { - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .match({ id: 2, name: 'Albania' }) - ``` - - not(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.not' - notes: | - not() expects you to use the raw PostgREST syntax for the filter values. - - ```ts - .not('id', 'in', '(5,6,7)') // Use `()` for `in` filter - .not('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values - ``` - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'null'), - (2, null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .not('name', 'is', null) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "null" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .not('name', 'is', null) - ``` - - or(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.or' - notes: | - or() expects you to use the raw PostgREST syntax for the filter names and values. - - ```ts - .or('id.in.(5,6,7), arraycol.cs.{"a","b"}') // Use `()` for `in` filter, `{}` for array values and `cs` for `contains()`. - .or('id.in.(5,6,7), arraycol.cd.{"a","b"}') // Use `cd` for `containedBy()` - ``` - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .or('id.eq.2,name.eq.Algeria') - ``` - - - - - ```json - { - "data": [ - { - "name": "Albania" - }, - { - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .or('id.eq.2,name.eq.Algeria') - ``` - - name: Use `or` with `and` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .or('id.gt.3,and(id.eq.1,name.eq.Afghanistan)') - ``` - - - - - - ```json - { - "data": [ - { - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - name: Use `or` on foreign tables - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities!inner ( - name - ) - `) - .or('country_id.eq.1,name.eq.Beijing', { foreignTable: 'cities' }) - ``` - - - - - ```json - { - "data": [ - { - "name": "Germany", - "cities": [ - { - "name": "Munich" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - filter(): - $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.filter' - notes: | - filter() expects you to use the raw PostgREST syntax for the filter values. - - ```ts - .filter('id', 'in', '(5,6,7)') // Use `()` for `in` filter - .filter('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values - ``` - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .filter('name', 'in', '("Algeria","Japan")') - ``` - - - - - ```json - { - "data": [ - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .filter('name', 'in', '("Algeria","Japan")') - ``` - - name: On a foreign table - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities!inner ( - name - ) - `) - .filter('cities.name', 'eq', 'Bali') - ``` - - - - - ```json - { - "data": [ - { - "name": "Indonesia", - "cities": [ - { - "name": "Bali" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities!inner ( - name - ) - `) - .filter('cities.name', 'eq', 'Bali') - ``` - - Using Modifiers: - description: | - Filters work on the row level—they allows you to return rows that - only match certain conditions without changing the shape of the rows. - Modifiers are everything that don't fit that definition—allowing you to - change the format of the response (e.g., returning a CSV string). - - Modifiers must be specified after filters. Some modifiers only apply for - queries that return rows (e.g., `select()` or `rpc()` on a function that - returns a table response). - - db.modifiers.select(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.select' - title: select() - examples: - - name: With `upsert()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Albania' }) - ``` - - - - - ```json - { - "status": 201, - "statusText": "Created" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Algeria' }) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Algeria" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Algeria' }) - .select() - ``` - - order(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.order' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .order('name', { ascending: false }) - ``` - - - - - ```json - { - "data": [ - { - "id": 3, - "name": "Algeria" - }, - { - "id": 2, - "name": "Albania" - }, - { - "id": 1, - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('cities') - .select('name', 'country_id') - .order('id', { ascending: false }) - ``` - - name: On a foreign table - description: | - Ordering on foreign tables doesn't affect the ordering of - the parent table. - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'United States'), - (2, 'Vanuatu'); - insert into - cities (id, country_id, name) - values - (1, 1, 'Atlanta'), - (2, 1, 'New York City'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities ( - name - ) - `) - .order('name', { foreignTable: 'cities', ascending: false }) - ``` - - - - - ```json - { - "data": [ - { - "name": "United States", - "cities": [ - { - "name": "New York City" - }, - { - "name": "Atlanta" - } - ] - }, - { - "name": "Vanuatu", - "cities": [] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - limit(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.limit' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .limit(1) - ``` - - - - - ```json - { - "data": [ - { - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .limit(1) - ``` - - name: On a foreign table - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'United States'); - insert into - cities (id, country_id, name) - values - (1, 1, 'Atlanta'), - (2, 1, 'New York City'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities ( - name - ) - `) - .limit(1, { foreignTable: 'cities' }) - ``` - - - - - ```json - { - "data": [ - { - "name": "United States", - "cities": [ - { - "name": "Atlanta" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - - range(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.range' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .range(0, 1) - ``` - - - - - ```json - { - "data": [ - { - "name": "Afghanistan" - }, - { - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .range(0, 1) - ``` - - db.abortSignal(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.abortSignal' - title: abortSignal() - examples: - - name: Aborting requests in-flight - description: | - You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled. - - - - - ```ts - const ac = new AbortController() - ac.abort() - const { data, error } = await supabase - .from('very_big_table') - .select() - .abortSignal(ac.signal) - ``` - - - - - ```json - { - "error": { - "message": "FetchError: The user aborted a request.", - "details": "", - "hint": "", - "code": "" - }, - "status": 400, - "statusText": "Bad Request" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const ac = new AbortController() - ac.abort() - const { data, error } = await supabase - .from('very_big_table') - .select() - .abortSignal(ac.signal) - ``` - - single(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.single' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .limit(1) - .single() - ``` - - - - - ```json - { - "data": { - "name": "Afghanistan" - }, - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .limit(1) - .single() - ``` - - maybeSingle(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.maybeSingle' - examples: - - name: With `select()` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', 'Singapore') - .maybeSingle() - ``` - - - - - ```json - { - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', 'Singapore') - .maybeSingle() - ``` - - db.csv(): - $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.csv' - title: csv() - examples: - - name: Return data as CSV - description: | - By default, the data is returned in JSON format, but can also be returned as Comma Separated Values. - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .csv() - ``` - - - - - ```json - { - "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria", - "status": 200, - "statusText": "OK" - } - ``` - - - - hideCodeBlock: true - isSpotlight: true - js: | - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .csv() - ``` - - # NOTE: Not available on currently deployed PostgREST - # db.geojson(): - # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.geojson' - # title: geojson() - - # NOTE: Not available on currently deployed PostgREST - # db.explain(): - # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.explain' - # title: explain() - - # NOTE: Not available on currently deployed PostgREST - # db.rollback(): - # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.rollback' - # title: rollback() - # examples: - # - name: With `delete()` - # description: | - #

      - # Schema - - # ```sql - # create table - # countries (id int8 primary key, name text); - - # insert into - # countries (id, name) - # values - # (1, 'Spain'); - # ``` - #
      - - # ```ts - # const { error } = await supabase - # .from('countries') - # .delete() - # .eq('id', 1) - # .rollback() - # ``` - - #
      - # Result - - # ```json - # { - # "status": 204, - # "statusText": "No Content" - # } - # ``` - #
      - - # ```ts - # const { data, error } = await supabase - # .from('countries') - # .select() - # ``` - - #
      - # Result - - # ```json - # { - # "data": [ - # { - # "id": 1, - # "name": "Spain" - # } - # ], - # "status": 200, - # "statusText": "OK" - # } - # ``` - #
      - # hideCodeBlock: true - # isSpotlight: true - # js: | - # ```ts - # const { error } = await supabase - # .from('countries') - # .delete() - # .eq('id', 1) - # ``` - - invoke(): - title: 'invoke()' - description: | - Invoke a Supabase Function. - $ref: '@supabase/functions-js.FunctionsClient.invoke' - notes: | - - Requires an Authorization header. - - Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. - - When you pass in a body to your function, we automatically attach the Content-Type header for `Blob`, `ArrayBuffer`, `File`, `FormData` and `String`. If it doesn't match any of these types we assume the payload is `json`, serialise it and attach the `Content-Type` header as `application/json`. You can override this behaviour by passing in a `Content-Type` header of your own. - - Responses are automatically parsed as `json`, `blob` and `form-data` depending on the `Content-Type` header sent by your function. Responses are parsed as `text` by default. - examples: - - name: Basic invocation. - description: - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.functions.invoke('hello', { - body: { foo: 'bar' } - }) - ``` - - name: Error handling. - description: | - A `FunctionsHttpError` error is returned if your function throws an error, `FunctionsRelayError` if the Supabase Relay has an error processing your function and `FunctionsFetchError` if there is a network error in calling your function. - isSpotlight: true - js: | - ```js - import { FunctionsHttpError, FunctionsRelayError, FunctionsFetchError } from "@supabase/supabase-js"; - - const { data, error } = await supabase.functions.invoke('hello', { - headers: { - "my-custom-header": 'my-custom-header-value' - }, - body: { foo: 'bar' } - }) - - if (error instanceof FunctionsHttpError) { - console.log('Function returned an error', error.message) - } else if (error instanceof FunctionsRelayError) { - console.log('Relay error:', error.message) - } else if (error instanceof FunctionsFetchError) { - console.log('Fetch error:', error.message) - } - ``` - - name: Passing custom headers. - description: | - You can pass custom headers to your function. Note: supabase-js automatically passes the `Authorization` header with the signed in user's JWT. - isSpotlight: true - js: | - ```js - const { data, error } = await supabase.functions.invoke('hello', { - headers: { - "my-custom-header": 'my-custom-header-value' - }, - body: { foo: 'bar' } - }) - ``` - - subscribe(): - title: 'on().subscribe()' - $ref: '@supabase/realtime-js.RealtimeChannel.on' - notes: | - - Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime). - - Row level security is not applied to delete statements. - - If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;` - - When a delete occurs, the contents of old_record will be broadcast to all subscribers to that table so ensure that each table's replica identity only contains information that is safe to expose publicly. - - The channel name must exactly match the schema/table/filter you want to listen to separated by colons. See below examples for additional context. - examples: - - name: Listen to all database changes - isSpotlight: true - js: | - ```js - supabase - .channel('*') - .on('postgres_changes', { event: '*', schema: '*' }, payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to a specific table - js: | - ```js - supabase - .channel('public:countries') - .on('postgres_changes', { event: '*', schema: 'public', table: 'countries' }, payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to inserts - js: | - ```js - supabase - .channel('public:countries') - .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to updates - description: | - By default, Supabase will send only the updated record. If you want to receive the previous values as well you can - enable full replication for the table you are listening to: - - ```sql - alter table "your_table" replica identity full; - ``` - js: | - ```js - supabase - .channel('public:countries') - .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries' }, payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to deletes - description: | - By default, Supabase does not send deleted records. If you want to receive the deleted record you can - enable full replication for the table you are listening too: - - ```sql - alter table "your_table" replica identity full; - ``` - js: | - ```js - supabase - .channel('public:countries') - .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, payload => { - console.log('Change received!', payload) - }) - .subscribe() - ``` - - name: Listening to multiple events - description: You can chain listeners if you want to listen to multiple events for each table. - js: | - ```js - supabase - .channel('public:countries') - .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, handleRecordInserted) - .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, handleRecordDeleted) - .subscribe() - ``` - - name: Listening to row level changes - description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - notes: | - - ``eq`` filter works with all database types as under the hood, it's casting both the filter value and the database value to the correct type and then comparing them. - js: | - ```js - supabase - .channel('public:countries:id=eq.200') - .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries', filter: 'id=eq.200' }, handleRecordUpdated) - .subscribe() - ``` - - getChannels(): - title: 'getChannels()' - $ref: '@supabase/supabase-js.index.SupabaseClient.getChannels' - examples: - - name: Get all channels - isSpotlight: true - js: | - ```js - const channels = supabase.getChannels() - ``` - - removeChannel(): - title: 'removeChannel()' - $ref: '@supabase/supabase-js.index.SupabaseClient.removeChannel' - notes: | - - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - examples: - - name: Removes a channel - isSpotlight: true - js: | - ```js - supabase.removeChannel(myChannel) - ``` - - removeAllChannels(): - title: 'removeAllChannels()' - $ref: '@supabase/supabase-js.index.SupabaseClient.removeAllChannels' - notes: | - - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - examples: - - name: Remove all channels - isSpotlight: true - js: | - ```js - supabase.removeAllChannels() - ``` - - storage.listBuckets(): - title: 'listBuckets()' - $ref: '@supabase/storage-js.packages/StorageBucketApi.default.listBuckets' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: `select` - - `objects` table permissions: none - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: List buckets - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .listBuckets() - ``` - - storage.getBucket(): - title: 'getBucket()' - $ref: '@supabase/storage-js.packages/StorageBucketApi.default.getBucket' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: `select` - - `objects` table permissions: none - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Get bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .getBucket('avatars') - ``` - - storage.createBucket(): - title: 'createBucket()' - $ref: '@supabase/storage-js.packages/StorageBucketApi.default.createBucket' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: `insert` - - `objects` table permissions: none - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Create bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .createBucket('avatars', { public: false }) - ``` - - storage.emptyBucket(): - title: 'emptyBucket()' - $ref: '@supabase/storage-js.packages/StorageBucketApi.default.emptyBucket' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: `select` - - `objects` table permissions: `select` and `delete` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Empty bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .emptyBucket('avatars') - ``` - storage.updateBucket(): - title: 'updateBucket()' - $ref: '@supabase/storage-js.packages/StorageBucketApi.default.updateBucket' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: `update` - - `objects` table permissions: none - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Update bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .updateBucket('avatars', { public: false }) - ``` - - storage.deleteBucket(): - title: 'deleteBucket()' - $ref: '@supabase/storage-js.packages/StorageBucketApi.default.deleteBucket' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: `select` and `delete` - - `objects` table permissions: none - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Delete bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .deleteBucket('avatars') - ``` - - storage.from.upload(): - title: 'from.upload()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.upload' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `insert` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below. - examples: - - name: Upload file - isSpotlight: true - js: | - ```js - const avatarFile = event.target.files[0] - const { data, error } = await supabase - .storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false - }) - ``` - - name: Upload file using `ArrayBuffer` from base64 file data - js: | - ```js - import { decode } from 'base64-arraybuffer' - - const { data, error } = await supabase - .storage - .from('avatars') - .upload('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png' - }) - ``` - - storage.from.update(): - title: 'from.update()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.update' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `update` and `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below. - examples: - - name: Update file - isSpotlight: true - js: | - ```js - const avatarFile = event.target.files[0] - const { data, error } = await supabase - .storage - .from('avatars') - .update('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false - }) - ``` - - name: Update file using `ArrayBuffer` from base64 file data - js: | - ```js - import {decode} from 'base64-arraybuffer' - - const { data, error } = await supabase - .storage - .from('avatars') - .update('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png' - }) - ``` - - storage.from.move(): - title: 'from.move()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.move' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `update` and `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Move file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png') - ``` - - storage.from.copy(): - title: 'from.copy()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.copy' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `insert` and `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Copy file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .copy('public/avatar1.png', 'private/avatar2.png') - ``` - - storage.from.createSignedUrl(): - title: 'from.createSignedUrl()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.createSignedUrl' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Create Signed URL - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .createSignedUrl('folder/avatar1.png', 60) - ``` - - storage.from.createSignedUrls(): - title: 'from.createSignedUrls()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.createSignedUrls' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Create Signed URLs - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) - ``` - - storage.from.getPublicUrl(): - title: 'from.getPublicUrl()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.getPublicUrl' - notes: | - - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: none - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Returns the URL for an asset in a public bucket - isSpotlight: true - js: | - ```js - const { data } = supabase - .storage - .from('public-bucket') - .getPublicUrl('folder/avatar1.png') - ``` - - storage.from.download(): - title: 'from.download()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.download' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Download file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .download('folder/avatar1.png') - ``` - - storage.from.remove(): - title: 'from.remove()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.remove' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `delete` and `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: Delete file - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .remove(['folder/avatar1.png']) - ``` - - storage.from.list(): - title: 'from.list()' - $ref: '@supabase/storage-js.packages/StorageFileApi.default.list' - notes: | - - RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` - - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - examples: - - name: List files in a bucket - isSpotlight: true - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, - }) - ``` - - name: Search files in a bucket - js: | - ```js - const { data, error } = await supabase - .storage - .from('avatars') - .list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, - search: 'jon' - }) - ``` diff --git a/spec/supabase_js_v2.yml b/spec/supabase_js_v2.yml index 6bc7533f139..64924a402a4 100644 --- a/spec/supabase_js_v2.yml +++ b/spec/supabase_js_v2.yml @@ -136,13 +136,13 @@ functions: title: 'signUp()' $ref: '@supabase/gotrue-js.GoTrueClient.signUp' notes: | - - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/settings). + - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/providers). - **Confirm email** determines if users need to confirm their email address after signing up. - If **Confirm email** is enabled, a `user` is returned but `session` is null. - If **Confirm email** is disabled, both a `user` and a `session` are returned. - - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings). + - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/url-configuration). - If signUp() is called for an existing confirmed user: - - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned. + - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/providers), an obfuscated/fake user object is returned. - If **Confirm email** is disabled, the error message, `User already registered` is returned. - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser). examples: @@ -360,7 +360,7 @@ functions: notes: | - In order to use the `updateUser()` method, the user needs to be signed in first. - By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). + To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/providers). examples: - id: update-the-email-for-an-authenticated-user name: Update the email for an authenticated user @@ -401,7 +401,7 @@ functions: isSpotlight: true code: | ```js - const { data, error } = supabase.auth.setSession({ + const { data, error } = supabase.auth.setSession({ access_token, refresh_token ) @@ -433,7 +433,7 @@ functions: $ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange' notes: | - Types of auth events: `SIGNED_IN`, `SIGNED_OUT`, `TOKEN_REFRESHED`, `USER_UPDATED`, `PASSWORD_RECOVERY` - - Currently, `onAuthStateChange()` does not work across tabs. + - Currently, `onAuthStateChange()` does not work across tabs. For instance, in the case of a password reset flow, the original tab which requested for the password reset link will not receive the `SIGNED_IN` and `PASSWORD_RECOVERY` event when the user clicks on the link. examples: @@ -453,7 +453,7 @@ functions: supabase.auth.onAuthStateChange((event, session) => { if (event == 'PASSWORD_RECOVERY') { console.log('PASSWORD_RECOVERY', session) - + // show screen to update user's password showPasswordResetScreen(true) } @@ -509,8 +509,8 @@ functions: isSpotlight: true code: | ```js - const { data, error } = await supabase.auth.mfa.enroll({ - factorType: 'totp' + const { data, error } = await supabase.auth.mfa.enroll({ + factorType: 'totp' }) // Use the id to create a challenge. @@ -530,7 +530,7 @@ functions: isSpotlight: true code: | ```js - const { data, error } = await supabase.auth.mfa.challenge({ + const { data, error } = await supabase.auth.mfa.challenge({ factorId: '34e770dd-9ff9-416c-87fa-43b31d7ef225' }) ``` @@ -545,9 +545,9 @@ functions: isSpotlight: true code: | ```js - const { data, error } = await supabase.auth.mfa.verify({ + const { data, error } = await supabase.auth.mfa.verify({ factorId: '34e770dd-9ff9-416c-87fa-43b31d7ef225', - challengeId: '4034ae6f-a8ce-4fb5-8ee5-69a5863a7c15', + challengeId: '4034ae6f-a8ce-4fb5-8ee5-69a5863a7c15', code: '123456' }) ``` @@ -565,7 +565,7 @@ functions: ```js const { data, error } = await supabase.auth.mfa.challengeAndVerify({ factorId: '34e770dd-9ff9-416c-87fa-43b31d7ef225', - challengeId: '4034ae6f-a8ce-4fb5-8ee5-69a5863a7c15', + challengeId: '4034ae6f-a8ce-4fb5-8ee5-69a5863a7c15', code: '123456' }) ``` @@ -729,18 +729,18 @@ functions: title: 'resetPasswordForEmail()' $ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail' notes: | - - The password reset flow consist of 2 broad steps: (i) Allow the user to login via the password reset link; (ii) Update the user's password. - - The `resetPasswordForEmail()` only sends a password reset link to the user's email. + - The password reset flow consist of 2 broad steps: (i) Allow the user to login via the password reset link; (ii) Update the user's password. + - The `resetPasswordForEmail()` only sends a password reset link to the user's email. To update the user's password, see [`updateUser()`](/docs/reference/javascript/auth-updateuser). - - A `SIGNED_IN` and `PASSWORD_RECOVERY` event will be emitted when the password recovery link is clicked. + - A `SIGNED_IN` and `PASSWORD_RECOVERY` event will be emitted when the password recovery link is clicked. You can use [`onAuthStateChange()`](/docs/reference/javascript/auth-onauthstatechange) to listen and invoke a callback function on these events. - When the user clicks the reset link in the email they are redirected back to your application. - You can configure the URL that the user is redirected to with the `redirectTo` parameter. + You can configure the URL that the user is redirected to with the `redirectTo` parameter. See [redirect URLs and wildcards](/docs/guides/auth/overview#redirect-urls-and-wildcards) to add additional redirect URLs to your project. - After the user has been redirected successfully, prompt them for a new password and call `updateUser()`: ```js - const { data, error } = await supabase.auth.updateUser({ - password: new_password + const { data, error } = await supabase.auth.updateUser({ + password: new_password }) ``` examples: @@ -934,10 +934,10 @@ functions: isSpotlight: true code: | ```js - const { data, error } = await supabase.auth.admin.mfa.deleteFactor({ + const { data, error } = await supabase.auth.admin.mfa.deleteFactor({ id: '34e770dd-9ff9-416c-87fa-43b31d7ef225', userId: 'a89baba7-b1b7-440f-b4bb-91026967f66b', - }) + }) ``` - id: select title: 'Fetch data: select()' @@ -1063,96 +1063,7 @@ functions: If you're in a situation where your tables are **NOT** directly related, but instead are joined by a _join table_, you can still use the `select()` method to query the related data. The join table needs - to have the foreign keys as part of its composite primary key. - - - - - ```sql - create table - users ( - id int8 primary key, - name text - ); - create table - teams ( - id int8 primary key, - name text - ); - -- join table - create table - users_teams ( - user_id int8 not null references users, - team_id int8 not null references teams, - -- both foreign keys must be part of a composite primary key - primary key (user_id, team_id) - ); - - insert into - users (id, name) - values - (1, 'Kiran'), - (2, 'Evan'); - insert into - teams (id, name) - values - (1, 'Green'), - (2, 'Blue'); - insert into - users_teams (user_id, team_id) - values - (1, 1), - (1, 2), - (2, 2); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select(` - name, - teams ( - name - ) - `) - ``` - - - - - ```json - { - "data": [ - { - "name": "Kiran", - "teams": [ - { - "name": "Green" - }, - { - "name": "Blue" - } - ] - }, - { - "name": "Evan", - "teams": [ - { - "name": "Blue" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - + to have the foreign keys as part of its composite primary key. hideCodeBlock: true - id: query-the-same-foreign-table-multiple-times name: Query the same foreign table multiple times @@ -1212,69 +1123,6 @@ functions: If you need to query the same foreign table twice, use the name of the joined column to identify which join to use. You can also give each column an alias. - - - - - ```sql - create table - users (id int8 primary key, name text); - - create table - messages ( - sender_id int8 not null references users, - receiver_id int8 not null references users, - content text - ); - - insert into - users (id, name) - values - (1, 'Kiran'), - (2, 'Evan'); - - insert into - messages (sender_id, receiver_id, content) - values - (1, 2, '👋'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('messages') - .select(` - content, - from:sender_id(name), - to:receiver_id(name) - `) - ``` - - - - - ```json - { - "data": [ - { - "content": "👋", - "from": { - "name": "Kiran" - }, - "to": { - "name": "Evan" - } - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: filtering-through-foreign-tables name: Filtering through foreign tables @@ -1328,90 +1176,7 @@ functions: description: | If the filter on a foreign table's column is not satisfied, the foreign table returns `[]` or `null` but the parent table is not filtered out. - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('cities') - .select('name, countries(*)') - .eq('countries.name', 'Estonia') - ``` - - - - - ```json - { - "data": [ - { - "name": "Bali", - "countries": null - }, - { - "name": "Munich", - "countries": null - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - If you want to filter out the parent table rows, use the `!inner` hint: - - - - - ```ts - const { data, error } = await supabase - .from('cities') - .select('name, countries!inner(*)') - .eq('countries.name', 'Estonia') - ``` - - - - - ```json - { - "data": [], - "status": 200, - "statusText": "OK" - } - ``` - - - + If you want to filter out the parent table rows, use the `!inner` hint hideCodeBlock: true - id: querying-with-count-option name: Querying with count option @@ -1444,46 +1209,7 @@ functions: ``` description: | You can get the number of rows by using the - [count](/docs/reference/javascript/select#parameters) option. For - example, to get the table count without returning all rows: - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { count, error } = await supabase - .from('countries') - .select('*', { count: 'exact', head: true }) - ``` - - - - - ```json - { - "count": 3, - "status": 200, - "statusText": "OK" - } - ``` - - - + [count](/docs/reference/javascript/select#parameters) option. hideCodeBlock: true - id: querying-json-data name: Querying JSON data @@ -1530,55 +1256,6 @@ functions: [JSON](/docs/guides/database/json) columns. Postgres offers some [operators](/docs/guides/database/json#query-the-jsonb-data) for querying JSON data. - - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Avdotya', '{"city":"Saint Petersburg"}'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select(` - id, name, - address->city - `) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Avdotya", - "city": "Saint Petersburg" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: insert @@ -1612,63 +1289,6 @@ functions: "statusText": "Created" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .insert({ id: 1, name: 'Denmark' }) - ``` - - - - - ```json - { - "status": 201, - "statusText": "Created" - } - ``` - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Denmark" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: create-a-record-and-return-it @@ -1699,43 +1319,6 @@ functions: "statusText": "Created" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .insert({ id: 1, name: 'Denmark' }) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Denmark" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - hideCodeBlock: true - id: bulk-create name: Bulk create @@ -1770,68 +1353,6 @@ functions: description: | A bulk create operation is handled in a single transaction. If any of the inserts fail, none of the rows are inserted. - - - - - ```sql - create table - countries (id int8 primary key, name text); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .insert([ - { id: 1, name: 'Nepal' }, - { id: 1, name: 'Vietnam' }, - ]) - ``` - - - - - ```json - { - "error": { - "code": "23505", - "details": "Key (id)=(1) already exists.", - "hint": null, - "message": "duplicate key value violates unique constraint \"countries_pkey\"" - }, - "status": 409, - "statusText": "Conflict" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: update @@ -1867,70 +1388,6 @@ functions: "statusText": "No Content" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Taiwan'); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .update({ name: 'Australia' }) - .eq('id', 1) - ``` - - - - - ```json - { - "status": 204, - "statusText": "No Content" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Australia" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: update-a-record-and-return-it @@ -1967,49 +1424,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Taiwan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .update({ name: 'Australia' }) - .eq('id', 1) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Australia" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: updating-json-data name: Updating JSON data @@ -2061,65 +1475,7 @@ functions: description: | Postgres offers some [operators](/docs/guides/database/json#query-the-jsonb-data) for - working with JSON data. - - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210 }'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .update({ - address: { - street: 'Melrose Place', - postcode: 90210 - } - }) - .eq('address->postcode', 90210) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Michael", - "address": { - "street": "Melrose Place", - "postcode": 90210 - } - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - Currently, it is only possible to update the entire JSON document. + working with JSON data. Currently, it is only possible to update the entire JSON document. hideCodeBlock: true - id: upsert title: 'Upsert data: upsert()' @@ -2160,48 +1516,6 @@ functions: "statusText": "Created" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Albania' }) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Albania" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: bulk-upsert-your-data @@ -2244,55 +1558,6 @@ functions: "statusText": "Created" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert([ - { id: 1, name: 'Albania' }, - { id: 2, name: 'Algeria' }, - ]) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Albania" - }, - { - "id": 2, - "name": "Algeria" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - hideCodeBlock: true - id: upserting-into-tables-with-constraints name: Upserting into tables with constraints @@ -2336,90 +1601,8 @@ functions: (primary key) column to determine conflicts. If there is no existing row with the same `id`, `upsert()` inserts a new row, which will fail in this case as there is already a row with `handle` `"saoirse"`. - - - - - ```sql - create table - users ( - id int8 generated by default as identity primary key, - handle text not null unique, - display_name text - ); - - insert into - users (id, handle, display_name) - values - (1, 'saoirse', null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' }) - .select() - ``` - - - - - ```json - { - "error": { - "code": "23505", - "details": "Key (handle)=(saoirse) already exists.", - "hint": null, - "message": "duplicate key value violates unique constraint \"users_handle_key\"" - }, - "status": 409, - "statusText": "Conflict" - } - ``` - - - - Using the `onConflict` option, you can instruct `upsert()` to use - another column with a unique constraint to determine conflicts: - - - - - ```ts - await supabase - .from('users') - .upsert( - { id: 42, handle: 'saoirse', display_name: 'Saoirse' }, - { onConflict: 'handle' }, - ) - const { data, error } = await supabase - .from('users') - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 42, - "handle": "saoirse", - "display_name": "Saoirse" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - + another column with a unique constraint to determine conflicts. hideCodeBlock: true - id: delete @@ -2460,65 +1643,6 @@ functions: "statusText": "No Content" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Spain'); - ``` - - - - - ```ts - const { error } = await supabase - .from('countries') - .delete() - .eq('id', 1) - ``` - - - - - ```json - { - "status": 204, - "statusText": "No Content" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - ``` - - - - - ```json - { - "data": [], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true @@ -2556,36 +1680,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create function hello_world() returns text as $$ - select 'Hello world'; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase.rpc('hello_world') - ``` - - - - - ```json - { - "data": "Hello world", - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: call-a-postgres-function-with-arguments @@ -2609,36 +1703,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create function echo(say text) returns text as $$ - select say; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase.rpc('echo', { say: '👋' }) - ``` - - - - - ```json - { - "data": "👋", - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: bulk-processing name: Bulk processing @@ -2666,41 +1730,7 @@ functions: } ``` description: | - You can process large payloads by passing in an array as an argument: - - - - - ```sql - create function add_one_each(arr int[]) returns int[] as $$ - select array_agg(n + 1) from unnest(arr) as n; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase.rpc('add_one_each', { arr: [1, 2, 3] }) - ``` - - - - - ```json - { - "data": [ - 2, - 3, - 4 - ], - "status": 200, - "statusText": "OK" - } - ``` - - - + You can process large payloads by passing in an array as an argument. hideCodeBlock: true - id: call-a-postgres-function-with-filters name: Call a Postgres function with filters @@ -2742,51 +1772,6 @@ functions: Postgres functions that return tables can also be combined with [Filters](/docs/reference/javascript/using-filters) and [Modifiers](/docs/reference/javascript/using-modifiers). - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'France'), - (2, 'United Kingdom'); - - create function list_stored_countries() returns setof countries as $$ - select * from countries; - $$ language sql; - ``` - - - - - ```ts - const { data, error } = await supabase - .rpc('list_stored_countries') - .eq('id', 1) - .single() - ``` - - - - - ```json - { - "data": { - "id": 1, - "name": "France" - }, - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: using-filters @@ -2914,56 +1899,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210 }'), - (2, 'Jane', null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select() - .eq('address->postcode', 90210) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Michael", - "address": { - "postcode": 90210 - } - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - id: filter-foreign-tables name: Filter Foreign Tables code: | @@ -3020,70 +1955,7 @@ functions: ``` description: | You can filter on foreign tables in your `select()` query using dot - notation: - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities!inner ( - name - ) - `) - .eq('cities.name', 'Bali') - ``` - - - - - ```json - { - "data": [ - { - "name": "Indonesia", - "cities": [ - { - "name": "Bali" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - + notation. ######## TODO CHECK FILTER YAML ERRORS ######## - id: eq title: eq() @@ -3124,50 +1996,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', 'Albania') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: neq @@ -3213,54 +2041,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .neq('name', 'Albania') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Afghanistan" - }, - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: gt @@ -3302,50 +2082,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .gt('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: gte @@ -3391,54 +2127,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .gte('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - }, - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: lt @@ -3480,50 +2168,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .lt('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: lte @@ -3569,54 +2213,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .lte('id', 2) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Afghanistan" - }, - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: like @@ -3647,50 +2243,6 @@ functions: ``` response: | - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .like('name', '%Alba%') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: ilike @@ -3704,7 +2256,7 @@ functions: const { data, error } = await supabase .from('countries') .select() - .like('name', '%alba%') + .ilike('name', '%alba%') ``` data: sql: | @@ -3732,50 +2284,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .like('name', '%alba%') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: is @@ -3817,81 +2325,10 @@ functions: } ``` description: | - Using the `eq()` filter doesn't work when filtering for `null`: + Using the `eq()` filter doesn't work when filtering for `null`. - - + Instead, you need to use `is()`. - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'null'), - (2, null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', null) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "null" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - - - Instead, you need to use `is()`: - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .is('name', null) - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": null - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: in @@ -3937,54 +2374,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .in('name', ['Albania', 'Algeria']) - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "name": "Albania" - }, - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: contains @@ -4028,52 +2417,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - issues ( - id int8 primary key, - title text, - tags text[] - ); - - insert into - issues (id, title, tags) - values - (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']), - (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('issues') - .select('title') - .contains('tags', ['is:open', 'severity:high']) - ``` - - - - - ```json - { - "data": [ - { - "title": "Cache invalidation is not working" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: on-range-columns @@ -4120,54 +2463,6 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: on-jsonb-columns name: On `jsonb` columns @@ -4206,52 +2501,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'), - (2, 'Jane', '{}'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select('name') - .contains('address', { postcode: 90210 }) - ``` - - - - - ```json - { - "data": [ - { - "name": "Michael" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: contained-by @@ -4295,52 +2544,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - classes ( - id int8 primary key, - name text, - days text[] - ); - - insert into - classes (id, name, days) - values - (1, 'Chemistry', array['monday', 'friday']), - (2, 'History', array['monday', 'wednesday', 'thursday']); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('classes') - .select('name') - .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday']) - ``` - - - - - ```json - { - "data": [ - { - "name": "Chemistry" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: on-range-columns @@ -4387,54 +2590,6 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: on-jsonb-columns name: On `jsonb` columns @@ -4473,52 +2628,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - users ( - id int8 primary key, - name text, - address jsonb - ); - - insert into - users (id, name, address) - values - (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'), - (2, 'Jane', '{}'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('users') - .select('name') - .containedBy('address', {}) - ``` - - - - - ```json - { - "data": [ - { - "name": "Jane" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: range-gt @@ -4569,54 +2678,6 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "room_name": "Topaz", - "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true @@ -4668,54 +2729,6 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)') - ``` - - - - - ```json - { - "data": [ - { - "id": 2, - "room_name": "Topaz", - "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true @@ -4767,54 +2780,6 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: range-lte @@ -4865,54 +2830,6 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true @@ -4964,54 +2881,6 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true @@ -5056,52 +2925,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - issues ( - id int8 primary key, - title text, - tags text[] - ); - - insert into - issues (id, title, tags) - values - (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']), - (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('issues') - .select('title') - .overlaps('tags', ['is:closed', 'severity:high']) - ``` - - - - - ```json - { - "data": [ - { - "title": "Cache invalidation is not working" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: on-range-columns @@ -5148,60 +2971,12 @@ functions: types](https://www.postgresql.org/docs/current/rangetypes.html). You can filter on range columns using the string representation of range values. - - - - - ```sql - create table - reservations ( - id int8 primary key, - room_name text, - during tsrange - ); - - insert into - reservations (id, room_name, during) - values - (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'), - (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('reservations') - .select() - .overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)') - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "room_name": "Emerald", - "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true # TODO: schema & result - id: text-search title: textSearch() $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.textSearch' - notes: + notes: | - For more information, see [Postgres full text search](/docs/guides/database/full-text-search). examples: - id: text-search @@ -5302,49 +3077,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .match({ id: 2, name: 'Albania' }) - ``` - - - - - ```json - { - "data": [ - { - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: not @@ -5392,49 +3124,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'null'), - (2, null); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .not('name', 'is', null) - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "null" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: or @@ -5485,52 +3174,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .or('id.eq.2,name.eq.Algeria') - ``` - - - - - ```json - { - "data": [ - { - "name": "Albania" - }, - { - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: use-or-with-and @@ -5567,50 +3210,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .or('id.gt.3,and(id.eq.1,name.eq.Afghanistan)') - ``` - - - - - - ```json - { - "data": [ - { - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: use-or-on-foreign-tables name: Use `or` on foreign tables @@ -5666,69 +3265,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities!inner ( - name - ) - `) - .or('country_id.eq.1,name.eq.Beijing', { foreignTable: 'cities' }) - ``` - - - - - ```json - { - "data": [ - { - "name": "Germany", - "cities": [ - { - "name": "Munich" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: filter @@ -5777,50 +3313,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .filter('name', 'in', '("Algeria","Japan")') - ``` - - - - - ```json - { - "data": [ - { - "id": 3, - "name": "Algeria" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: on-a-foreign-table @@ -5877,69 +3369,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'Germany'), - (2, 'Indonesia'); - insert into - cities (id, country_id, name) - values - (1, 2, 'Bali'), - (2, 1, 'Munich'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities!inner ( - name - ) - `) - .filter('cities.name', 'eq', 'Bali') - ``` - - - - - ```json - { - "data": [ - { - "name": "Indonesia", - "cities": [ - { - "name": "Bali" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: using-modifiers title: Using Modifiers @@ -5990,70 +3419,6 @@ functions: "statusText": "Created" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Albania' }) - ``` - - - - - ```json - { - "status": 201, - "statusText": "Created" - } - ``` - - - - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .upsert({ id: 1, name: 'Algeria' }) - .select() - ``` - - - - - ```json - { - "data": [ - { - "id": 1, - "name": "Algeria" - } - ], - "status": 201, - "statusText": "Created" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: order @@ -6103,58 +3468,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .order('name', { ascending: false }) - ``` - - - - - ```json - { - "data": [ - { - "id": 3, - "name": "Algeria" - }, - { - "id": 2, - "name": "Albania" - }, - { - "id": 1, - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: on-a-foreign-table @@ -6221,76 +3534,6 @@ functions: description: | Ordering on foreign tables doesn't affect the ordering of the parent table. - - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'United States'), - (2, 'Vanuatu'); - insert into - cities (id, country_id, name) - values - (1, 1, 'Atlanta'), - (2, 1, 'New York City'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities ( - name - ) - `) - .order('name', { foreignTable: 'cities', ascending: false }) - ``` - - - - - ```json - { - "data": [ - { - "name": "United States", - "cities": [ - { - "name": "New York City" - }, - { - "name": "Atlanta" - } - ] - }, - { - "name": "Vanuatu", - "cities": [] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: limit @@ -6331,49 +3574,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .limit(1) - ``` - - - - - ```json - { - "data": [ - { - "name": "Afghanistan" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: on-a-foreign-table @@ -6429,68 +3629,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - create table - cities ( - id int8 primary key, - country_id int8 not null references countries, - name text - ); - - insert into - countries (id, name) - values - (1, 'United States'); - insert into - cities (id, country_id, name) - values - (1, 1, 'Atlanta'), - (2, 1, 'New York City'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select(` - name, - cities ( - name - ) - `) - .limit(1, { foreignTable: 'cities' }) - ``` - - - - - ```json - { - "data": [ - { - "name": "United States", - "cities": [ - { - "name": "Atlanta" - } - ] - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true - id: range title: range() @@ -6533,52 +3671,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .range(0, 1) - ``` - - - - - ```json - { - "data": [ - { - "name": "Afghanistan" - }, - { - "name": "Albania" - } - ], - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: abort-signal @@ -6620,38 +3712,8 @@ functions: } ``` description: | - You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled. - - - - - ```ts - const ac = new AbortController() - ac.abort() - const { data, error } = await supabase - .from('very_big_table') - .select() - .abortSignal(ac.signal) - ``` - - - - - ```json - { - "error": { - "message": "FetchError: The user aborted a request.", - "details": "", - "hint": "", - "code": "" - }, - "status": 400, - "statusText": "Bad Request" - } - ``` - - - + You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. + Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled. hideCodeBlock: true isSpotlight: true - id: single @@ -6691,48 +3753,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select('name') - .limit(1) - .single() - ``` - - - - - ```json - { - "data": { - "name": "Afghanistan" - }, - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: maybe-single @@ -6769,45 +3789,6 @@ functions: "statusText": "OK" } ``` - description: | - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .eq('name', 'Singapore') - .maybeSingle() - ``` - - - - - ```json - { - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true - id: csv @@ -6846,45 +3827,6 @@ functions: ``` description: | By default, the data is returned in JSON format, but can also be returned as Comma Separated Values. - - - - - ```sql - create table - countries (id int8 primary key, name text); - - insert into - countries (id, name) - values - (1, 'Afghanistan'), - (2, 'Albania'), - (3, 'Algeria'); - ``` - - - - - ```ts - const { data, error } = await supabase - .from('countries') - .select() - .csv() - ``` - - - - - ```json - { - "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria", - "status": 200, - "statusText": "OK" - } - ``` - - - hideCodeBlock: true isSpotlight: true @@ -6983,7 +3925,6 @@ functions: examples: - id: basic-invocation name: Basic invocation - description: isSpotlight: true code: | ```js diff --git a/studio/README.md b/studio/README.md index 7dd002c04c3..2c4fda0ba60 100644 --- a/studio/README.md +++ b/studio/README.md @@ -19,7 +19,7 @@ As such, the features exposed on Studio for existing deployments are limited to ## Managing Project Settings -Project settings are managed outside of the Dashboard. If you use docker-compose, you should manage the settings in your docker-compose file. If you're deploying Supabase to your own cloud, you should store your secrets and env vars in a vault or secrets manager. +Project settings are managed outside of the Dashboard. If you use docker compose, you should manage the settings in your docker-compose file. If you're deploying Supabase to your own cloud, you should store your secrets and env vars in a vault or secrets manager. ## How to contribute? @@ -38,6 +38,7 @@ Project settings are managed outside of the Dashboard. If you use docker-compose # in /studio npm i # install dependencies +npm run dev:secrets:pull # Supabase internal use: if you are working on the platform version of the Studio npm run dev # start dev server npm run test # run tests npm run -- --watch # run tests in watch mode @@ -50,7 +51,7 @@ Follow the [self-hosting guide](https://supabase.com/docs/guides/hosting/docker) ``` cd .. cd docker -docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up +docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up ``` Once you've got that set up, update `.env` in the studio folder with the corresponding values. diff --git a/studio/__mocks__/hooks.js b/studio/__mocks__/hooks.js index bfacf3748e5..e6d89720b13 100644 --- a/studio/__mocks__/hooks.js +++ b/studio/__mocks__/hooks.js @@ -16,3 +16,5 @@ window.matchMedia = jest.fn().mockReturnValue({ removeEventListener: jest.fn(), }) export const StoreProvider = StoreProvider + +export const withAuth = jest.fn() \ No newline at end of file diff --git a/studio/__mocks__/lib/common/fetch.js b/studio/__mocks__/lib/common/fetch.js index b957643e53b..ab231111a61 100644 --- a/studio/__mocks__/lib/common/fetch.js +++ b/studio/__mocks__/lib/common/fetch.js @@ -1 +1,2 @@ export const get = jest.fn() +export const post = jest.fn() diff --git a/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx b/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx index edb9b9084c3..e6abb30516f 100644 --- a/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx +++ b/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx @@ -17,7 +17,7 @@ export const ForeignKeyFormatter = ( const rowData = deepClone(p.row) rowData[p.column.key] = _value - const { error } = state.rowService!.update(rowData, p.column.key) + const { error } = state.rowService!.update(rowData, p.row, p.column.key) if (error) { if (state.onError) state.onError(error) } else { diff --git a/studio/components/grid/components/grid/Grid.tsx b/studio/components/grid/components/grid/Grid.tsx index 230e40dabf3..07aee22745b 100644 --- a/studio/components/grid/components/grid/Grid.tsx +++ b/studio/components/grid/components/grid/Grid.tsx @@ -41,12 +41,17 @@ export const Grid = memo( ) if (changedColumn) { - const { error } = state.rowService!.update(rowData, changedColumn, (payload) => { - dispatch({ - type: 'EDIT_ROW', - payload, - }) - }) + const { error } = state.rowService!.update( + rowData, + originRowData, + changedColumn, + (payload) => { + dispatch({ + type: 'EDIT_ROW', + payload, + }) + } + ) if (error && onErrorFunc) onErrorFunc(error) } } diff --git a/studio/components/grid/components/header/Header.tsx b/studio/components/grid/components/header/Header.tsx index a3042f00fe0..4ad75e4eaef 100644 --- a/studio/components/grid/components/header/Header.tsx +++ b/studio/components/grid/components/header/Header.tsx @@ -5,7 +5,6 @@ import { saveAs } from 'file-saver' import { useStore } from 'hooks' import FilterDropdown from './filter' import SortPopover from './sort' -import StatusLabel from './StatusLabel' import RefreshButton from './RefreshButton' import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal' import { Sort, Filter } from 'components/grid/types' @@ -41,10 +40,7 @@ const Header: FC = ({ sorts, filters, onAddColumn, onAddRow, header onAddRow={onAddRow} /> )} -
      - {headerActions} - -
      +
      {headerActions}
      ) } diff --git a/studio/components/grid/components/header/RefreshButton.tsx b/studio/components/grid/components/header/RefreshButton.tsx index 518a5f8b721..cea80d66f2e 100644 --- a/studio/components/grid/components/header/RefreshButton.tsx +++ b/studio/components/grid/components/header/RefreshButton.tsx @@ -1,5 +1,6 @@ -import { FC, useState } from 'react' -import { Button, IconRefreshCw } from 'ui' +import { FC, useState, useEffect } from 'react' +import { Button, IconRefreshCw, IconCheck } from 'ui' +import { SupabaseGridQueue } from '../../constants' import { Filter, Sort } from 'components/grid/types' import { useDispatch, useTrackedState } from 'components/grid/store' import { fetchCount, fetchPage } from 'components/grid/utils' @@ -10,10 +11,34 @@ interface Props { } const RefreshButton: FC = ({ sorts, filters }) => { - const [loading, setLoading] = useState(false) const state = useTrackedState() const dispatch = useDispatch() + const [loading, setLoading] = useState(false) + const [status, setStatus] = useState() + + useEffect(() => { + let isMounted = true + let timer: number | null + + SupabaseGridQueue.on('active', () => { + if (timer) clearTimeout(timer) + + if (isMounted) setStatus('saving') + }) + SupabaseGridQueue.on('idle', () => { + if (timer) clearTimeout(timer) + timer = window.setTimeout(() => setStatus(undefined), 2000) + + if (isMounted) setStatus('saved') + }) + + return () => { + isMounted = false + if (timer) clearTimeout(timer) + } + }, []) + async function onClick() { setLoading(true) await fetchCount(state, dispatch, filters) @@ -25,14 +50,20 @@ const RefreshButton: FC = ({ sorts, filters }) => {
      + !status ? ( + + ) : status === 'saved' ? ( + + ) : ( + <> + ) } - onClick={onClick} - loading={loading} + onClick={() => { + if (!status) onClick() + }} + loading={loading || status === 'saving'} > - Refresh + {!status ? 'Refresh' : status === 'saved' ? 'Changes saved' : 'Saving changes'} ) } diff --git a/studio/components/grid/components/header/StatusLabel.tsx b/studio/components/grid/components/header/StatusLabel.tsx deleted file mode 100644 index 21050e11696..00000000000 --- a/studio/components/grid/components/header/StatusLabel.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { useState, FC, useEffect } from 'react' -import * as Tooltip from '@radix-ui/react-tooltip' -import { IconLoader, IconCheck } from 'ui' -import { SupabaseGridQueue } from '../../constants' - -interface Props {} - -const StatusLabel: FC = ({}) => { - const [status, setStatus] = useState() - - useEffect(() => { - let isMounted = true - let timer: number | null - - SupabaseGridQueue.on('active', () => { - if (timer) clearTimeout(timer) - - if (isMounted) setStatus('saving') - }) - SupabaseGridQueue.on('idle', () => { - if (timer) clearTimeout(timer) - timer = window.setTimeout(() => setStatus(undefined), 4000) - - if (isMounted) setStatus('saved') - }) - - return () => { - isMounted = false - if (timer) clearTimeout(timer) - } - }, []) - - return ( -
      - {status === 'saving' ? ( - - - - - - -
      - Saving changes... -
      -
      -
      - ) : status === 'saved' ? ( - - - - - - -
      - All changes saved -
      -
      -
      - ) : ( - <> - )} - - {!status && ( -
      -
      -
      - )} -
      - ) -} -export default StatusLabel diff --git a/studio/components/grid/services/row/SqlRowService.ts b/studio/components/grid/services/row/SqlRowService.ts index 4e4e7226396..5014d78df00 100644 --- a/studio/components/grid/services/row/SqlRowService.ts +++ b/studio/components/grid/services/row/SqlRowService.ts @@ -163,12 +163,21 @@ export class SqlRowService implements IRowService { return rows } - update(row: SupaRow, changedColumn?: string, onRowUpdate?: (value: any) => void) { + update( + row: SupaRow, + originalRow: SupaRow, + changedColumn?: string, + onRowUpdate?: (value: any) => void + ) { const { primaryKeys, error } = this.getPrimaryKeys() if (error) { return { error } } const { idx, ...value } = row + + // Optimistic rendering + if (onRowUpdate) onRowUpdate({ row: value, idx }) + const matchValues: any = {} primaryKeys!.forEach((key) => { matchValues[key] = row[key] @@ -199,6 +208,9 @@ export class SqlRowService implements IRowService { if (error) throw error if (onRowUpdate) onRowUpdate({ row: data[0], idx }) }).catch((error) => { + const { idx, ...originalRowData } = originalRow + // Revert optimistic rendering if any errors + if (onRowUpdate) onRowUpdate({ row: originalRowData, idx }) this.onError(error) }) diff --git a/studio/components/grid/services/row/index.tsx b/studio/components/grid/services/row/index.tsx index 3c63b0685a1..fd60208cba0 100644 --- a/studio/components/grid/services/row/index.tsx +++ b/studio/components/grid/services/row/index.tsx @@ -28,6 +28,7 @@ export interface IRowService { update: ( row: SupaRow, + originalRow: SupaRow, changedColumn?: string, onRowUpdate?: (value: any) => void ) => { row?: SupaRow; error?: ServiceError } diff --git a/studio/components/interfaces/Auth/Auth.types.ts b/studio/components/interfaces/Auth/Auth.types.ts index 9837f672b7e..aebf5e91076 100644 --- a/studio/components/interfaces/Auth/Auth.types.ts +++ b/studio/components/interfaces/Auth/Auth.types.ts @@ -111,6 +111,7 @@ export interface AuthConfig { OPERATOR_TOKEN: string | null PASSWORD_MIN_LENGTH: number RATE_LIMIT_EMAIL_SENT: number + RATE_LIMIT_SMS_SENT: number RATE_LIMIT_HEADER: string | null RATE_LIMIT_TOKEN_REFRESH: number RATE_LIMIT_VERIFY: number diff --git a/studio/components/interfaces/Billing/AddNewPaymentMethodModal/AddNewPaymentMethodModal.tsx b/studio/components/interfaces/Billing/AddNewPaymentMethodModal/AddNewPaymentMethodModal.tsx index 8e8e7e865b6..f8c52edd2eb 100644 --- a/studio/components/interfaces/Billing/AddNewPaymentMethodModal/AddNewPaymentMethodModal.tsx +++ b/studio/components/interfaces/Billing/AddNewPaymentMethodModal/AddNewPaymentMethodModal.tsx @@ -1,9 +1,11 @@ -import { FC, useEffect, useState } from 'react' -import { IconLoader, Modal } from 'ui' +import HCaptcha from '@hcaptcha/react-hcaptcha' import { loadStripe } from '@stripe/stripe-js' import { Elements } from '@stripe/react-stripe-js' +import { FC, useCallback, useEffect, useState } from 'react' +import { Modal } from 'ui' import { useStore } from 'hooks' +import { useIsHCaptchaLoaded } from 'stores/hcaptcha-loaded-store' import { post } from 'lib/common/fetch' import { API_URL, STRIPE_PUBLIC_KEY } from 'lib/constants' import AddPaymentMethodForm from './AddPaymentMethodForm' @@ -20,16 +22,49 @@ const AddNewPaymentMethodModal: FC = ({ visible, returnUrl, onCancel }) = const { ui } = useStore() const [intent, setIntent] = useState() - useEffect(() => { - if (visible) { - setupIntent() - } - }, [visible]) + const captchaLoaded = useIsHCaptchaLoaded() - const setupIntent = async () => { + const [captchaToken, setCaptchaToken] = useState(null) + const [captchaRef, setCaptchaRef] = useState(null) + + const captchaRefCallback = useCallback((node) => { + setCaptchaRef(node) + }, []) + + useEffect(() => { + const loadPaymentForm = async () => { + if (visible && captchaRef && captchaLoaded) { + let token = captchaToken + + try { + if (!token) { + const captchaResponse = await captchaRef.execute({ async: true }) + token = captchaResponse?.response ?? null + } + } catch (error) { + return + } + + await setupIntent(token ?? undefined) + resetCaptcha() + } + } + + loadPaymentForm() + }, [visible, captchaRef, captchaLoaded]) + + const resetCaptcha = () => { + setCaptchaToken(null) + captchaRef?.resetCaptcha() + } + + const setupIntent = async (hcaptchaToken: string | undefined) => { setIntent(undefined) + const orgSlug = ui.selectedOrganization?.slug ?? '' - const intent = await post(`${API_URL}/organizations/${orgSlug}/payments/setup-intent`, {}) + const intent = await post(`${API_URL}/organizations/${orgSlug}/payments/setup-intent`, { + hcaptchaToken, + }) if (intent.error) { return ui.setNotification({ @@ -37,9 +72,9 @@ const AddNewPaymentMethodModal: FC = ({ visible, returnUrl, onCancel }) = message: intent.error.message, error: intent.error, }) + } else { + setIntent(intent) } - - setIntent(intent) } const options = { @@ -47,27 +82,43 @@ const AddNewPaymentMethodModal: FC = ({ visible, returnUrl, onCancel }) = appearance: { theme: 'night', labels: 'floating' }, } as any + const onLocalCancel = () => { + setIntent(undefined) + return onCancel() + } + return ( - -
      - {intent !== undefined ? ( + // We cant display the hCaptcha in the modal, as the modal auto-closes when clicking the captcha + // So we only show the modal if the captcha has been executed successfully (intent loaded) + <> + { + setCaptchaToken(token) + }} + onClose={onLocalCancel} + onExpire={() => { + setCaptchaToken(null) + }} + /> + + +
      - + - ) : ( -
      - -
      - )} -
      -
      +
      +
      + ) } diff --git a/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts b/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts index 093065f6d4c..6ecb12c6576 100644 --- a/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts +++ b/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts @@ -33,7 +33,7 @@ export const formatComputeSizes = (addons: SubscriptionAddon[]) => { metadata: { default_price_id: undefined, supabase_prod_id: 'addon_instance_micro', - features: '2 CPUs • 1GB memory • 2,085Mbps Disk IO', + features: '2-core ARM (shared) • 1GB memory • 2,085Mbps Disk IO', }, prices: [ { diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx index 1b5262cc216..080b518db15 100644 --- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx +++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx @@ -1,6 +1,6 @@ import { FC } from 'react' import Link from 'next/link' -import { Badge, Button, Radio } from 'ui' +import { Badge, Button, IconExternalLink, Radio } from 'ui' import { useFlag, useParams } from 'hooks' import { getProductPrice } from '../Billing.utils' @@ -25,14 +25,23 @@ const ComputeSizeSelection: FC = ({ return (
      -
      -
      -

      Database add-ons

      - Optional +
      +
      +
      +

      Compute add-ons

      + Optional +
      +

      + Choose the database instance size that best fits your needs +

      -

      - Choose the database instance size that best fits your needs -

      + + + + +
      {addonUpdateDisabled ? ( diff --git a/studio/components/interfaces/Billing/Billing.utils.ts b/studio/components/interfaces/Billing/Billing.utils.ts index 84e1e448694..4bad6ed40a7 100644 --- a/studio/components/interfaces/Billing/Billing.utils.ts +++ b/studio/components/interfaces/Billing/Billing.utils.ts @@ -77,7 +77,7 @@ export const formSubscriptionUpdatePayload = ( ...(tierPriceId && { tier: tierPriceId.id }), addons, proration_date, - payment_method: selectedPaymentMethod, + payment_method: selectedPaymentMethod } } diff --git a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx index 1755c1dc42e..969b5d58993 100644 --- a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx +++ b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx @@ -1,4 +1,4 @@ -import { FC, useState, useEffect } from 'react' +import { FC, useState, useEffect, useRef } from 'react' import { useRouter } from 'next/router' import { Transition } from '@headlessui/react' @@ -6,6 +6,7 @@ import { useStore, useFlag } from 'hooks' import { getURL } from 'lib/helpers' import { post, patch } from 'lib/common/fetch' import { API_URL, PROJECT_STATUS } from 'lib/constants' +import HCaptcha from '@hcaptcha/react-hcaptcha' import Divider from 'components/ui/Divider' import { SubscriptionAddon } from './AddOns/AddOns.types' @@ -45,6 +46,9 @@ const EnterpriseUpdate: FC = ({ const isCustomDomainsEnabled = useFlag('customDomains') const isPITRSelfServeEnabled = useFlag('pitrSelfServe') + const [captchaToken, setCaptchaToken] = useState(null) + const captchaRef = useRef(null) + const projectId = ui.selectedProject?.id ?? -1 const projectRef = ui.selectedProject?.ref ?? 'default' const projectRegion = ui.selectedProject?.region ?? '' @@ -127,8 +131,45 @@ const EnterpriseUpdate: FC = ({ setIsRefreshingPreview(false) } + const resetCaptcha = () => { + setCaptchaToken(null) + captchaRef.current?.resetCaptcha() + } + + const beforeConfirmPayment = async (): Promise => { + setIsSubmitting(true) + let token = captchaToken + + try { + if (!token) { + const captchaResponse = await captchaRef.current?.execute({ async: true }) + token = captchaResponse?.response ?? null + setCaptchaToken(token) + } + } catch (error) { + setIsSubmitting(false) + return false + } + + setIsSubmitting(false) + return true + } + // Last todo to support enterprise billing on dashboard + E2E test const onConfirmPayment = async () => { + setIsSubmitting(true) + let token = captchaToken + + try { + if (!token) { + const captchaResponse = await captchaRef.current?.execute({ async: true }) + token = captchaResponse?.response ?? null + } + } catch (error) { + setIsSubmitting(false) + return + } + const payload = { ...formSubscriptionUpdatePayload( currentSubscription, @@ -140,9 +181,9 @@ const EnterpriseUpdate: FC = ({ ), tier: currentSubscription.tier.price_id, } - - setIsSubmitting(true) const res = await patch(`${API_URL}/projects/${projectRef}/subscription`, payload) + resetCaptcha() + if (res?.error) { ui.setNotification({ category: 'error', @@ -184,12 +225,15 @@ const EnterpriseUpdate: FC = ({ enterTo="transform opacity-100 translate-x-0" className="flex w-full items-start justify-between" > -
      +
      -

      Change your project's subscription

      +
      +

      Change your project's subscription

      +
      +

      @@ -269,7 +313,21 @@ const EnterpriseUpdate: FC = ({ onSelectAddNewPaymentMethod={() => { setShowAddPaymentMethodModal(true) }} + beforeConfirmPayment={beforeConfirmPayment} onConfirmPayment={onConfirmPayment} + captcha={ + { + setCaptchaToken(token) + }} + onExpire={() => { + setCaptchaToken(null) + }} + /> + } />

      diff --git a/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx b/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx index c1838f7c233..9cda2b5aa30 100644 --- a/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx +++ b/studio/components/interfaces/Billing/ExitSurvey/ExitSurvey.tsx @@ -11,6 +11,7 @@ import { CANCELLATION_REASONS } from '../Billing.constants' import { UpdateSuccess } from '../' import { SubscriptionPreview } from '../Billing.types' import { StripeSubscription } from 'components/interfaces/Billing' +import HCaptcha from '@hcaptcha/react-hcaptcha' interface Props { freeTier: any @@ -24,6 +25,9 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { const projectId = ui.selectedProject?.id ?? -1 const projectRef = ui.selectedProject?.ref + const captchaRef = useRef(null) + const [captchaToken, setCaptchaToken] = useState(null) + const formRef = useRef() const initialValues = { message: '' } @@ -38,7 +42,7 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { const [subscriptionPreview, setSubscriptionPreview] = useState() // Anything above a micro instance size will involve a change in compute size - const willChangeComputeSize = (subscription?.addons ?? []).length > 0 + // as downgrading back to free will bring the project back to micro const currentComputeSize = subscription?.addons.find((option) => option.supabase_prod_id.includes('addon_instance') ) @@ -59,7 +63,7 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { } } - const getDowngradeSuccessMessage = () => { + const getDowngradeRefundMessage = () => { return `A total of $${returnedAmount} will be refunded as credits on ${billingDate.toLocaleDateString( 'en-US', { @@ -88,7 +92,20 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { }) } - if (willChangeComputeSize) { + setIsSubmitting(true) + let token = captchaToken + + try { + if (!token) { + const captchaResponse = await captchaRef.current?.execute({ async: true }) + token = captchaResponse?.response ?? null + } + } catch (error) { + setIsSubmitting(false) + return + } + + if (currentComputeSize !== undefined) { setMessage(values.message) return setShowConfirmModal(true) } else { @@ -96,6 +113,11 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { } } + const resetCaptcha = () => { + setCaptchaToken(null) + captchaRef.current?.resetCaptcha() + } + const downgradeProject = async (values?: any) => { const downgradeMessage = values?.message ?? message @@ -112,6 +134,8 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { proration_date, }) + resetCaptcha() + if (res?.error) { return ui.setNotification({ category: 'error', @@ -119,11 +143,11 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { error: res.error, }) } else { - if (willChangeComputeSize) { + if (currentComputeSize !== undefined) { app.onProjectStatusUpdated(projectId, PROJECT_STATUS.RESTORING) ui.setNotification({ category: 'info', - message: getDowngradeSuccessMessage(), + message: getDowngradeRefundMessage(), duration: 8000, }) ui.setNotification({ @@ -139,9 +163,9 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { } const feedbackRes = await post(`${API_URL}/feedback/downgrade`, { projectRef, - reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''), - additionalFeedback: downgradeMessage, - exitAction: 'downgrade', + reasons: selectedReasons.reduce((a, b) => `${a}- ${b}\n`, ''), + additionalFeedback: downgradeMessage, + exitAction: 'downgrade', }) if (feedbackRes.error) throw feedbackRes.error } catch (error: any) { @@ -159,7 +183,7 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { ) } @@ -173,7 +197,7 @@ const ExitSurvey: FC = ({ freeTier, subscription, onSelectBack }) => { enterFrom="transform opacity-0 translate-x-10" enterTo="transform opacity-100 translate-x-0" > -
      +
      +
      + { + setCaptchaToken(token) + }} + onExpire={() => { + setCaptchaToken(null) + }} + /> +
      )} diff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx index 078d2a067d2..8deab10c609 100644 --- a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx +++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx @@ -1,4 +1,4 @@ -import { FC, useState } from 'react' +import { FC, useRef, useState } from 'react' import * as Tooltip from '@radix-ui/react-tooltip' import { Listbox, IconLoader, Button, IconPlus, IconAlertCircle, IconCreditCard } from 'ui' import { PermissionAction } from '@supabase/shared-types/out/constants' @@ -42,8 +42,11 @@ interface Props { isLoadingPaymentMethods: boolean onSelectPaymentMethod: (method: any) => void onSelectAddNewPaymentMethod: () => void + beforeConfirmPayment: () => Promise onConfirmPayment: () => void isSubmitting: boolean + + captcha: React.ReactNode } // Use case of this panel is actually only for upgrading from Free to Pro @@ -70,8 +73,10 @@ const PaymentSummaryPanel: FC = ({ isLoadingPaymentMethods, onSelectPaymentMethod, onSelectAddNewPaymentMethod, + beforeConfirmPayment, onConfirmPayment, isSubmitting, + captcha, }) => { const { ui } = useStore() const projectRegion = ui.selectedProject?.region @@ -120,7 +125,7 @@ const PaymentSummaryPanel: FC = ({ ).toFixed(2) } - const validateOrder = () => { + const validateOrder = async () => { const error = validateSubscriptionUpdatePayload(selectedAddons) if (error) { return ui.setNotification({ @@ -129,16 +134,23 @@ const PaymentSummaryPanel: FC = ({ message: error, }) } else { - isChangingComputeSize || (isChangingPITRDuration && selectedPITRDays === 0) - ? setShowConfirmModal(true) - : onConfirmPayment() + // [Joshen] We're validating captcha before subsequent actions as there's an issue + // with the hcaptcha overlay and the modal component, such that clicking on the hcaptcha closes + // both the hcaptcha overlay and the modal. Need to figure that out first, then we can validate + // the hcaptcha within onConfirmPayment() + const hasValidCaptcha = await beforeConfirmPayment() + if (hasValidCaptcha) { + isChangingComputeSize || (isChangingPITRDuration && selectedPITRDays === 0) + ? setShowConfirmModal(true) + : onConfirmPayment() + } } } return ( <>

      Payment Summary

      @@ -293,7 +305,7 @@ const PaymentSummaryPanel: FC = ({
      )} -
      +
      = ({

      Select payment method

      {isLoadingPaymentMethods ? ( -
      +

      Retrieving payment methods

      ) : paymentMethods.length === 0 ? ( -
      +

      No saved payment methods

      @@ -370,11 +382,11 @@ const PaymentSummaryPanel: FC = ({ ) })}
      -

      +

      Add new payment method

      @@ -382,6 +394,8 @@ const PaymentSummaryPanel: FC = ({ )}
      +
      {captcha}
      +
      diff --git a/studio/components/interfaces/Billing/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade.tsx index 2a9f6134004..b4cf2635051 100644 --- a/studio/components/interfaces/Billing/ProUpgrade.tsx +++ b/studio/components/interfaces/Billing/ProUpgrade.tsx @@ -1,4 +1,4 @@ -import { FC, useEffect, useState } from 'react' +import { FC, useEffect, useRef, useState } from 'react' import { Transition } from '@headlessui/react' import { useRouter } from 'next/router' import * as Tooltip from '@radix-ui/react-tooltip' @@ -29,6 +29,7 @@ import { } from './AddOns/AddOns.utils' import BackButton from 'components/ui/BackButton' import SupportPlan from './AddOns/SupportPlan' +import HCaptcha from '@hcaptcha/react-hcaptcha' // Do not allow compute size changes for af-south-1 @@ -52,6 +53,9 @@ const ProUpgrade: FC = ({ const isCustomDomainsEnabled = useFlag('customDomains') const isPITRSelfServeEnabled = useFlag('pitrSelfServe') + const [captchaToken, setCaptchaToken] = useState(null) + const captchaRef = useRef(null) + const { addons } = products const computeSizes = formatComputeSizes(addons) const pitrDurationOptions = formatPITROptions(addons) @@ -148,6 +152,30 @@ const ProUpgrade: FC = ({ setIsRefreshingPreview(false) } + const resetCaptcha = () => { + setCaptchaToken(null) + captchaRef.current?.resetCaptcha() + } + + const beforeConfirmPayment = async (): Promise => { + setIsSubmitting(true) + let token = captchaToken + + try { + if (!token) { + const captchaResponse = await captchaRef.current?.execute({ async: true }) + token = captchaResponse?.response ?? null + setCaptchaToken(token) + } + } catch (error) { + setIsSubmitting(false) + return false + } + + setIsSubmitting(false) + return true + } + const onConfirmPayment = async () => { const payload = formSubscriptionUpdatePayload( currentSubscription, @@ -157,9 +185,9 @@ const ProUpgrade: FC = ({ selectedPaymentMethodId, projectRegion ) - - setIsSubmitting(true) const res = await patch(`${API_URL}/projects/${projectRef}/subscription`, payload) + resetCaptcha() + if (res?.error) { ui.setNotification({ category: 'error', @@ -199,102 +227,103 @@ const ProUpgrade: FC = ({ enter="transition ease-out duration-300" enterFrom="transform opacity-0 translate-x-10" enterTo="transform opacity-100 translate-x-0" - className="flex w-full items-start justify-between" + className="flex items-start justify-between w-full" > -
      +
      - onSelectBack()} /> -
      -

      Change your project's subscription

      -
      -
      - {!isManagingProSubscription ? ( - <> -

      - Welcome to Pro -

      -

      - Your new subscription will begin immediately after payment -

      - - ) : ( - <> -

      - Managing your Pro plan -

      - {/*

      +

      + onSelectBack()} /> +

      Change your project's subscription

      +
      + +
      +
      + {!isManagingProSubscription ? ( + <> +

      + Welcome to Pro +

      +

      + Your new subscription will begin immediately after payment +

      + + ) : ( + <> +

      + Managing your Pro plan +

      + {/*

      Your billing cycle will reset after payment

      */} - - )} -
      -
      -
      -
      -

      Enable spend cap

      - setShowSpendCapHelperModal(true)} - /> -
      -

      - If enabled, additional resources will not be charged on a per-usage basis -

      -
      - setIsSpendCapEnabled(!isSpendCapEnabled)} - /> -
      - {projectRegion !== 'af-south-1' && ( - <> - {currentAddons.supportPlan !== undefined && ( - <> - - - - )} - {isCustomDomainsEnabled && customDomainOptions.length > 0 && ( - <> - - - - )} - {isPITRSelfServeEnabled && pitrDurationOptions.length > 0 && ( - <> - - - - )} - - )}
      +
      +
      +
      +

      Enable spend cap

      + setShowSpendCapHelperModal(true)} + /> +
      +

      + If enabled, additional resources will not be charged on a per-usage basis +

      +
      + setIsSpendCapEnabled(!isSpendCapEnabled)} + /> +
      + {projectRegion !== 'af-south-1' && ( + <> + {currentAddons.supportPlan !== undefined && ( + <> + + + + )} + {isCustomDomainsEnabled && customDomainOptions.length > 0 && ( + <> + + + + )} + {isPITRSelfServeEnabled && pitrDurationOptions.length > 0 && ( + <> + + + + )} + + + + )}
      @@ -317,8 +346,22 @@ const ProUpgrade: FC = ({ onSelectAddNewPaymentMethod={() => { setShowAddPaymentMethodModal(true) }} + beforeConfirmPayment={beforeConfirmPayment} onConfirmPayment={onConfirmPayment} isSubmitting={isSubmitting} + captcha={ + { + setCaptchaToken(token) + }} + onExpire={() => { + setCaptchaToken(null) + }} + /> + } />
      @@ -337,7 +380,7 @@ const ProUpgrade: FC = ({ header="Enabling spend cap" onCancel={() => setShowSpendCapHelperModal(false)} > -
      +

      @@ -352,7 +395,7 @@ const ProUpgrade: FC = ({

      {/* Maybe instead of a table, show something more interactive like a spend cap playground */} {/* Maybe ideate this in Figma first but this is good enough for now */} -
      +

      Item

      Limit

      @@ -379,7 +422,7 @@ const ProUpgrade: FC = ({ diff --git a/studio/components/interfaces/Database/Extensions/Extensions.constants.ts b/studio/components/interfaces/Database/Extensions/Extensions.constants.ts index 6d8dfbb1e66..669b441d503 100644 --- a/studio/components/interfaces/Database/Extensions/Extensions.constants.ts +++ b/studio/components/interfaces/Database/Extensions/Extensions.constants.ts @@ -12,4 +12,6 @@ export const HIDDEN_EXTENSIONS = [ 'pg_visibility', 'pgstattuple', 'supabase_vault', + 'intagg', + 'xml2', ] diff --git a/studio/components/interfaces/Reports/PresetReport.tsx b/studio/components/interfaces/Reports/PresetReport.tsx deleted file mode 100644 index bcf7ae5ad0d..00000000000 --- a/studio/components/interfaces/Reports/PresetReport.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { Button, IconRefreshCw } from 'ui' -import useLogsQuery from 'hooks/analytics/useLogsQuery' -import { DatePickerToFrom } from '../Settings/Logs' -import DatePickers from '../Settings/Logs/Logs.DatePickers' -import { - renderErrorRateChart, - renderRequestsPathsTable, - renderStatusCodesChart, -} from './renderers/OverviewRenderers' -import { PRESET_CONFIG, REPORTS_DATEPICKER_HELPERS } from './Reports.constants' -import { Presets } from './Reports.types' -import ReportWidget from './ReportWidget' - -interface Props { - preset: Presets - projectRef: string -} - -const DEFAULT_PARAMS = { - iso_timestamp_start: REPORTS_DATEPICKER_HELPERS[0].calcFrom(), - iso_timestamp_end: REPORTS_DATEPICKER_HELPERS[0].calcTo(), -} - -const PresetReport: React.FC = ({ projectRef, preset }) => { - const config = PRESET_CONFIG[preset] - const [statusCodes, statusCodesHandlers] = useLogsQuery(projectRef, { - sql: config.sql.statusCodes, - ...DEFAULT_PARAMS, - }) - - const [requestPaths, requestPathsHandlers] = useLogsQuery(projectRef, { - sql: config.sql.requestPaths, - ...DEFAULT_PARAMS, - }) - - const [errorRate, errorRateHandlers] = useLogsQuery(projectRef, { - sql: config.sql.errorRate, - ...DEFAULT_PARAMS, - }) - - const handleRefresh = () => { - statusCodesHandlers.runQuery() - requestPathsHandlers.runQuery() - errorRateHandlers.runQuery() - } - const handleDatepickerChange = ({ to, from }: DatePickerToFrom) => { - const newParams = { iso_timestamp_start: from || '', iso_timestamp_end: to || '' } - statusCodesHandlers.setParams((prev) => ({ ...prev, ...newParams })) - requestPathsHandlers.setParams((prev) => ({ ...prev, ...newParams })) - errorRateHandlers.setParams((prev) => ({ ...prev, ...newParams })) - } - const isLoading = statusCodes.isLoading || requestPaths.isLoading - - return ( -
      -

      {config.title}

      -
      - - -
      - -
      - - - -
      -
      - ) -} - -export default PresetReport diff --git a/studio/components/interfaces/Reports/ReportWidget.tsx b/studio/components/interfaces/Reports/ReportWidget.tsx index 5e66d717734..2594c10c646 100644 --- a/studio/components/interfaces/Reports/ReportWidget.tsx +++ b/studio/components/interfaces/Reports/ReportWidget.tsx @@ -2,15 +2,19 @@ import { Button, Dropdown, IconMoreVertical } from 'ui' import LoadingOpacity from 'components/ui/LoadingOpacity' import Panel from 'components/ui/Panel' import { useRouter } from 'next/router' +import { BaseReportParams } from './Reports.types' import { LogsEndpointParams } from '../Settings/Logs' +import * as Tooltip from '@radix-ui/react-tooltip' +import { IconHelpCircle } from '@supabase/ui' export interface ReportWidgetProps { data: T[] title: string - description: string + description?: string + tooltip?: string className?: string renderer: (props: ReportWidgetProps) => React.ReactNode - params: LogsEndpointParams + params: BaseReportParams | LogsEndpointParams isLoading: boolean } @@ -18,11 +22,37 @@ const ReportWidget: React.FC = (props) => { const router = useRouter() const { ref } = router.query return ( - +
      -

      {props.title}

      +
      + +

      {props.title}

      {' '} + {props?.tooltip && ( + + + + + + +
      + {props.tooltip} +
      +
      +
      + )} +

      {props.description}

      = (props) => { router.push({ pathname: `/project/${ref}/logs/explorer`, query: { - q: props.params.sql, + q: props.params?.sql, its: props.params.iso_timestamp_start, ite: props.params.iso_timestamp_end, }, @@ -51,7 +81,7 @@ const ReportWidget: React.FC = (props) => { title="Actions..." as="span" type="text" - icon={} + icon={} >
      diff --git a/studio/components/interfaces/Reports/Reports.constants.ts b/studio/components/interfaces/Reports/Reports.constants.ts index ac4492a7075..3713345e5f5 100644 --- a/studio/components/interfaces/Reports/Reports.constants.ts +++ b/studio/components/interfaces/Reports/Reports.constants.ts @@ -1,6 +1,6 @@ import dayjs from 'dayjs' import { DatetimeHelper } from '../Settings/Logs' -import { Presets } from './Reports.types' +import { PresetConfig, Presets } from './Reports.types' export const LAYOUT_COLUMN_COUNT = 24 @@ -15,78 +15,231 @@ export const REPORTS_DATEPICKER_HELPERS: DatetimeHelper[] = [ text: 'Last 14 days', calcFrom: () => dayjs().subtract(7, 'day').startOf('day').toISOString(), calcTo: () => '', + default: true, }, { text: 'Last 30 days', calcFrom: () => dayjs().subtract(30, 'day').startOf('day').toISOString(), calcTo: () => '', }, - { - text: 'Last 90 days', - calcFrom: () => dayjs().subtract(90, 'day').startOf('day').toISOString(), - calcTo: () => '', - }, ] -export const PRESET_CONFIG = { - [Presets.OVERVIEW]: { - title: '', - sql: { - statusCodes: ` - select - timestamp_trunc(timestamp, hour) as timestamp, - r.status_code as status_code, - count(status_code) as count - FROM - edge_logs - CROSS JOIN UNNEST(metadata) AS m - CROSS JOIN UNNEST(m.response) AS r - GROUP BY - timestamp, - status_code - ORDER BY - timestamp ASC`, - errorRate: ` -select - timestamp_trunc(timestamp, hour) as timestamp, - count(timestamp) as count -FROM - edge_logs - LEFT JOIN UNNEST(metadata) AS f1 ON TRUE - LEFT JOIN UNNEST(f1.response) AS f3 ON TRUE -WHERE - f3.status_code >= 400 -GROUP BY +export const DEFAULT_QUERY_PARAMS = { + iso_timestamp_start: REPORTS_DATEPICKER_HELPERS[0].calcFrom(), + iso_timestamp_end: REPORTS_DATEPICKER_HELPERS[0].calcTo(), +} + +export const PRESET_CONFIG: Record = { + [Presets.API]: { + title: 'API', + queries: { + statusCodes: { + queryType: 'logs', + sql: ` + select + timestamp_trunc(timestamp, hour) as timestamp, + r.status_code as status_code, + count(status_code) as count + FROM + edge_logs + CROSS JOIN UNNEST(metadata) AS m + CROSS JOIN UNNEST(m.response) AS r + GROUP BY + timestamp, + status_code + ORDER BY + timestamp ASC`, + }, + errorRates: { + queryType: 'logs', + sql: ` + select + timestamp_trunc(timestamp, hour) as timestamp, + count(timestamp) as count + FROM + edge_logs + LEFT JOIN UNNEST(metadata) AS f1 ON TRUE + LEFT JOIN UNNEST(f1.response) AS f3 ON TRUE + WHERE + f3.status_code >= 400 + GROUP BY + timestamp + ORDER BY + timestamp ASC + `, + }, + requestPaths: { + queryType: 'logs', + sql: ` + select + f2.path as path, + f2.search as query_params, + f2.method as method, + f3.status_code as status_code, + avg(f3.origin_time) as avg_origin_time, + sum(f3.origin_time) as sum, + APPROX_QUANTILES(f3.origin_time, 100) as quantiles, + count(timestamp) as count + FROM + edge_logs + LEFT JOIN UNNEST(metadata) AS f1 ON TRUE + LEFT JOIN UNNEST(f1.request) AS f2 ON TRUE + LEFT JOIN UNNEST(f1.response) AS f3 ON TRUE + GROUP BY + path, + query_params, + method, + status_code + ORDER BY + sum DESC, + count desc, + avg_origin_time DESC + LIMIT 50 + `, + }, + userAgents: { + queryType: 'logs', + sql: ` + select + h.user_agent as user_agent, + cf.asOrganization as request_source, + count(f.id) as count + from + edge_logs as f + cross join unnest(f.metadata) as m + cross join unnest(m.request) as r + cross join unnest(r.cf) as cf + cross join unnest(r.headers) as h + group by + user_agent, + request_source + order by + count desc + limit 12 + `, + }, + botScores: { + queryType: 'logs', + sql: ` + select + h.cf_connecting_ip as ip, + h.cf_ipcountry as country, + h.user_agent as user_agent, + r.path as path, + b.score as bot_score, + b.verifiedBot as bot_verified, + count(f.id) as count + from + edge_logs as f + cross join unnest(f.metadata) as m + cross join unnest(m.request) as r + cross join unnest(r.cf) as cf + cross join unnest(r.headers) as h + cross join unnest(cf.botManagement) as b + group by + ip, + country, + path, + user_agent, + bot_score, + bot_verified + order by + bot_score desc + limit 20 + `, + }, + }, + }, + [Presets.AUTH]: { + title: 'Auth', + queries: { + bannedUsers: { + queryType: 'db', + sql: (_params) => ` +select + count(distinct u.id) as count +from auth.users u +where u.banned_until is not null and u.banned_until > now() +limit 1 + `, + }, + unverifiedUsers: { + queryType: 'db', + sql: (params) => ` +select + date_trunc('day', u.created_at) as timestamp, + count(distinct u.id) as count +from auth.users u +where u.confirmed_at is null and '${params.iso_timestamp_start}' < u.created_at +group by timestamp +order by timestamp desc + `, + }, + signUpProviders: { + queryType: 'db', + sql: (params) => ` +select + sum(count(u.id)) over (order by date_trunc('day', u.created_at)) as count, + date_trunc('day', u.created_at) as timestamp, + i.provider as provider +from auth.users u +join auth.identities as i on u.id = i.user_id +where date_trunc('day', u.created_at) > '${params.iso_timestamp_start}' +group by timestamp, provider +order by timestamp desc + `, + }, + failedMigrations: { + queryType: 'logs', + sql: ` +select count(f.id) +from auth_logs +where json_value(f.event_message, "$.level") = "fatal" + and regexp_contains(f.event_message, "error executing migrations") +limit 1 +`, + }, + dailyActiveUsers: { + queryType: 'logs', + sql: ` +select + timestamp_trunc(timestamp, day) as timestamp, + count(distinct json_value(f.event_message, "$.user_id")) as count +from auth_logs f +where json_value(f.event_message, "$.action") = "login" +group by timestamp -ORDER BY - timestamp ASC +order by + timestamp desc `, - requestPaths: ` - select - f2.path as path, - f2.search as query_params, - f2.method as method, - f3.status_code as status_code, - avg(f3.origin_time) as avg_origin_time, - sum(f3.origin_time) as sum, - APPROX_QUANTILES(f3.origin_time, 100) as quantiles, - count(timestamp) as count - FROM - edge_logs - LEFT JOIN UNNEST(metadata) AS f1 ON TRUE - LEFT JOIN UNNEST(f1.request) AS f2 ON TRUE - LEFT JOIN UNNEST(f1.response) AS f3 ON TRUE - GROUP BY - path, - query_params, - method, - status_code - ORDER BY - sum DESC, - count desc, - avg_origin_time DESC - LIMIT 50 + }, + cumulativeUsers: { + queryType: 'db', + sql: (params) => ` + +select + date_trunc('day', u.created_at) as timestamp, + sum(count(u.id)) over (order by date_trunc('day', u.created_at)) as count +from auth.users as u +where u.confirmed_at is not null and date_trunc('day', u.created_at) > '${params.iso_timestamp_start}' +group by timestamp +order by timestamp desc + `, + }, + newUsers: { + queryType: 'db', + sql: (params) => ` +select +date_trunc('day', u.created_at) as timestamp, +count(u.id) as count +from auth.users as u +where u.confirmed_at is not null and date_trunc('day', u.created_at) > '${params.iso_timestamp_start}' +group by + timestamp +order by + timestamp desc `, + }, }, }, } diff --git a/studio/components/interfaces/Reports/Reports.tsx b/studio/components/interfaces/Reports/Reports.tsx index c5b02f5b596..5fb1630fa29 100644 --- a/studio/components/interfaces/Reports/Reports.tsx +++ b/studio/components/interfaces/Reports/Reports.tsx @@ -17,7 +17,7 @@ import { } from 'ui' import { PermissionAction } from '@supabase/shared-types/out/constants' -import { checkPermissions, useFlag, useStore } from 'hooks' +import { checkPermissions, useStore } from 'hooks' import { uuidv4 } from 'lib/helpers' import { METRIC_CATEGORIES, METRICS, TIME_PERIODS_REPORTS } from 'lib/constants' import { useProjectContentStore } from 'stores/projectContentStore' @@ -263,10 +263,6 @@ const Reports = () => { }) } - // Filter out total_storage_image_render_count if feature flag is not enabled - const storageImageResizeEnabled = useFlag('storageImageResize') - let metrics = METRICS.filter(it => it.key !== 'total_storage_image_render_count' || storageImageResizeEnabled); - const MetricOptions = () => { return ( <> @@ -277,7 +273,7 @@ const Reports = () => { isNested overlay={ <> - {metrics.filter((metric) => metric?.category?.key === cat.key).map((metric) => { + {METRICS.filter((metric) => metric?.category?.key === cat.key).map((metric) => { return ( extends QueryDataBase { + data: T[] + params: BaseReportParams + logData?: never +} +export interface DbQueryHandler { + runQuery: () => void + setParams?: never + changeQuery?: never +} +export type MetaQueryResponse = any & { error: ResponseError } + +export type BaseReportParams = typeof DEFAULT_QUERY_PARAMS & { sql?: string } & unknown +export interface PresetConfig { + title: string + queries: Record +} + +export interface DbQuery { + queryType: 'db' + sql: string | ((params: BaseReportParams) => string) +} + +export interface LogsQuery { + queryType: 'logs' + sql: string } export interface StatusCodesDatum { timestamp: number diff --git a/studio/components/interfaces/Reports/Reports.utils.ts b/studio/components/interfaces/Reports/Reports.utils.ts deleted file mode 100644 index 12a7d634797..00000000000 --- a/studio/components/interfaces/Reports/Reports.utils.ts +++ /dev/null @@ -1,7 +0,0 @@ - -/** - * Converts a query params string to an object - */ -export const queryParamsToObject = (params: string) => { - return Object.fromEntries(new URLSearchParams(params)) -} \ No newline at end of file diff --git a/studio/components/interfaces/Reports/Reports.utils.tsx b/studio/components/interfaces/Reports/Reports.utils.tsx new file mode 100644 index 00000000000..f0cf2d3e2c4 --- /dev/null +++ b/studio/components/interfaces/Reports/Reports.utils.tsx @@ -0,0 +1,102 @@ +import { IconRefreshCw } from '@supabase/ui' +import useDbQuery from 'hooks/analytics/useDbQuery' +import useLogsQuery, { LogsQueryData, LogsQueryHandlers } from 'hooks/analytics/useLogsQuery' +import React from 'react' +import { Button } from 'ui' +import { DatePickerToFrom } from '../Settings/Logs' +import DatePickers from '../Settings/Logs/Logs.DatePickers' +import { DEFAULT_QUERY_PARAMS, REPORTS_DATEPICKER_HELPERS } from './Reports.constants' +import { DbQueryData, DbQueryHandler, PresetConfig } from './Reports.types' + +/** + * Converts a query params string to an object + */ +export const queryParamsToObject = (params: string) => { + return Object.fromEntries(new URLSearchParams(params)) +} + +// generate hooks based on preset config +type PresetHookResult = [LogsQueryData | DbQueryData, LogsQueryHandlers | DbQueryHandler] +type PresetHooks = Record PresetHookResult> +export const hooksFactory = (projectRef: string, config: PresetConfig) => { + const hooks: PresetHooks = Object.entries(config.queries).reduce( + (acc, [k, { sql, queryType }]) => { + if (queryType === 'db') { + return { + ...acc, + [k]: () => useDbQuery(sql), + } + } else { + return { + ...acc, + [k]: () => + useLogsQuery(projectRef, { + sql: sql as string, + ...DEFAULT_QUERY_PARAMS, + }), + } + } + }, + {} + ) + return hooks +} + +export const usePresetReport = (hooks: PresetHookResult[]) => { + const data = hooks.map((h) => h[0]) + const handlers = hooks.map((h) => h[1]) + const handleRefresh = () => { + handlers.forEach((handler) => { + handler.runQuery() + }) + } + const handleDatepickerChange = ({ to, from }: DatePickerToFrom) => { + const newParams = { iso_timestamp_start: from || '', iso_timestamp_end: to || '' } + + handlers.forEach((handler) => { + if (handler.setParams) { + handler.setParams((prev) => ({ + ...prev, + ...newParams, + })) + } + }) + } + const isLoading = data.map((datum) => datum.isLoading).some((v) => v) + + const Layout: React.FC<{ title: string }> = ({ title, children }) => ( +
      +

      {title}

      +
      + + +
      + + {children} +
      + ) + return { + isLoading, + Layout, + handleRefresh, + handleDatepickerChange, + } +} diff --git a/studio/components/interfaces/Reports/Statistic.tsx b/studio/components/interfaces/Reports/Statistic.tsx new file mode 100644 index 00000000000..3cc6cd8bdac --- /dev/null +++ b/studio/components/interfaces/Reports/Statistic.tsx @@ -0,0 +1,57 @@ +import Sparkline from 'components/ui/Charts/Sparkline' +import React from 'react' + +interface Props { + value: string | number + startingValue?: string | number + prefix?: string + suffix?: string + valueFormatter?: (value: Props['value']) => string + sparklineData?: any + sparklineXAxis?: string + sparklineYAxis?: string +} + +const Statistic: React.FC = ({ + prefix, + suffix, + value, + startingValue, + sparklineData, + sparklineXAxis, + sparklineYAxis, +}) => { + const isNumber = typeof value === 'number' && !Number.isNaN(value) + const percentageChange = + startingValue && isNumber ? Number(startingValue) / Number(value) - 1 : null + const showSparkline = sparklineData && sparklineXAxis && sparklineYAxis + return ( +
      +
      + {prefix} + {value} + {suffix} +
      + {startingValue && ( +
      + {isNumber && percentageChange !== null && ( + + {Number(percentageChange * 100).toFixed(1)} + {percentageChange > 0 ? 'increase' : 'decrease'} + + )} +
      + )} + {showSparkline && ( + + )} +
      + ) +} + +export default Statistic diff --git a/studio/components/interfaces/Reports/renderers/OverviewRenderers.tsx b/studio/components/interfaces/Reports/renderers/ApiRenderers.tsx similarity index 70% rename from studio/components/interfaces/Reports/renderers/OverviewRenderers.tsx rename to studio/components/interfaces/Reports/renderers/ApiRenderers.tsx index 2fc2c8eac4e..e6e8156d296 100644 --- a/studio/components/interfaces/Reports/renderers/OverviewRenderers.tsx +++ b/studio/components/interfaces/Reports/renderers/ApiRenderers.tsx @@ -10,6 +10,98 @@ import { PathsDatum, StatusCodesDatum } from '../Reports.types' import { queryParamsToObject } from '../Reports.utils' import { ReportWidgetProps } from '../ReportWidget' +export const renderUserAgents = ( + props: ReportWidgetProps<{ + user_agent: string + request_source: string + count: number + }> +) => { + return ( + + User Agents + Request Source + Count + + } + body={ + <> + {props.data.map((row, index) => { + return ( + + + {row.user_agent ? ( + row.user_agent + ) : ( + No user agent + )} + + {row.request_source} + + {row.count} + + + ) + })} + + } + /> + ) +} + +export const renderBotScores = ( + props: ReportWidgetProps<{ + ip: string + country: string + user_agent: string + path: string + bot_score: number + bot_verified: boolean + count: number + }> +) => { + return ( +
      + IP (Country) + Request Path + User Agent + Bot Score + Is Verified Bot + Count + + } + body={ + <> + {props.data.map((row, index) => { + return ( + + + {row.ip} ({row.country}) + + {row.path} + {row.user_agent} + {row.bot_score} + {row.bot_verified ? 'Yes' : 'No'} + + {row.count} + + + ) + })} + + } + /> + ) +} + export const renderStatusCodesChart = (props: ReportWidgetProps) => ( +) => { + const count = props.data.length === 0 ? 0 : props?.data?.[0]?.count + return +} +export const renderUnverifiedUsers = ( + props: ReportWidgetProps<{ + timestamp: string + count: number + }> +) => { + const count = props.data.length === 0 ? 0 : props?.data?.[0]?.count + + return ( + = 3 ? props.data : null} + sparklineXAxis="timestamp" + sparklineYAxis="count" + /> + ) +} +export const renderSignUpProviders = ( + props: ReportWidgetProps<{ + timestamp: string + provider: string + count: number + }> +) => { + return ( + + ) +} +export const renderFailedMigrations = ( + props: ReportWidgetProps<{ + timestamp: string + count: number + }> +) => { + const count = props.data.length === 0 ? 0 : props?.data?.[0]?.count + return +} +export const renderCumulativeUsers = ( + props: ReportWidgetProps<{ + count: number + timestamp: string + }> +) => { + const total = props.data?.[0]?.count + return ( +
      + +
      + ) +} + +export const renderNewUsers = ( + props: ReportWidgetProps<{ + count: number + timestamp: string + }> +) => { + const sum = (props.data || []).reduce((acc, datum) => datum.count + acc, 0) + return ( +
      + +
      + ) +} + +export const renderDailyActiveUsers = ( + props: ReportWidgetProps<{ + count: number + timestamp: string + }> +) => { + const last = props.data?.[props.data.length - 1]?.count + + return ( +
      + +
      + ) +} diff --git a/studio/components/interfaces/SQLEditor/SQLEditor.constants.ts b/studio/components/interfaces/SQLEditor/SQLEditor.constants.ts index 63ec9612ed2..de1990ca96b 100644 --- a/studio/components/interfaces/SQLEditor/SQLEditor.constants.ts +++ b/studio/components/interfaces/SQLEditor/SQLEditor.constants.ts @@ -812,7 +812,7 @@ create publication supabase_realtime sql: ` -- Create a table for public profiles create table profiles ( - id uuid references auth.users not null primary key, + id uuid references auth.users on delete cascade not null primary key, updated_at timestamp with time zone, username text unique, full_name text, diff --git a/studio/components/interfaces/Settings/Logs/LogSelectionRenderers/AuthSelectionRenderer.tsx b/studio/components/interfaces/Settings/Logs/LogSelectionRenderers/AuthSelectionRenderer.tsx index aaeaf7518c8..1155d4aedc6 100644 --- a/studio/components/interfaces/Settings/Logs/LogSelectionRenderers/AuthSelectionRenderer.tsx +++ b/studio/components/interfaces/Settings/Logs/LogSelectionRenderers/AuthSelectionRenderer.tsx @@ -1,6 +1,5 @@ -import { parse } from 'crypto-js/enc-utf8' import { tryParseJson } from 'lib/helpers' -import { isUnixMicro, PreviewLogData, unixMicroToIsoTimestamp } from '..' +import { PreviewLogData } from '..' import { LOGS_TAILWIND_CLASSES } from '../Logs.constants' import { jsonSyntaxHighlight, diff --git a/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx index fc5916d3596..cd06e465b3d 100644 --- a/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx +++ b/studio/components/interfaces/Settings/ProjectUsageBars/ProjectUsageBars.tsx @@ -1,7 +1,7 @@ import { FC, useEffect } from 'react' import { Badge, Button, IconAlertCircle, Loading } from 'ui' -import { useStore, useProjectUsage, useFlag } from 'hooks' +import { useStore, useProjectUsage } from 'hooks' import { formatBytes } from 'lib/helpers' import { PRICING_TIER_PRODUCT_IDS, USAGE_APPROACHING_THRESHOLD } from 'lib/constants' import SparkBar from 'components/ui/SparkBar' @@ -56,21 +56,11 @@ const ProjectUsage: FC = ({ projectRef }) => { ) } - const storageImageResizeEnabled = useFlag('storageImageResize') - - // Filter out storage_image_render_count if feature flag is not enabled - const usageBasedProducts = USAGE_BASED_PRODUCTS.map((usageBasedProduct) => ({ - ...usageBasedProduct, - features: usageBasedProduct.features.filter( - (it) => it.key !== 'storage_image_render_count' || storageImageResizeEnabled - ), - })) - return ( {usage && (
      - {usageBasedProducts.map((product) => { + {USAGE_BASED_PRODUCTS.map((product) => { const isExceededUsage = showUsageExceedMessage && product.features diff --git a/studio/components/interfaces/Support/Support.constants.ts b/studio/components/interfaces/Support/Support.constants.ts index b0f1ca4134d..60e60efcfa2 100644 --- a/studio/components/interfaces/Support/Support.constants.ts +++ b/studio/components/interfaces/Support/Support.constants.ts @@ -32,7 +32,7 @@ export const CATEGORY_OPTIONS = [ { value: 'Billing', label: 'Billing', - description: 'Issues with credit card charges | invoices | overcharing', + description: 'Issues with credit card charges | invoices | overcharging', query: undefined, }, { diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx index 86b44263d1f..f2d8aab8204 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx @@ -190,6 +190,8 @@ const ColumnEditor: FC = ({ onUpdateField({ name: event.target.value })} diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/Column.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/Column.tsx index f435ec8964b..4939942cfa7 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/Column.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/Column.tsx @@ -71,7 +71,7 @@ const Column: FC = ({ size="small" title={column.name} disabled={hasImportContent} - placeholder="Column name" + placeholder="column_name" className={`table-editor-columns-input bg-white dark:bg-transparent lg:gap-0 ${ hasImportContent ? 'opacity-50' : '' } rounded-md`} diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ColumnManagement.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ColumnManagement.tsx index 270980835a6..61f8e127f80 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ColumnManagement.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ColumnManagement.tsx @@ -142,8 +142,8 @@ const ColumnManagement: FC = ({ return ( <> -
      -
      +
      +
      Columns
      {isNewRecord && ( <> @@ -197,8 +197,29 @@ const ColumnManagement: FC = ({
      {/* Drag handle */} {isNewRecord &&
      } -
      +
      Name
      + + +
      + +
      +
      + + +
      + + Recommended to use lowercase and use an underscore to separate words e.g. + column_name + +
      +
      +
      Type
      diff --git a/studio/components/layouts/ReportsLayout/ReportsMenu.utils.ts b/studio/components/layouts/ReportsLayout/ReportsMenu.utils.ts index 28c14e91e92..8e6142aaef8 100644 --- a/studio/components/layouts/ReportsLayout/ReportsMenu.utils.ts +++ b/studio/components/layouts/ReportsLayout/ReportsMenu.utils.ts @@ -8,7 +8,7 @@ export const generateReportsMenu = (project?: Project): ProductMenuGroup[] => { return [ { - title: 'Reports', + title: '', items: [ { name: 'Custom reports', @@ -16,12 +16,22 @@ export const generateReportsMenu = (project?: Project): ProductMenuGroup[] => { url: `/project/${ref}/reports`, items: [], }, + ], + }, + { + items: [ ...(productReports ? [ { - name: 'API usage', - key: 'api-usage', - url: `/project/${ref}/reports/api-usage`, + name: 'API', + key: 'api', + url: `/project/${ref}/reports/api`, + items: [], + }, + { + name: 'Auth', + key: 'auth', + url: `/project/${ref}/reports/auth`, items: [], }, ] diff --git a/studio/components/layouts/StorageLayout/StorageLayout.tsx b/studio/components/layouts/StorageLayout/StorageLayout.tsx index 6f6c3a13491..031a5935c33 100644 --- a/studio/components/layouts/StorageLayout/StorageLayout.tsx +++ b/studio/components/layouts/StorageLayout/StorageLayout.tsx @@ -67,7 +67,7 @@ const StorageLayout: FC = ({ title, children }) => { const onSelectCreateBucket = async (bucketName: string, isPublic: boolean) => { const bucket = await createBucket(bucketName, isPublic) - if (bucket.name) router.push(`/project/${ref}/storage/buckets/${bucket.name}`) + if (bucket !== undefined) router.push(`/project/${ref}/storage/buckets/${bucket.name}`) } const onSelectDeleteBucket = async (bucket: any) => { diff --git a/studio/components/layouts/StorageLayout/StorageMenu.tsx b/studio/components/layouts/StorageLayout/StorageMenu.tsx index dc41cdacb64..2889292f42f 100644 --- a/studio/components/layouts/StorageLayout/StorageMenu.tsx +++ b/studio/components/layouts/StorageLayout/StorageMenu.tsx @@ -122,8 +122,10 @@ const BucketRow = ({ -

      {bucket.name}

      +
      +

      + {bucket.name} +

      {bucket.public && Public}
      } diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerHeader.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerHeader.js index 139a0be29cb..ad57ec629c1 100644 --- a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerHeader.js +++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerHeader.js @@ -34,7 +34,7 @@ const HeaderPathEdit = ({ loading, breadcrumbs, togglePathEdit }) => {
      ) : (
      -

      {breadcrumbs[breadcrumbs.length - 1] || ''}

      +

      {breadcrumbs[breadcrumbs.length - 1] || ''}