From 8d4717814bdac7f7c502e0d5df911f89df9e5802 Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Mon, 9 Jan 2023 12:35:59 -0330 Subject: [PATCH] You get a type, and you get a type, and you get a type --- .../reference/CLICommandSection.tsx | 2 +- .../reference/RefFunctionSection.tsx | 18 +- .../reference/RefSectionHandler.tsx | 17 +- .../components/reference/Reference.types.ts | 109 +++++++ apps/docs/lib/refGenerator/helpers.ts | 9 + apps/docs/pages/reference/api/[...slug].tsx | 1 + apps/docs/pages/reference/dart/[...slug].tsx | 2 +- .../reference/dart/crawlers/[...slug].tsx | 1 + .../pages/reference/dart/v0/[...slug].tsx | 2 +- .../reference/dart/v0/crawlers/[...slug].tsx | 1 + .../pages/reference/javascript/[...slug].tsx | 10 +- .../javascript/crawlers/[...slug].tsx | 1 + .../reference/javascript/v1/[...slug].tsx | 10 +- .../javascript/v1/crawlers/[...slug].tsx | 1 + .../reference/self-hosting-auth/[...slug].tsx | 2 +- .../self-hosting-realtime/[...slug].tsx | 2 +- .../self-hosting-storage/[...slug].tsx | 2 +- apps/docs/public/sitemap.xml | 300 ++++++++++-------- 18 files changed, 330 insertions(+), 160 deletions(-) create mode 100644 apps/docs/components/reference/Reference.types.ts diff --git a/apps/docs/components/reference/CLICommandSection.tsx b/apps/docs/components/reference/CLICommandSection.tsx index 9f685157482..f7e86190b4e 100644 --- a/apps/docs/components/reference/CLICommandSection.tsx +++ b/apps/docs/components/reference/CLICommandSection.tsx @@ -16,7 +16,7 @@ interface ICommonFunc { } interface IRefFunctionSection { - funcData: any + funcData: ICommonFunc commonFuncData: ICommonFunc spec: any } diff --git a/apps/docs/components/reference/RefFunctionSection.tsx b/apps/docs/components/reference/RefFunctionSection.tsx index 5cdacd0d458..14f74a45c44 100644 --- a/apps/docs/components/reference/RefFunctionSection.tsx +++ b/apps/docs/components/reference/RefFunctionSection.tsx @@ -10,22 +10,7 @@ import { extractTsDocNode, generateParameters } from '~/lib/refGenerator/helpers import RefDetailCollapse from '~/components/reference/RefDetailCollapse' import { Fragment } from 'react' - -interface ICommonFunc { - id: string - title: string - slug: string - product: string - libs: string - items: ICommonFunc[] -} - -interface IRefFunctionSection { - funcData: any - commonFuncData: ICommonFunc - spec: any - typeSpec?: any -} +import { IRefFunctionSection } from './Reference.types' const RefFunctionSection: React.FC = (props) => { const item = props.spec.functions.find((x: any) => x.id === props.funcData.id) @@ -204,7 +189,6 @@ const RefFunctionSection: React.FC = (props) => { )} - { +const RefSectionHandler = (props: RefSectionHandlerProps) => { + console.log('props', props) const router = useRouter() const slug = router.query.slug[0] diff --git a/apps/docs/components/reference/Reference.types.ts b/apps/docs/components/reference/Reference.types.ts new file mode 100644 index 00000000000..663f633ebd2 --- /dev/null +++ b/apps/docs/components/reference/Reference.types.ts @@ -0,0 +1,109 @@ +import { enrichedOperation } from '~/lib/refGenerator/helpers' + +export interface ISpec { + openref: any + info: { + id: string + title: string + description: string + definition: string + libraries: any + slugPrefix: string + specUrl: string + } + functions: IFunctionDefinition[] +} + +export interface IAPISpec { + info: { + title: string + description?: string + version: string + contact?: {} + } + operations: enrichedOperation[] + sections: any +} + +export interface IFunctionDefinition { + title: string + id: string + $ref: string + description: string + examples?: [] +} + +export interface ICommonFunc { + id: string + title: string + slug: string + product: string + type: string + parent?: string + items: ICommonFunc[] +} + +export interface IRefFunctionSection { + funcData: any + commonFuncData: ICommonFunc + spec: any + typeSpec?: TypeSpec +} + +export interface IRefStaticDoc { + id: string + title: string + meta: { + id: string + title: string + hideTitle: boolean + } + content: { + compiledSource: string + frontmatter: {} + scope: {} + } +} + +export type TypeSpec = { + name: string + children: TypeSpecChild[] +} + +export type TypeSpecChild = { + id: number + name: string + kind: number + kindString?: string + flags?: {} + originalName?: string + children?: TypeSpecChild[] + defaultValue?: string + default?: any + groups?: any + sources?: any + target?: any + comment?: TypeSpecChildComment + typeParameter?: any + implementedTypes?: any + extendedTypes?: any + dereferenced?: TypeSpecChildComment + extendedBy?: any + indexSignature?: any + extendsType?: any + objectType?: any + trueType?: any + falseType?: any + type?: any + signatures?: any + overwrites?: any + inheritedFrom?: any + implementationOf?: any +} + +export interface TypeSpecChildComment { + shortText?: string + text?: string | null + returns?: string | null + tags?: any +} diff --git a/apps/docs/lib/refGenerator/helpers.ts b/apps/docs/lib/refGenerator/helpers.ts index 9c14a80167f..251a101add0 100644 --- a/apps/docs/lib/refGenerator/helpers.ts +++ b/apps/docs/lib/refGenerator/helpers.ts @@ -23,6 +23,9 @@ export function extractTsDocNode(nodeToFind: string, definition: any) { } export function generateParameters(tsDefinition: any) { + if (!tsDefinition.signatures) { + console.log('tsDefinition', tsDefinition.signatures) + } let functionDeclaration = null if (tsDefinition.kindString == 'Method') { functionDeclaration = tsDefinition @@ -218,6 +221,12 @@ export type enrichedOperation = OpenAPIV3.OperationObject & { operationId: string operation: string responseList: [] + description?: string + parameters?: [] + responses?: {} + security?: [] + summary?: string + tags?: [] } export function gen_v3(spec: OpenAPIV3.Document, dest: string, { apiUrl }: { apiUrl: string }) { diff --git a/apps/docs/pages/reference/api/[...slug].tsx b/apps/docs/pages/reference/api/[...slug].tsx index 382c882a190..859c3af9e0b 100644 --- a/apps/docs/pages/reference/api/[...slug].tsx +++ b/apps/docs/pages/reference/api/[...slug].tsx @@ -12,6 +12,7 @@ const generatedSpec = gen_v3(specFile, 'wat', { apiUrl: 'apiv0' }) const sections = flattenSections(apiCommonSections) export default function Config(props) { + console.log('generatedSpec', generatedSpec) return } diff --git a/apps/docs/pages/reference/dart/[...slug].tsx b/apps/docs/pages/reference/dart/[...slug].tsx index 735ae57f35f..f35f74c6120 100644 --- a/apps/docs/pages/reference/dart/[...slug].tsx +++ b/apps/docs/pages/reference/dart/[...slug].tsx @@ -9,7 +9,7 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) export default function JSReference(props) { - return + return } export async function getStaticProps() { diff --git a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx index 0b62b1ca55b..036933a1682 100644 --- a/apps/docs/pages/reference/dart/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/crawlers/[...slug].tsx @@ -29,6 +29,7 @@ export default function JSReference(props) { spec={spec} typeSpec={typeSpec} pageProps={props} + type="client-lib" /> ) diff --git a/apps/docs/pages/reference/dart/v0/[...slug].tsx b/apps/docs/pages/reference/dart/v0/[...slug].tsx index 9a74ea2583d..4b6a485d9c6 100644 --- a/apps/docs/pages/reference/dart/v0/[...slug].tsx +++ b/apps/docs/pages/reference/dart/v0/[...slug].tsx @@ -9,7 +9,7 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) export default function JSReference(props) { - return + return } export async function getStaticProps() { diff --git a/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx b/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx index 18d7c8cac37..8539659431d 100644 --- a/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/dart/v0/crawlers/[...slug].tsx @@ -28,6 +28,7 @@ export default function JSReference(props) { spec={spec} typeSpec={typeSpec} pageProps={props} + type="client-lib" /> ) diff --git a/apps/docs/pages/reference/javascript/[...slug].tsx b/apps/docs/pages/reference/javascript/[...slug].tsx index 31e44d594aa..3cbbcc08694 100644 --- a/apps/docs/pages/reference/javascript/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/[...slug].tsx @@ -10,7 +10,15 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) export default function JSReference(props) { - return + return ( + + ) } export async function getStaticProps() { diff --git a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx index feebcf6998e..67c72c5151c 100644 --- a/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/crawlers/[...slug].tsx @@ -29,6 +29,7 @@ export default function JSReference(props) { spec={spec} typeSpec={typeSpec} pageProps={props} + type="client-lib" /> ) diff --git a/apps/docs/pages/reference/javascript/v1/[...slug].tsx b/apps/docs/pages/reference/javascript/v1/[...slug].tsx index 1eeb40044f1..4dd32c156ca 100644 --- a/apps/docs/pages/reference/javascript/v1/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/v1/[...slug].tsx @@ -10,7 +10,15 @@ import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps' const sections = flattenSections(clientLibsCommonSections) export default function JSReference(props) { - return + return ( + + ) } export async function getStaticProps() { diff --git a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx index 3f59baad46e..18c498125ef 100644 --- a/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx +++ b/apps/docs/pages/reference/javascript/v1/crawlers/[...slug].tsx @@ -28,6 +28,7 @@ export default function JSReference(props) { spec={spec} typeSpec={typeSpec} pageProps={props} + type="client-lib" /> ) diff --git a/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx b/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx index 64c91fb4f5e..c7b2382af16 100644 --- a/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-auth/[...slug].tsx @@ -12,7 +12,7 @@ const sections = flattenSections(selfHostingAuthCommonSections) const spec = gen_v3(authSpec, 'wat', { apiUrl: 'apiv0' }) export default function JSReference(props) { - return + return } export async function getStaticProps() { diff --git a/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx b/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx index beb4f192715..49e91894a06 100644 --- a/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-realtime/[...slug].tsx @@ -9,7 +9,7 @@ import { gen_v3 } from '~/lib/refGenerator/helpers' const sections = flattenSections(selfHostingRealtimeCommonSections) export default function JSReference(props) { - return + return } export async function getStaticProps() { diff --git a/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx b/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx index ea76596b3f8..1b4b99fb9c8 100644 --- a/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx +++ b/apps/docs/pages/reference/self-hosting-storage/[...slug].tsx @@ -12,7 +12,7 @@ const sections = flattenSections(selfHostingStorageCommonSections) const spec = gen_v3(storageSpec, 'wat', { apiUrl: 'apiv0' }) export default function JSReference(props) { - return + return } export async function getStaticProps() { diff --git a/apps/docs/public/sitemap.xml b/apps/docs/public/sitemap.xml index 38b0e06220a..2e86001d252 100644 --- a/apps/docs/public/sitemap.xml +++ b/apps/docs/public/sitemap.xml @@ -78,6 +78,12 @@ 0.5 + + https://supabase.com/docs/guides/self-hosting + weekly + 0.5 + + https://supabase.com/docs/guides/storage weekly @@ -126,6 +132,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/database/arrays weekly @@ -216,78 +294,6 @@ 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 @@ -570,12 +576,6 @@ 0.5 - - https://supabase.com/docs/guides/resources/self-hosting - weekly - 0.5 - - https://supabase.com/docs/guides/resources/supabase-cli weekly @@ -612,6 +612,12 @@ 0.5 + + https://supabase.com/docs/guides/self-hosting/docker + weekly + 0.5 + + https://supabase.com/docs/learn/auth-deep-dive/auth-deep-dive-jwts weekly @@ -642,42 +648,6 @@ 0.5 - - https://supabase.com/docs/guides/database/extensions/http - 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 - weekly - 0.5 - - https://supabase.com/docs/guides/auth/auth-helpers/auth-ui weekly @@ -829,25 +799,43 @@ - https://supabase.com/docs/guides/functions/examples/og-image + https://supabase.com/docs/guides/database/extensions/http weekly 0.5 - https://supabase.com/docs/guides/getting-started/quickstarts/nextjs + https://supabase.com/docs/guides/database/extensions/pgcron weekly 0.5 - https://supabase.com/docs/guides/getting-started/quickstarts/nuxtjs + https://supabase.com/docs/guides/database/extensions/pgnet weekly 0.5 - https://supabase.com/docs/guides/getting-started/quickstarts/reactjs + 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/postgis + weekly + 0.5 + + + + https://supabase.com/docs/guides/database/extensions/uuid-ossp weekly 0.5 @@ -936,6 +924,30 @@ 0.5 + + https://supabase.com/docs/guides/functions/examples/og-image + 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/platform/sso/azure weekly @@ -954,6 +966,24 @@ 0.5 + + https://supabase.com/docs/guides/resources/supabase-cli/local-development + weekly + 0.5 + + + + https://supabase.com/docs/guides/resources/supabase-cli/managing-environments + weekly + 0.5 + + + + https://supabase.com/docs/guides/self-hosting/auth/config + weekly + 0.5 + + https://supabase.com/docs/guides/resources/migrating-to-supabase/firebase-auth weekly @@ -979,19 +1009,13 @@ - https://supabase.com/docs/guides/resources/self-hosting/docker + https://supabase.com/docs/guides/self-hosting/realtime/config weekly 0.5 - https://supabase.com/docs/guides/resources/supabase-cli/local-development - weekly - 0.5 - - - - https://supabase.com/docs/guides/resources/supabase-cli/managing-environments + https://supabase.com/docs/guides/self-hosting/storage/config weekly 0.5 @@ -3326,6 +3350,24 @@ 0.5 + + https://supabase.com/docs/reference/cli/supabase-network-bans + weekly + 0.5 + + + + https://supabase.com/docs/reference/cli/supabase-network-bans-remove + weekly + 0.5 + + + + https://supabase.com/docs/reference/cli/supabase-network-bans-get + weekly + 0.5 + + https://supabase.com/docs/reference/cli/supabase-migration weekly @@ -3488,6 +3530,12 @@ 0.5 + + https://supabase.com/docs/reference/cli/supabase-db-dump + weekly + 0.5 + + https://supabase.com/docs/reference/cli/supabase-db-diff weekly