Initial commit

This commit is contained in:
Jan Tennert committed 2023-05-07 19:55:08 +02:00
1 parent afc74aa730
commit c12277b864
21 files changed
+3256 -7

No files matched your search

@@ -122,6 +122,13 @@ const home = [
level: 'reference_swift',
community: true,
},
{
label: 'Kotlin',
icon: '/img/icons/menu/reference-kotlin',
href: '/reference/kotlin/introduction',
level: 'reference_kotlin',
community: true,
},
{
label: 'Tools',
},
@@ -25,6 +25,12 @@ export const REFERENCES: References = {
versions: ['v0'],
icon: '/docs/img/libraries/swift-icon.svg',
},
kotlin: {
name: 'Kotlin',
library: 'supabase-kt',
versions: ['v0'],
icon: '/docs/img/libraries/kotlin-icon.svg',
},
cli: {
name: 'CLI',
library: undefined,
@@ -985,6 +991,13 @@ export const reference = {
items: [],
icon: '/img/icons/menu/reference-swift',
},
{
name: 'supabase-kt',
url: '/reference/kotlin/start',
level: 'reference_kotlin',
items: [],
icon: '/img/icons/menu/reference-kotlin',
},
// {
// name: 'supabase-python',
// url: '/reference/python/start',
@@ -1061,6 +1074,13 @@ export const reference_swift_v0 = {
parent: '/reference',
}
export const reference_kotlin_v0 = {
icon: 'reference-kotlin',
title: 'kotlin',
url: 'guides/reference/kotlin',
parent: '/reference',
}
export const reference_cli = {
icon: 'reference-cli',
title: 'Supabase CLI',
@@ -1182,6 +1202,13 @@ export const references = [
icon: '/docs/img/icons/swift-icon.svg',
url: '/reference/swift/start',
},
{
label: 'supabase-kt',
versions: ['v0'],
description: 'something about the reference',
icon: '/docs/img/icons/kotlin-icon.svg',
url: '/reference/kotlin/start',
},
],
},
{
@@ -17,6 +17,8 @@ import spec_csharp_v0 from '~/../../spec/supabase_csharp_v0.yml' assert { type:
import spec_python_v2 from '~/../../spec/supabase_py_v2.yml' assert { type: 'yml' }
// @ts-expect-error
import spec_swift_v0 from '~/../../spec/supabase_swift_v0.yml' assert { type: 'yml' }
// @ts-expect-error
import spec_kotlin_v0 from '~/../../spec/supabase_kt_v0.yml' assert { type: 'yml' }
// import { gen_v3 } from '~/lib/refGenerator/helpers'
import apiCommonSections from '~/../../spec/common-api-sections.json'
@@ -59,6 +61,7 @@ export type RefIdOptions =
| 'reference_csharp_v0'
| 'reference_python_v2'
| 'reference_swift_v0'
| 'reference_kotlin_v0'
| 'reference_cli'
| 'reference_api'
| 'reference_self_hosting_auth'
@@ -73,6 +76,7 @@ export type RefKeyOptions =
| 'csharp'
| 'python'
| 'swift'
| 'kotlin'
| 'cli'
| 'api'
| 'self-hosting-auth'
@@ -153,6 +157,10 @@ const NavigationMenu = () => {
case url.includes(`/docs/reference/swift`) && url:
menuState.setMenuLevelId('reference_swift_v0')
break
// kotlin v1 (latest)
case url.includes(`/docs/reference/kotlin`) && url:
menuState.setMenuLevelId('reference_kotlin_v0')
break
case url.includes(`/docs/reference/cli/config`) && url:
menuState.setMenuLevelId('supabase_cli')
break
@@ -216,6 +224,7 @@ const NavigationMenu = () => {
const isReference_Csharp_V0 = 'reference_csharp_v0' === level
const isReference_Python_V2 = 'reference_python_v2' === level
const isReference_Swift_V0 = 'reference_swift_v0' === level
const isReference_Kotlin_V0 = 'reference_kotlin_v0' === level
const isReference_Cli = 'reference_cli' === level
const isReference_Api = 'reference_api' === level
const isReference_Self_Hosting_Auth = 'reference_self_hosting_auth' === level
@@ -294,6 +303,14 @@ const NavigationMenu = () => {
lib="swift"
spec={spec_swift_v0}
/>
<NavigationMenuRefList
key={'reference-kt-menu-v0'}
id={'reference_kotlin_v0'}
active={isReference_Kotlin_V0}
commonSections={libCommonSections}
lib="kotlin"
spec={spec_kotlin_v0}
/>
<NavigationMenuRefList
key={'reference-python-menu-v2'}
id={'reference_python_v2'}
@@ -123,6 +123,8 @@ const RefFunctionSection: React.FC<IRefFunctionSection> = (props) => {
? 'dart'
: example?.code?.startsWith('```c#')
? 'csharp'
: example?.code?.startsWith('```kotlin')
? 'kotlin'
: 'js'
// `
// import { createClient } from '@supabase/supabase-js'
@@ -156,7 +158,9 @@ const RefFunctionSection: React.FC<IRefFunctionSection> = (props) => {
.replace('js', '')
.replace('ts', '')
.replace('dart', '')
.replace('c#', ''))}
.replace('c#', '')
.replace('kotlin', ''))
}
</CodeBlock>
{((tables && tables.length > 0) || sql) && (
@@ -16,6 +16,8 @@ const nonGeneratedReferencePages = [
'docs/reference/csharp',
'docs/reference/csharp/installing',
'docs/reference/csharp/initializing',
'docs/reference/kotlin/installing',
'docs/reference/kotlin/initializing',
'docs/reference/api',
'docs/reference/api/release-notes',
'docs/reference/cli',
+210
View File
@@ -0,0 +1,210 @@
---
id: installing
title: 'Installing & Initialization'
slug: installing
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml
---
#### Add one or more modules to your project
<RefSubLayout.EducationRow>
<RefSubLayout.Examples>
You can find the latest version on [GitHub](https://github.com/supabase-community/supabase-kt/releases)
Add dependency to your build file:
<Tabs
size="small"
type="underlined"
defaultActiveId="kotlin">
<TabPanel id="kotlin" label="build.gradle.kts">
```kotlin
implementation("io.github.jan-tennert.supabase:[module]:VERSION")
```
</TabPanel>
<TabPanel id="groovy" label="build.gradle">
```groovy
implementation 'io.github.jan-tennert.supabase:[module]:VERSION'
```
</TabPanel>
<TabPanel id="xml" label="pom.xml">
```xml
<dependency>
<groupId>io.github.jan-tennert.supabase</groupId>
<artifactId>[module]</artifactId>
<version>VERSION</version>
</dependency>
```
</TabPanel>
</Tabs>
The available modules are: **gotrue-kt**, **realtime-kt**, **storage-kt**, **functions-kt**, **postgrest-kt** and **apollo-graphql**
When using multiple modules, you can also use the BOM dependency to ensure that all modules use the same version:
<Tabs
size="small"
type="underlined"
defaultActiveId="kotlin">
<TabPanel id="kotlin" label="build.gradle.kts">
```kotlin
implementation(platform("io.github.jan-tennert.supabase:bom:VERSION"))
implementation("io.github.jan-tennert.supabase:postgrest-kt")
implementation("io.github.jan-tennert.supabase:realtime-kt")
```
</TabPanel>
<TabPanel id="groovy" label="build.gradle">
```groovy
implementation platform("io.github.jan-tennert.supabase:bom:VERSION")
implementation 'io.github.jan-tennert.supabase:postgrest-kt'
implementation 'io.github.jan-tennert.supabase:realtime-kt'
```
</TabPanel>
<TabPanel id="xml" label="pom.xml">
```xml
<dependency>
<groupId>io.github.jan-tennert.supabase</groupId>
<artifactId>bom</artifactId>
<version>VERSION</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.github.jan-tennert.supabase</groupId>
<artifactId>postgrest-kt</artifactId>
</dependency>
<dependency>
<groupId>io.github.jan-tennert.supabase</groupId>
<artifactId>realtime-kt</artifactId>
</dependency>
```
</TabPanel>
</Tabs>
</RefSubLayout.Examples>
</RefSubLayout.EducationRow>
#### Add Ktor Client Engine to each of your kotlin targets (required)
<RefSubLayout.EducationRow>
<RefSubLayout.Examples>
You can find a list of engines [here](https://ktor.io/docs/http-client-engines.html)
<Tabs
size="small"
type="underlined"
defaultActiveId="kotlin">
<TabPanel id="kotlin" label="build.gradle.kts">
```kotlin
implementation("io.ktor:ktor-client-[engine]:KTOR_VERSION")
```
</TabPanel>
<TabPanel id="groovy" label="build.gradle">
```groovy
implementation 'io.ktor:ktor-client-[engine]:KTOR_VERSION'
```
</TabPanel>
<TabPanel id="xml" label="pom.xml">
```xml
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-[engine]</artifactId>
<version>KTOR_VERSION</version>
</dependency>
```
</TabPanel>
</Tabs>
</RefSubLayout.Examples>
</RefSubLayout.EducationRow>
#### Add KotlinX Serialization (required for postgrest and realtime serialization)
<RefSubLayout.EducationRow>
<RefSubLayout.Examples>
Add the serialization plugin
<Tabs
size="small"
type="underlined"
defaultActiveId="kotlin">
<TabPanel id="kotlin" label="build.gradle.kts">
```kotlin
plugins {
kotlin("plugin.serialization") version "KOTLIN_VERSION"
}
```
</TabPanel>
<TabPanel id="groovy" label="build.gradle">
```groovy
plugins {
id 'org.jetbrains.kotlin.plugin.serialization' version 'KOTLIN_VERSION'
}
```
</TabPanel>
<TabPanel id="xml" label="pom.xml">
```xml
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<compilerPlugins>
<plugin>kotlinx-serialization</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-serialization</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
```
</TabPanel>
</Tabs>
</RefSubLayout.Examples>
</RefSubLayout.EducationRow>
@@ -0,0 +1,33 @@
---
id: introduction
title: Introduction
hideTitle: true
---
<div className="flex items-start gap-6 not-prose" id="introduction">
<img src="/docs/img/icons/menu/reference-kotlin.svg" className="w-8 h-8 rounded" />
<div className="flex flex-col gap-2">
<h1 className="text-3xl text-scale-1200 m-0">Kotlin Client Library</h1>
<h2 className="text-base font-mono text-scale-1100">@supabase-community/supabase-kt</h2>
</div>
</div>
<div className="max-w-xl">
This reference documents every object and method available in Supabase's Kotlin Multiplatform library, [supabase-kt](https://github.com/supabase-community/supabase-kt). You can use supabase-kt to interact with your Postgres database, listen to database changes, invoke Deno Edge Functions, build login and user management functionality, and manage large files.
Supported Kotlin targets:
- JVM (Desktop)
- Android
- iOS (Experimental)
- JS (Browser)
</div>
<div className="max-w-xl bg-slate-300 px-4 py-2 rounded-md">
<p>The Kotlin client library is created and maintained by the Supabase community, and is not an official library. Please be tolerant of areas where the library is still being developed, and — as with all the libraries — feel free to contribute wherever you find issues.</p>
<p>
Huge thanks to official maintainer, [jan-tennert](https://github.com/jan-tennert).
</p>
</div>
@@ -12,6 +12,7 @@ const clientLibFiles = [
{ fileName: 'supabase_py_v2', label: 'python', version: 'v2', versionSlug: false },
{ fileName: 'supabase_csharp_v0', label: 'csharp', version: 'v0', versionSlug: false },
{ fileName: 'supabase_swift_v0', label: 'swift', version: 'v0', versionSlug: false },
{ fileName: 'supabase_kt_v0', label: 'kotlin', version: 'v0', versionSlug: false },
]
export function generateReferencePages() {
+4
View File
@@ -94,6 +94,10 @@ const levelsData = {
icon: '/docs/img/icons/menu/reference-swift',
name: 'Swift Reference v1.0',
},
reference_kotlin_v0: {
icon: '/docs/img/icons/menu/reference-kotlin',
name: 'Kotlin Reference v0.0',
},
reference_cli: {
icon: '/docs/img/icons/menu/reference-cli',
name: 'CLI Reference',
@@ -0,0 +1,21 @@
import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json'
// @ts-expect-error
import spec from '~/../../spec/supabase_kt_v0.yml' assert { type: 'yml' }
import RefSectionHandler from '~/components/reference/RefSectionHandler'
import { flattenSections } from '~/lib/helpers'
import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths'
import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps'
const sections = flattenSections(clientLibsCommonSections)
export default function JSReference(props) {
return <RefSectionHandler sections={sections} spec={spec} pageProps={props} type="client-lib" />
}
export async function getStaticProps() {
return handleRefStaticProps(sections, '/kotlin')
}
export function getStaticPaths() {
return handleRefGetStaticPaths()
}
@@ -0,0 +1,44 @@
import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json'
import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json'
// @ts-expect-error
import spec from '~/../../spec/supabase_kt_v0.yml' assert { type: 'yml' }
import RefSectionHandler from '~/components/reference/RefSectionHandler'
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) {
const router = useRouter()
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 (
<>
<RefSEO title={pageTitle} />
<RefSectionHandler
sections={filteredSection}
spec={spec}
typeSpec={typeSpec}
pageProps={props}
type="client-lib"
/>
</>
)
}
export async function getStaticProps() {
return handleRefStaticProps(sections, '/kotlin')
}
export function getStaticPaths() {
return handleRefGetStaticPaths()
}
@@ -0,0 +1,21 @@
import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json'
// @ts-expect-error
import spec from '~/../../spec/supabase_kt_v0.yml' assert { type: 'yml' }
import RefSectionHandler from '~/components/reference/RefSectionHandler'
import { flattenSections } from '~/lib/helpers'
import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths'
import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps'
const sections = flattenSections(clientLibsCommonSections)
export default function JSReference(props) {
return <RefSectionHandler sections={sections} spec={spec} pageProps={props} type="client-lib" />
}
export async function getStaticProps() {
return handleRefStaticProps(sections, '/kotlin/v0')
}
export function getStaticPaths() {
return handleRefGetStaticPaths()
}
@@ -0,0 +1,43 @@
import clientLibsCommonSections from '~/../../spec/common-client-libs-sections.json'
import typeSpec from '~/../../spec/enrichments/tsdoc_v2/combined.json'
// @ts-expect-error
import spec from '~/../../spec/supabase_kt_v0.yml' assert { type: 'yml' }
import RefSectionHandler from '~/components/reference/RefSectionHandler'
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) {
const router = useRouter()
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 (
<>
<RefSEO title={pageTitle} />
<RefSectionHandler
sections={filteredSection}
spec={spec}
typeSpec={typeSpec}
pageProps={props}
type="client-lib"
/>
</>
)
}
export async function getStaticProps() {
return handleRefStaticProps(sections, '/kotlin/v0')
}
export function getStaticPaths() {
return handleRefGetStaticPaths()
}
@@ -0,0 +1,6 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
<g id="Logotypes">
<polygon points="500,500 0,500 0,0 500,0 250,250 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 301 B

@@ -0,0 +1,9 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g id="Logotypes">
<polygon class="st0" points="500,500 0,500 0,0 500,0 250,250 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 367 B

@@ -68,6 +68,14 @@ export async function fetchSources() {
'../../spec/common-client-libs-sections.json'
)
const ktLibReferenceSource = new ClientLibReferenceSource(
'kt-lib',
'/reference/kotlin',
{ title: 'Kotlin Reference' },
'../../spec/supabase_kt_v0.yml',
'../../spec/common-client-libs-sections.json'
)
const cliReferenceSource = new CliReferenceSource(
'cli',
'/reference/cli',
@@ -96,6 +104,7 @@ export async function fetchSources() {
pythonLibReferenceSource,
cSharpLibReferenceSource,
swiftLibReferenceSource,
ktLibReferenceSource,
cliReferenceSource,
...githubDiscussionSources,
...guideSources,
+3 -1
View File
@@ -6,10 +6,11 @@ import bash from 'react-syntax-highlighter/dist/cjs/languages/hljs/bash'
import js from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript'
import py from 'react-syntax-highlighter/dist/cjs/languages/hljs/python'
import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql'
import kotlin from 'react-syntax-highlighter/dist/cjs/languages/hljs/kotlin'
import monokaiCustomTheme from './CodeBlock.utils'
export interface CodeBlockProps {
lang: 'js' | 'sql' | 'py' | 'bash' | 'ts' | 'tsx'
lang: 'js' | 'sql' | 'py' | 'bash' | 'ts' | 'tsx' | 'kotlin'
startingLineNumber?: number
hideCopy?: boolean
showLineNumbers?: boolean
@@ -51,6 +52,7 @@ function CodeBlock(props: CodeBlockProps) {
SyntaxHighlighter.registerLanguage('py', py)
SyntaxHighlighter.registerLanguage('sql', sql)
SyntaxHighlighter.registerLanguage('bash', bash)
SyntaxHighlighter.registerLanguage('kotlin', kotlin)
// const large = props.size === 'large' ? true : false
const large = false
+1 -1
View File
@@ -68107,7 +68107,7 @@
"@types/react": "^17.0.37",
"@types/react-copy-to-clipboard": "^5.0.4",
"@types/react-dom": "^17.0.11",
"@types/react-syntax-highlighter": "*",
"@types/react-syntax-highlighter": "^15.5.6",
"autoprefixer": "^10.4.2",
"clsx": "^1.2.1",
"cmdk-supabase": "^0.2.2",
+14 -2
View File
@@ -133,11 +133,23 @@ export const CLIENT_LIBRARIES = [
libraries: [
{
name: 'postgrest-kt',
url: 'https://github.com/supabase-community/postgrest-kt',
url: 'https://github.com/supabase-community/supabase-kt/Postgrest',
},
{
name: 'gotrue-kt',
url: 'https://github.com/supabase-community/gotrue-kt',
url: 'https://github.com/supabase-community/supabase-kt/GoTrue',
},
{
name: 'storage-kt',
url: 'https://github.com/supabase-community/supabase-kt/Storage',
},
{
name: 'realtime-kt',
url: 'https://github.com/supabase-community/supabase-kt/Realtime',
},
{
name: 'functions-kt',
url: 'https://github.com/supabase-community/supabase-kt/Functions',
},
],
},
+4 -2
View File
@@ -34,7 +34,8 @@
"reference_dart_v1",
"reference_python_v2",
"reference_csharp_v0",
"reference_swift_v0"
"reference_swift_v0",
"reference_kotlin_v0"
]
},
{
@@ -47,7 +48,8 @@
"reference_dart_v1",
"reference_python_v2",
"reference_csharp_v0",
"reference_swift_v0"
"reference_swift_v0",
"reference_kotlin_v0"
]
},
{
File diff suppressed because it is too large. Load diff