Skip to content

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

Fix spelling issue

Joshen Limca8dfe651202
diff --git a/spec/supabase_kt_v0.yml b/spec/supabase_kt_v0.yml
index be94e110658..e65e1813a48 100644
--- a/spec/supabase_kt_v0.yml
+++ b/spec/supabase_kt_v0.yml
@@ -19,9 +19,9 @@ functions:
title: 'Initializing'
description: |
Independently of which Supabase module you are using, you will need to initialize the main client first and install the module.
-
+
To create a new client, you can use the `createSupabaseClient` function.
-
+
When installing a module, you can pass a block to configure it.
examples:
@@ -55,43 +55,43 @@ functions:
```
description: |
**Common:**
-
+
`alwaysAutoRefresh` - whether the GoTrue plugin should always auto refresh expired sessions automatically. Default: `true`
-
+
`autoLoadFromStorage` - whether the GoTrue plugin should automatically load the session from the session manager. Default: `true`
-
+
`flowType` - Which authentication flow to use. Currently available: FlowType.PKCE and FlowType.IMPLICIT. Default: `FlowType.IMPLICIT`
-
+
`codeVerifierCache` - Interface for saving and loading codes for the PKCE authentication flow. Default: `SettingsCodeVerifierCache`
-
+
`customUrl` - Custom url for the GoTrue API. Can be safely ignored when using Supabase. Default: `null`
-
+
`jwtToken` - Plugin specific JWT Token. Can be ignored when using the GoTrue plugin. Default: `null`
-
+
`retryDelay` - Duration after which the GoTrue plugin should retry a failed session refresh. Default: `10.seconds`
-
+
`sessionManager` - Interface for saving and loading the user session. Default: `SettingsSessionManager`
-
+
**Android & IOS:**
-
+
`scheme` - The scheme for the redirect url, when using deep linking. Default: `supabase`
-
+
`host` - The host for the redirect url, when using deep linking. Default: `login`
-
+
**Android:**
-
+
`enableLifecycleCallbacks` - Whether to stop auto-refresh on focus loss, and resume it on focus again. Default: `true`
-
+
**Desktop:**
-
+
`httpPort`: The port the web server is running on, when logging in with OAuth. Default: `0` (random port).
-
+
`timeout`: The timeout for the web server, when logging in with OAuth. Default: `1.minutes`.
-
+
`htmlTitle`: The title of the redirect page, when logging in with OAuth. Default: `"Supabase Auth"`.
-
+
`htmlText`: The text of the redirect page, when logging in with OAuth. Default: `"Logged in. You may continue in your app."`.
-
+
`htmlIconUrl`: The icon of the redirect page, when logging in with OAuth. Default: `"https://supabase.com/brand-assets/supabase-logo-icon.png"`.
- id: configure-postgrest
name: Configure PostgREST module
@@ -109,11 +109,11 @@ functions:
```
description: |
`propertyConversionMethod` - The method to use to convert the property names to the column names when applying filters & using the update method. Default: `PropertyConversionMethod.CAMEL_CASE_TO_SNAKE_CASE`
-
+
`defaultSchema` - The default schema to use for database requests. Default: `public`
-
+
`customUrl` - Custom url for the PostgREST API. Can be safely ignored when using Supabase. Default: `null`
-
+
`jwtToken` - Plugin specific JWT Token. Can be ignored when using the GoTrue plugin. Default: `null`
- id: configure-storage
name: Configure Storage module
@@ -130,17 +130,17 @@ functions:
```
description: |
`transferTimeout` - the timeout for uploading and downloading files. Default: `120.seconds`
-
+
`resumable.cache` - Interface for storing resumable upload urls. Default: `ResumableCache.Disk`
-
+
`resumable.defaultChunkSize` - The default chunk size for resumable uploads. Supabase currently only supports a chunk size of 6MB, so be careful when changing this value. Default: `6MB`
-
+
`resumable.retryTimeout` - the timeout for retrying resumable uploads when uploading a chunk fails. Default: `5.seconds`
-
+
`resumable.onlyUpdateStateAfterChunk` - whether the upload state should only be updated after a chunk was uploaded successfully or also when the chunk is currently being uploaded. Default: `false`
-
+
`customUrl` - Custom url for the Storage API. Can be safely ignored when using Supabase. Default: `null`
-
+
`jwtToken` - Plugin specific JWT Token. Can be ignored when using the GoTrue plugin. Default: `null`
- id: configure-realtime
name: Configure Realtime module
@@ -157,17 +157,17 @@ functions:
```
description: |
`reconnectDelay` - The delay between reconnect attempts. Default: `7.seconds`
-
+
`heartbeatInterval` - The interval between heartbeat messages. Default: `15.seconds`
-
+
`disconnectOnSessionLoss` - Whether to disconnect from the websocket when the session is lost. Default: `true`
-
+
`secure` - Whether to use wss or ws. Defaults to [SupabaseClient.useHTTPS] when null
-
+
`websocketConfig` - Custom Ktor websocket config
-
+
`customUrl` - Custom url for the Realtime websocket. Can be safely ignored when using Supabase. Default: `null`
-
+
`jwtToken` - Plugin specific JWT Token. Can be ignored when using the GoTrue plugin. Default: `null`
- id: configure-functions
name: Configure Functions plugin
@@ -184,8 +184,8 @@ functions:
```
description: |
`customUrl` - Custom url for the Functions API. Can be safely ignored when using Supabase. Default: `null`
-
- `jwtToken` - Plugin specific JWT Token. Can be ignored when using the GoTrue plugin. Default: `null`
+
+ `jwtToken` - Plugin specific JWT Token. Can be ignored when using the GoTrue plugin. Default: `null`
- id: configure-graphql
name: Configure GraphQL plugin
code: |
@@ -203,11 +203,11 @@ functions:
```
description: |
`apolloConfiguration` - Custom configuration for the ApolloClient
-
+
`customUrl` - Custom url for the GraphQL API. Can be safely ignored when using Supabase. Default: `null`
-
+
`jwtToken` - Plugin specific JWT Token. Can be ignored when using the GoTrue plugin. Default: `null`
-
+
**You can access the created ApolloClient via `client.graphql.apolloClient`, which automatically adds the required headers depending on your session.**
- id: select
@@ -347,7 +347,7 @@ functions:
title: 'Modify data: update()'
notes: |
- `update()` should always be combined with a [filter](/docs/reference/kotlin/using-filters) block to avoid updating all records.
- - When calling `insert` or `update`, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
+ - When calling `insert` or `update`, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
examples:
- id: updating-your-data
name: Updating your data
@@ -435,7 +435,7 @@ functions:
- 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).
- - When calling `insert` or `update`, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
+ - When calling `insert` or `update`, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
examples:
- id: upsert-your-data
name: Upsert your data
@@ -505,8 +505,8 @@ functions:
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.
-
- - When calling `rpc` with parameters, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
+
+ - When calling `rpc` with parameters, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
examples:
- id: call-a-stored-procedure
name: Call a stored procedure
@@ -529,7 +529,7 @@ functions:
Filters allow you to only return rows that match certain conditions.
Filters can be used on `select()`, `update()`, and `delete()` queries.
-
+
You can use two different types for applying filters:
```kotlin
eq("country_id", 1)
@@ -538,10 +538,10 @@ functions:
```kotlin
City::countryId eq 1
```
-
+
As you can see on the property syntax:
the name of the `countryId` gets converted to `country_id`.
-
+
By default, this is done by converting camel case to snake case, but you can customize this by changing the `PropertyConversionMethod` in the Postgrest Config
If a database function returns a table response, you can also apply filters.
@@ -2074,7 +2074,7 @@ functions:
phoneNumber = "+4912345679"
password = "example-password"
}
- ```
+ ```
- id: sign-up-with-additional-user-metadata
name: Sign up with additional user metadata
isSpotlight: false
@@ -2126,7 +2126,7 @@ functions:
phoneNumber = "+4912345679"
password = "example-password"
}
- ```
+ ```
- id: sign-in-with-id-token
name: Sign in with id token
isSpotlight: false
@@ -2142,7 +2142,7 @@ functions:
//...
}
}
- ```
+ ```
- id: sign-in-with-otp
title: 'sendOtpTo()'
$ref: '@supabase/gotrue-js.GoTrueClient.signInWithOtp'
@@ -2172,7 +2172,7 @@ functions:
client.gotrue.sendOtpTo(Email) {
email = "[email protected]"
}
- ```
+ ```
- id: sign-in-with-sms-otp
name: Sign in with SMS OTP
isSpotlight: false
@@ -2278,7 +2278,7 @@ functions:
client.gotrue.loginWith(SSO.withProvider("21648a9d-8d5a-4555-a9d1-d6375dc14e92"))
//the url was opened automatically, if you don't want that, provide a custom redirect url
- ```
+ ```
- id: sign-out
title: 'logout()'
$ref: '@supabase/gotrue-js.GoTrueClient.signOut'
@@ -2360,7 +2360,7 @@ functions:
code: |
```kotlin
val user = client.gotrue.retrieveUser("JWT")
- ```
+ ```
- id: update-user
title: 'modifyUser()'
$ref: '@supabase/gotrue-js.GoTrueClient.updateUser'
@@ -2420,7 +2420,7 @@ functions:
$ref: '@supabase/gotrue-js.GoTrueClient.refreshSession'
notes: |
This method will refresh the session whether the current one is expired or not.
-
+
- This is done automatically, but can be disabled in the GoTrue config.
examples:
- id: refresh-current-session
@@ -2516,14 +2516,14 @@ functions:
code: |
```kotlin
val verifiedFactors = client.gotrue.mfa.verifiedFactors
- ```
+ ```
- id: retrieve-verified-factors
name: Retrieve verified factors
isSpotlight: true
code: |
```kotlin
val verifiedFactors = client.gotrue.mfa.retrieveFactorsForCurrentUser()
- ```
+ ```
- id: mfa-challenge
title: 'mfa.challenge()'
$ref: '@supabase/gotrue-js.GoTrueMFAApi.challenge'
@@ -2604,16 +2604,16 @@ functions:
code: |
```kotlin
val (current, next) = client.gotrue.mfa.getAuthenticatorAssuranceLevel()
- ```
+ ```
- id: aal-enabled
- name: Check whether the user has atleast one verified factor
+ name: Check whether the user has at least one verified factor
isSpotlight: true
code: |
```kotlin
val enabled = client.gotrue.mfa.isMfaEnabled
//flow variant, automatically emitting new values on session changes
val enabledFlow = client.gotrue.mfa.isMfaEnabledFlow
- ```
+ ```
- id: aal-enabled-for-current-session
name: Check whether the user is logged in using AAL2
isSpotlight: true
@@ -2622,7 +2622,7 @@ functions:
val loggedInUsingMfa = client.gotrue.mfa.loggedInUsingMfa
//flow variant, automatically emitting new values on session changes
val loggedInUsingMfaFlow = client.gotrue.mfa.loggedInUsingMfaFlow
- ```
+ ```
- id: admin-api
title: 'Overview'
notes: |
@@ -2721,7 +2721,7 @@ functions:
put("name", "John")
}
}
- ```
+ ```
- id: auto-confirm-the-users-email
name: Auto-confirm the user's email
code: |
@@ -2928,12 +2928,12 @@ functions:
code: |
```kotlin
client.gotrue.admin.deleteFactor(uid = "id", factorId = "factor_id")
- ```
+ ```
- id: invoke
title: 'invoke()'
description: |
Invokes a Supabase Function. See the [guide](/docs/guides/functions) for details on writing Functions.
- - When invoking a function with parameters, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
+ - When invoking a function with parameters, you have to provide a [serializable value](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) in the function parameter.
notes: |
- Requires an Authorization header.
examples:
@@ -2958,7 +2958,7 @@ functions:
append(HttpHeaders.ContentType, "application/json")
}
)
- ```
+ ```
- id: reuse-function
name: Reuse function by saving it to a variable
isSpotlight: true
@@ -2980,7 +2980,7 @@ functions:
function(body) {
set("Header", "Value")
}
- ```
+ ```
- id: subscribe
description: |
Subscribe to realtime changes in your database.
@@ -2991,7 +2991,7 @@ functions:
- When using a method with a generic type like `track`, `broadcast` or `broadcastFlow`, you have to provide a [serializable class](/docs/reference/kotlin/installing#add-kotlinx-serialization-required-for-postgrest-and-realtime-serialization) as the type parameter.
examples:
- id: connect-to-realtime-client
- name: Connect to Realtime
+ name: Connect to Realtime
isSpotlight: true
code: |
```kotlin
@@ -3003,45 +3003,45 @@ functions:
```kotlin
@Serializable
data class Message(val content: String, val sender: String)
-
+
val channel = client.realtime.createChannel("channelId") {
//optional config
}
-
+
val broadcastFlow = channel.broadcastFlow<Message>(event = "message")
-
+
//in a new coroutine (or use Flow.onEach().launchIn(scope)):
broadcastFlow.collect { //it: Message
println(it)
}
-
+
channel.join(blockUntilJoined = true)
-
+
channel.broadcast(event = "message", Message("I joined!", "John"))
- ```
+ ```
- id: listen-to-presence-updates
name: Listen to presence updates
- code: |
+ code: |
```kotlin
@Serializable
data class PresenceState(val username: String)
-
+
val connectedUsers = mutableSetOf<PresenceState>()
val channel = client.realtime.createChannel("channelId") {
//optional config
}
-
+
val presenceChangeFlow = channel.presenceChangeFlow()
-
+
//in a new coroutine (or use Flow.onEach().launchIn(scope)):
presenceChangeFlow.collect {
connectedUsers += it.decodeJoinsAs<PresenceState>()
connectedUsers -= it.decodeLeavesAs<PresenceState>()
}
-
+
channel.join(blockUntilJoined = true)
//send own state
- channel.track(PresenceState(username = "John"))
+ channel.track(PresenceState(username = "John"))
- id: listen-to-all-database-changes
name: Listen to all database changes
code: |
@@ -3050,7 +3050,7 @@ functions:
//optional config
}
val changeFlow = channel.postgresChangeFlow<PostgresAction>(schema = "public")
-
+
//in a new coroutine (or use Flow.onEach().launchIn(scope)):
changeFlow.collect {
when(it) {
@@ -3060,7 +3060,7 @@ functions:
is PostgresAction.Update -> println("Updated: ${it.oldRecord} with ${it.record}")
}
}
-
+
channel.join()
```
- id: listen-to-a-specific-table
@@ -3073,7 +3073,7 @@ functions:
val changeFlow = channel.postgresChangeFlow<PostgresAction>(schema = "public") {
table = "users"
}
-
+
//in a new coroutine (or use Flow.onEach().launchIn(scope)):
changeFlow.collect {
when(it) {
@@ -3083,7 +3083,7 @@ functions:
is PostgresAction.Update -> println("Updated: ${it.oldRecord} with ${it.record}")
}
}
-
+
channel.join()
```
- id: listen-to-inserts
@@ -3096,12 +3096,12 @@ functions:
val changeFlow = channel.postgresChangeFlow<PostgresAction.Insert>(schema = "public") {
table = "users"
}
-
+
//in a new coroutine (or use Flow.onEach().launchIn(scope)):
changeFlow.collect {
println(it.record)
}
-
+
channel.join()
```
- id: listen-to-updates
@@ -3121,13 +3121,13 @@ functions:
val changeFlow = channel.postgresChangeFlow<PostgresAction.Update>(schema = "public") {
table = "users"
}
-
+
//in a new coroutine (or use Flow.onEach().launchIn(scope)):
changeFlow.collect {
println(it.record)
println(it.oldRecord)
}
-
+
channel.join()
```
- id: listen-to-deletes
@@ -3147,12 +3147,12 @@ functions:
val changeFlow = channel.postgresChangeFlow<PostgresAction.Delete>(schema = "public") {
table = "users"
}
-
+
//in a new coroutine (or use Flow.onEach().launchIn(scope)):
changeFlow.collect {
println(it.oldRecord)
}
-
+
channel.join()
```
- id: listening-to-row-level-changes
@@ -3167,12 +3167,12 @@ functions:
table = "users"
filter = "id.eq.1"
}
-
+
//in a new coroutine:
changeFlow.collect {
println(it.oldRecord)
}
-
+
channel.join()
```
@@ -3325,7 +3325,7 @@ functions:
is UploadStatus.Success -> println("Success")
}
}
- ```
+ ```
- id: create-resumable-upload
name: Create resumable upload
isSpotlight: true
@@ -3342,10 +3342,10 @@ functions:
size = dataSize,
path = "icon.png"
)
- ```
+ ```
- id: start-resumable-upload
name: Start and resumable upload
- isSpotlight: true
+ isSpotlight: true
code: |
```kotlin
upload.startOrResumeUploading()
@@ -3361,7 +3361,7 @@ functions:
code: |
```kotlin
upload.cancel()
- ```
+ ```
description: |
This will also remove the upload url from the cache
- id: listen-to-upload-state
@@ -3373,21 +3373,21 @@ functions:
println("Paused: ${it.paused}")
println("Is done: ${it.isDone}")
}
- ```
+ ```
- id: continue-previous-upload
name: Continue previous uploads
isSpotlight: true
code: |
```kotlin
val bucket = client.storage["avatars"]
-
+
//only on JVM/Android:
bucket.resumable.continuePreviousFileUploads()
.map { it.await() } //await all uploads. This just makes sure the uploads have an update-to-date url. You can also do this in parallel
.forEach { upload ->
upload.startOrResumeUploading()
}
-
+
//on other platforms you may have to continue uploads from the source (Probably better to write an extension function):
bucket.resumable.continuePreviousUploads { source, offset ->
//create ByteReadChannel from source and seek to offset
@@ -3396,7 +3396,7 @@ functions:
.forEach { upload ->
upload.startOrResumeUploading()
}
- ```
+ ```
- id: from-update
title: from.update()
@@ -3492,7 +3492,7 @@ functions:
val bytes = bucket.downloadPublic("test.png")
//or on JVM:
bucket.downloadPublicTo("test.png", File("test.png"))
- ```
+ ```
- id: download-with-transformation
name: Download file with transformation
code: |
@@ -3509,9 +3509,9 @@ functions:
fill()
quality = 100
}
- ```
+ ```
- id: download-with-progress
- name: Download file with progress
+ name: Download file with progress
code: |
```kotlin
val bucket = client.storage["avatars"]
@@ -3530,7 +3530,7 @@ functions:
else -> {} //The ByteData status will never occur as we are writing directly to a file
}
}
- ```
+ ```
- id: from-remove
title: from.remove()
$ref: '@supabase/storage-js.packages/StorageFileApi.default.remove'