Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Run prettier

Terry Sutton89369f213086
diff --git a/apps/temp-docs/_supabase_js/release-notes.md b/apps/temp-docs/_supabase_js/release-notes.md
index d77cf283abc..715215f2197 100644
--- a/apps/temp-docs/_supabase_js/release-notes.md
+++ b/apps/temp-docs/_supabase_js/release-notes.md
@@ -82,9 +82,7 @@ Previously `nullsFirst` defaults to `false` , meaning `null`s are ordered last.
Storage key name in the Auth library has changed to include project reference which means that existing websites that had their JWT expiry set to a longer time could find their users logged out with this upgrade.
```jsx
-const defaultStorageKey = `sb-${
- new URL(this.authUrl).hostname.split('.')[0]
-}-auth-token`
+const defaultStorageKey = `sb-${new URL(this.authUrl).hostname.split('.')[0]}-auth-token`
```
### New Auth Types
diff --git a/apps/temp-docs/_supabase_js/working-with-types.md b/apps/temp-docs/_supabase_js/working-with-types.md
index 519650ed995..cb564843bba 100644
--- a/apps/temp-docs/_supabase_js/working-with-types.md
+++ b/apps/temp-docs/_supabase_js/working-with-types.md
@@ -43,10 +43,7 @@ You can enrich the supabase client with the types you generated with Supabase.
import { createClient } from '@supabase/supabase-js'
import { Database } from 'lib/database.types'
-const supabase = createClient<Database>(
- process.env.SUPABASE_URL,
- process.env.SUPABASE_ANON_KEY
-)
+const supabase = createClient<Database>(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY)
```
## Type hints
diff --git a/apps/temp-docs/generator/api.ts b/apps/temp-docs/generator/api.ts
index 602842c4014..9358306f733 100644
--- a/apps/temp-docs/generator/api.ts
+++ b/apps/temp-docs/generator/api.ts
@@ -4,11 +4,7 @@ import { OpenAPIV3, OpenAPIV2 } from 'openapi-types'
import * as fs from 'fs'
import * as ejs from 'ejs'
-export default async function gen(
- inputFileName: string,
- outputDir: string,
- apiUrl: string
-) {
+export default async function gen(inputFileName: string, outputDir: string, apiUrl: string) {
const specRaw = fs.readFileSync(inputFileName, 'utf8')
const spec = JSON.parse(specRaw) as any
// console.log('spec', spec)
@@ -42,11 +38,7 @@ type enrichedOperation = OpenAPIV3.OperationObject & {
fullPath: string
operationId: string
}
-async function gen_v3(
- spec: OpenAPIV3.Document,
- dest: string,
- { apiUrl }: { apiUrl: string }
-) {
+async function gen_v3(spec: OpenAPIV3.Document, dest: string, { apiUrl }: { apiUrl: string }) {
const specLayout = spec.tags || []
const operations: enrichedOperation[] = []
Object.entries(spec.paths).forEach(([key, val]) => {
@@ -60,8 +52,7 @@ async function gen_v3(
fullPath,
operationId: slugify(operation.summary!),
- responseList:
- toArrayWithKey(operation.responses!, 'responseCode') || [],
+ responseList: toArrayWithKey(operation.responses!, 'responseCode') || [],
}
operations.push(enriched)
})
@@ -72,9 +63,7 @@ async function gen_v3(
...section,
title: toTitle(section.name),
id: slugify(section.name),
- operations: operations.filter((operation) =>
- operation.tags?.includes(section.name)
- ),
+ operations: operations.filter((operation) => operation.tags?.includes(section.name)),
}
})
@@ -90,11 +79,7 @@ async function gen_v3(
}
// OPENAPI-SPEC-VERSION: 2.0
-async function gen_v2(
- spec: OpenAPIV2.Document,
- dest: string,
- { apiUrl }: { apiUrl: string }
-) {
+async function gen_v2(spec: OpenAPIV2.Document, dest: string, { apiUrl }: { apiUrl: string }) {
const specLayout = spec.tags || []
const operations: enrichedOperation[] = []
Object.entries(spec.paths).forEach(([key, val]) => {
@@ -108,8 +93,7 @@ async function gen_v2(
fullPath,
operationId: slugify(operation.summary!),
- responseList:
- toArrayWithKey(operation.responses!, 'responseCode') || [],
+ responseList: toArrayWithKey(operation.responses!, 'responseCode') || [],
}
operations.push(enriched)
})
@@ -120,9 +104,7 @@ async function gen_v2(
...section,
title: toTitle(section.name),
id: slugify(section.name),
- operations: operations.filter((operation) =>
- operation.tags?.includes(section.name)
- ),
+ operations: operations.filter((operation) => operation.tags?.includes(section.name)),
}
})
diff --git a/apps/temp-docs/generator/cli.ts b/apps/temp-docs/generator/cli.ts
index 9d554feb79f..626e39fadb9 100644
--- a/apps/temp-docs/generator/cli.ts
+++ b/apps/temp-docs/generator/cli.ts
@@ -27,9 +27,7 @@ async function gen_v001(spec: CliSpec, dest: string) {
const commands = spec.commands.map((x) => {
const isChild = x.subcommands.length < 1
- const heading = isChild
- ? `### ${x.summary} {#${x.id}}`
- : `## ${x.summary} {#${x.id}}`
+ const heading = isChild ? `### ${x.summary} {#${x.id}}` : `## ${x.summary} {#${x.id}}`
return {
...x,
diff --git a/apps/temp-docs/generator/config.ts b/apps/temp-docs/generator/config.ts
index 378857b998c..cb6af22cf00 100644
--- a/apps/temp-docs/generator/config.ts
+++ b/apps/temp-docs/generator/config.ts
@@ -32,9 +32,7 @@ export default async function gen(inputFileName: string, outputDir: string) {
async function gen_v001(spec: ConfigSpec, dest: string) {
const specLayout = spec.info.tags
const sections = specLayout.map((section: Section) => {
- const parameters = spec.parameters.filter(
- (parameter) => parameter.tags[0] === section.id
- )
+ const parameters = spec.parameters.filter((parameter) => parameter.tags[0] === section.id)
return { ...section, parameters }
})
diff --git a/apps/temp-docs/generator/legacy.ts b/apps/temp-docs/generator/legacy.ts
index 6a2b906af3f..e3d6130be4f 100644
--- a/apps/temp-docs/generator/legacy.ts
+++ b/apps/temp-docs/generator/legacy.ts
@@ -11,11 +11,7 @@
import Example from './legacy/components/Example'
import Page from './legacy/components/Page'
import Tab from './legacy/components/Tab'
-import {
- slugify,
- tsDocCommentToMdComment,
- writeToDisk,
-} from './legacy/lib/helpers'
+import { slugify, tsDocCommentToMdComment, writeToDisk } from './legacy/lib/helpers'
import { TsDoc, OpenRef } from './legacy/definitions'
import { uniqBy } from 'lodash'
import * as fs from 'fs'
@@ -23,19 +19,15 @@ import * as yaml from 'js-yaml'
export default async function gen(inputFileName: string, outputDir: string) {
const docSpec = yaml.load(fs.readFileSync(inputFileName, 'utf8'))
- const defRef = docSpec.info.definition
- ? fs.readFileSync(docSpec.info.definition, 'utf8')
- : '{}'
+ const defRef = docSpec.info.definition ? fs.readFileSync(docSpec.info.definition, 'utf8') : '{}'
const definition = JSON.parse(defRef)
const id = docSpec.info.id
const allLanguages = docSpec.info.libraries
- const pages = Object.entries(docSpec.pages).map(
- ([name, x]: [string, OpenRef.Page]) => ({
- ...x,
- pageName: name,
- })
- )
+ const pages = Object.entries(docSpec.pages).map(([name, x]: [string, OpenRef.Page]) => ({
+ ...x,
+ pageName: name,
+ }))
// Index Page
const indexFilename = outputDir + `/index.mdx`
@@ -49,12 +41,10 @@ export default async function gen(inputFileName: string, outputDir: string) {
const slug = slugify(pageSpec.pageName)
const hasTsRef = pageSpec['$ref'] || null
const tsDefinition = hasTsRef && extractTsDocNode(hasTsRef, definition)
- if (hasTsRef && !tsDefinition)
- throw new Error('Definition not found: ' + hasTsRef)
+ if (hasTsRef && !tsDefinition) throw new Error('Definition not found: ' + hasTsRef)
const description =
- pageSpec.description ||
- tsDocCommentToMdComment(getDescriptionFromDefintion(tsDefinition))
+ pageSpec.description || tsDocCommentToMdComment(getDescriptionFromDefintion(tsDefinition))
// Create page
const content = Page({
@@ -64,16 +54,8 @@ export default async function gen(inputFileName: string, outputDir: string) {
title: pageSpec.title || pageSpec.pageName,
description,
parameters: hasTsRef ? generateParameters(tsDefinition) : '',
- spotlight: generateSpotlight(
- id,
- pageSpec['examples'] || [],
- allLanguages
- ),
- examples: generateExamples(
- id,
- pageSpec['examples'] || [],
- allLanguages
- ),
+ spotlight: generateSpotlight(id, pageSpec['examples'] || [], allLanguages),
+ examples: generateExamples(id, pageSpec['examples'] || [], allLanguages),
notes: pageSpec.notes,
})
@@ -96,33 +78,24 @@ function generateParameters(tsDefinition: any) {
} else functionDeclaration = tsDefinition?.type?.declaration
if (!functionDeclaration) return ''
- const paramDefinitions: TsDoc.TypeDefinition[] =
- functionDeclaration.signatures[0].parameters // PMC: seems flaky.. why the [0]?
+ const paramDefinitions: TsDoc.TypeDefinition[] = functionDeclaration.signatures[0].parameters // PMC: seems flaky.. why the [0]?
if (!paramDefinitions) return ''
// const paramsComments: TsDoc.CommentTag = tsDefinition.comment?.tags?.filter(x => x.tag == 'param')
- let parameters = paramDefinitions
- .map((x) => recurseThroughParams(x))
- .join(`\n`)
+ let parameters = paramDefinitions.map((x) => recurseThroughParams(x)).join(`\n`)
return methodListGroup(parameters)
}
function getDescriptionFromDefintion(tsDefinition) {
if (!tsDefinition) return null
- if (
- ['Method', 'Constructor', 'Constructor signature'].includes(
- tsDefinition.kindString
- )
- )
+ if (['Method', 'Constructor', 'Constructor signature'].includes(tsDefinition.kindString))
return tsDefinition?.signatures[0].comment
else return tsDefinition?.comment || ''
}
function recurseThroughParams(paramDefinition: TsDoc.TypeDefinition) {
// If this is a reference to another Param, let's use the reference instead
- let param = isDereferenced(paramDefinition)
- ? paramDefinition.type?.dereferenced
- : paramDefinition
+ let param = isDereferenced(paramDefinition) ? paramDefinition.type?.dereferenced : paramDefinition
const labelParams = generateLabelParam(param)
let subContent = ''
@@ -131,9 +104,7 @@ function recurseThroughParams(paramDefinition: TsDoc.TypeDefinition) {
children = param.type?.declaration?.children
} else if (isUnion(param)) {
// We don't want to show the union types if it's a literal
- const nonLiteralVariants = param.type.types.filter(
- ({ type }) => type !== 'literal'
- )
+ const nonLiteralVariants = param.type.types.filter(({ type }) => type !== 'literal')
if (nonLiteralVariants.length === 0) {
children = null
@@ -158,10 +129,7 @@ function recurseThroughParams(paramDefinition: TsDoc.TypeDefinition) {
}
const isDereferenced = (paramDefinition: TsDoc.TypeDefinition) => {
- return (
- paramDefinition.type?.type == 'reference' &&
- paramDefinition.type?.dereferenced?.id
- )
+ return paramDefinition.type?.type == 'reference' && paramDefinition.type?.dereferenced?.id
}
const isUnion = (paramDefinition: TsDoc.TypeDefinition) => {
@@ -183,10 +151,7 @@ const methodListGroup = (items) => `
</ul>
`
-const methodListItemLabel = (
- { name, isOptional, type, description },
- subContent
-) => `
+const methodListItemLabel = ({ name, isOptional, type, description }, subContent) => `
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
@@ -210,9 +175,7 @@ ${description ? description : 'No description provided. '}
function generateExamples(id: string, specExamples: any, allLanguages: any) {
return specExamples.map((example) => {
- let allTabs = example.hideCodeBlock
- ? ''
- : generateCodeBlocks(allLanguages, example)
+ let allTabs = example.hideCodeBlock ? '' : generateCodeBlocks(allLanguages, example)
return Example({
name: example.name,
description: example.description,
@@ -225,21 +188,12 @@ function generateExamples(id: string, specExamples: any, allLanguages: any) {
/**
* A spotlight is an example which appears at the top of the page.
*/
-function generateSpotlight(
- id: string,
- specExamples: any | any[],
- allLanguages: any
-) {
+function generateSpotlight(id: string, specExamples: any | any[], allLanguages: any) {
if (!Array.isArray(specExamples)) {
- throw new Error(
- `Examples for each spec should be an array, received: \n${specExamples}`
- )
+ throw new Error(`Examples for each spec should be an array, received: \n${specExamples}`)
}
- const spotlight =
- (specExamples && specExamples.find((x) => x.isSpotlight)) || null
- const spotlightContent = !spotlight
- ? ''
- : generateCodeBlocks(allLanguages, spotlight)
+ const spotlight = (specExamples && specExamples.find((x) => x.isSpotlight)) || null
+ const spotlightContent = !spotlight ? '' : generateCodeBlocks(allLanguages, spotlight)
return spotlightContent
}
@@ -274,18 +228,14 @@ function generateLabelParam(param: any) {
name: param.name ?? param.value,
isOptional: !!param.flags?.isOptional,
type: param.type,
- description: param.comment
- ? tsDocCommentToMdComment(param.comment)
- : null,
+ description: param.comment ? tsDocCommentToMdComment(param.comment) : null,
}
} else {
labelParams = {
name: param.name ?? extractParamTypeAsString(param),
isOptional: !!param.flags?.isOptional,
type: extractParamTypeAsString(param),
- description: param.comment
- ? tsDocCommentToMdComment(param.comment)
- : null,
+ description: param.comment ? tsDocCommentToMdComment(param.comment) : null,
}
}
return labelParams
@@ -322,14 +272,9 @@ function extractTsDocNode(nodeToFind: string, definition: any) {
let currentNode = definition
while (i < nodePath.length) {
previousNode = currentNode
- currentNode =
- previousNode.children.find((x) => x.name == nodePath[i]) || null
+ currentNode = previousNode.children.find((x) => x.name == nodePath[i]) || null
if (currentNode == null) {
- console.log(
- `Cant find ${nodePath[i]} in ${previousNode.children.map(
- (x) => '\n' + x.name
- )}`
- )
+ console.log(`Cant find ${nodePath[i]} in ${previousNode.children.map((x) => '\n' + x.name)}`)
break
}
i++
diff --git a/apps/temp-docs/generator/legacy/components/Tabs.ts b/apps/temp-docs/generator/legacy/components/Tabs.ts
index c353c2e8e84..9daff630c93 100644
--- a/apps/temp-docs/generator/legacy/components/Tabs.ts
+++ b/apps/temp-docs/generator/legacy/components/Tabs.ts
@@ -5,9 +5,7 @@ const Tabs = (id: string, libraries = [], examples = []) =>
<Tabs
defaultValue="${libraries[0].id}"
groupId="${id}"
- values={[${libraries
- .map((x) => `{ label: '${x.name}', value: '${x.id}' }`)
- .toString()}]}>
+ values={[${libraries.map((x) => `{ label: '${x.name}', value: '${x.id}' }`).toString()}]}>
${examples}
diff --git a/apps/temp-docs/tsconfig.json b/apps/temp-docs/tsconfig.json
index 7764a54448c..53c59dc60b8 100644
--- a/apps/temp-docs/tsconfig.json
+++ b/apps/temp-docs/tsconfig.json
@@ -4,16 +4,10 @@
"noImplicitAny": false,
"baseUrl": ".",
"paths": {
- "~/*": [
- "./*"
- ]
+ "~/*": ["./*"]
},
"target": "es5",
- "lib": [
- "dom",
- "dom.iterable",
- "esnext"
- ],
+ "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
@@ -26,12 +20,6 @@
"jsx": "preserve",
"module": "esnext"
},
- "include": [
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx"
- ],
- "exclude": [
- "node_modules"
- ]
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
+ "exclude": ["node_modules"]
}