The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
move spec generation stuff
Jonathan Summers-Muir08da4652ed56
diff --git a/apps/docs/components/DocSearch.tsx b/apps/docs/components/DocSearch.tsxindex d8bde374580..38c48a75396 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'@@ -16,7 +16,7 @@ const APP_ID = process.env.NEXT_PUBLIC_ALGOLIA_APP_IDconst SearchContext = createContext(null)-export function SearchProvider({ children }: any) {+function SearchProviderContent({ children }: any) {const router = useRouter()const [isOpen, setIsOpen] = useState(false)const [initialQuery, setInitialQuery] = useState(null)@@ -114,6 +114,10 @@ export function SearchProvider({ children }: any) {)}+const SearchProvider = memo(SearchProviderContent)++export { SearchProvider }+// @ts-ignorefunction Hit({ hit, children }) {return (diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsxindex e40f2e99e53..ba106fdb574 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx@@ -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 firstconst specIds = spec.functions.map((func) => {@@ -198,7 +198,7 @@ const SideNav = () => {active={isReference_Javascript_V1}commonSections={libCommonSections}lib="javascript"- allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_js_v1)}+ spec={spec_js_v1}/> */}<NavigationMenuRefListkey={'reference-js-menu'}@@ -206,7 +206,7 @@ const SideNav = () => {active={isReference_Javascript_V2}commonSections={libCommonSections}lib="javascript"- allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_js_v2)}+ spec={spec_js_v2}/>{/* <NavigationMenuRefListkey={'reference-dart-menu'}@@ -214,15 +214,15 @@ const SideNav = () => {active={isReference_Dart_V0}commonSections={libCommonSections}lib="dart"- allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_dart_v0)}- /> */}- {/* <NavigationMenuRefList+ spec={spec_dart_v0}+ />+ <NavigationMenuRefListkey={'reference-dart-menu'}id={'reference_dart_v1'}active={isReference_Dart_V1}commonSections={libCommonSections}lib="dart"- allowedClientKeys={generateAllowedClientLibKeys(libCommonSections, spec_dart_v1)}+ spec={spec_dart_v1}/> */}{/* // Tools */}{/* <NavigationMenuRefList@@ -231,8 +231,8 @@ const SideNav = () => {active={isReference_Cli}commonSections={cliCommonSections}lib="cli"- /> */}- {/* <NavigationMenuRefList+ />+ <NavigationMenuRefListkey={'reference-api-menu'}id={'reference_api'}active={isReference_Api}@@ -246,15 +246,15 @@ const SideNav = () => {active={isReference_Self_Hosting_Auth}commonSections={authServerCommonSections}lib="self-hosting-auth"- /> */}- {/* <NavigationMenuRefList+ />+ <NavigationMenuRefListkey={'reference-self-hosting-storage-menu'}id={'reference_self_hosting_storage'}active={isReference_Self_Hosting_Storage}commonSections={storageServerCommonSections}lib="self-hosting-storage"- /> */}- {/* <NavigationMenuRefList+ />+ <NavigationMenuRefListkey={'reference-self-hosting-realtime-menu'}id={'reference_self_hosting_realtime'}active={isReference_Self_Hosting_Realtime}diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsxindex b1ae0480dfd..fe594465a2d 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx@@ -1,17 +1,5 @@-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'@@ -26,14 +14,16 @@ interface INavigationMenuRefList {// if undefined, we show all the menu itemsallowedClientKeys?: string[]active: boolean+ spec?: any}const NavigationMenuRefList: React.FC<INavigationMenuRefList> = ({id,lib,commonSections,- allowedClientKeys,+active,+ spec,}) => {// console.log(filterIds)// console.log(modifierIds)@@ -53,12 +43,7 @@ const NavigationMenuRefList: React.FC<INavigationMenuRefList> = ({!active ? 'opacity-0 invisible absolute h-0 overflow-hidden' : '',].join(' ')}>- <NavigationMenuRefListItems- id={id}- lib={lib}- commonSections={commonSections}- allowedClientKeys={allowedClientKeys}- />+ <NavigationMenuRefListItems id={id} lib={lib} commonSections={commonSections} spec={spec} /></div>)}diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsxindex bda02438afc..a0d45213e4f 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx@@ -13,6 +13,7 @@ import RevVersionDropdown from '~/components/RefVersionDropdown'import { RefIdOptions, RefKeyOptions } from './NavigationMenu'import React from 'react'+import { generateAllowedClientLibKeys } from '~/lib/refGenerator/helpers'const FunctionLink = ({title,@@ -80,17 +81,15 @@ interface INavigationMenuRefList {// the keys of menu items that are allowed to be shown on the side menu// if undefined, we show all the menu itemsallowedClientKeys?: string[]+ spec?: any}-const Content: React.FC<INavigationMenuRefList> = ({- id,- lib,- commonSections,- allowedClientKeys,-}) => {+const Content: React.FC<INavigationMenuRefList> = ({ id, lib, commonSections, spec }) => {const router = useRouter()const { isDarkMode } = useTheme()+ const allowedClientKeys = spec ? generateAllowedClientLibKeys(commonSections, spec) : undefined+console.log(id && 'id changed',lib && 'lib changed',diff --git a/apps/docs/lib/refGenerator/helpers.ts b/apps/docs/lib/refGenerator/helpers.tsindex ed8f18f5e4e..db1bccd25dc 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('.')@@ -283,3 +284,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+}