Starting with 3.0.0, supabase-kt now uses Ktor 3. This brings WASM support, but projects using Ktor 2 will be incompatible.
Ktor 3.0.0-rc-1 or later has to be used.
- The
gotrue-ktmodule is no longer being published starting with version3.0.0. Use the newauth-ktmodule. - Rename
auth-ktpackage name fromio.github.jan.supabase.gotruetoio.github.jan.supabase.auth. - Refactor SessionStatus
- Move
SessionStatusto its ownstatuspackage - Rename
SessionStatus#LoadingFromStoragetoSessionStatus#Initializing - Rename and refactor
SessionStatus#NetworkErrortoSessionStatus#RefreshFailure(cause)Note: The cause can be eitherRefreshFailureCause#NetworkErrororRefreshFailureCause#InternalServerError. In both cases the refreshing will be retried and the session not cleared from storage. During that time, the session is obviously not usable.
- Move
- New coil3-integration
- New wasm-js support for almost all plugins
- Each uploading method (upload, update, uploadAsFlow ...) now has a
optionsDSL. Currently you can configure three things:
- Whether to upsert or not
- The content type (will still be inferred like in 2.X if null)
- Additional HTTP request configurations Example:
supabase.storage.from("test").upload("test.txt", "Hello World!".encodeToByteArray()) {
contentType = ContentType.Text.Plain
upsert = true
}- Each downloading method (downloadPublic, downloadAuthenticated, downloadPublicAsFlow, ...) now has a
optionsDSL. Currently you can only configure the image transformation Example:
supabase.storage.from("test").downloadAuthenticated("test.jpg") {
transform {
size(100, 100)
}
}- Uploading options such as
upsertorcontentTypefor resumable uploads are now getting cached. If an upload is resumed, the options from the initial upload will be used.
- Move all optional function parameters for
PostgrestQueryBuilder#select(),insert(),upsert()andPostgrest#rpc()to the request DSL Example:
supabase.from("table").upsert(myValue) {
defaultToNull = false
ignoreDuplicates = false
}- Move the non-parameter variant of
Postgrest#rpc()to thePostgrestinterface. It was an extension function before - Add a non-generic parameter variant of
Postgrest#rpc()to thePostgrestinterface. This function will be called from the existing generic variant
RealtimeChannel#presenceChangeFlowis now a member function ofRealtimeChannel. (It was an extension function before)
The Apollo GraphQL plugin now uses Apollo GraphQL 4.0.0.
Migrating from version 1.4.X to 2.0.0
The GoTrue module had a lot of changes including many renames:
- Rename
GoTrueplugin toAuth - Rename
GoTrueConfigtoAuthConfig - Rename
SupabaseClient#gotruetoSupabaseClient#auth - Rename
Auth#loginWithtoAuth#signInWith - Rename
Auth#logouttoAuth#signOut - Rename
LogoutScopetoSignOutScope - Rename
AdminUserUpdateBuilder#phoneNumbertoAdminUserUpdateBuilder#phone - Rename
UserUpdateBuilder#phoneNumbertoUserUpdateBuilder#phone - Rename
Phone.Config#phoneNumbertoPhone.Config#phone - Rename
Auth#sendRecoveryEmailtoAuth#resetPasswordForEmail
Old:
supabase.gotrue.sendOtpTo(Email) {
email = "example@email.com"
}
//or
supabase.gotrue.sendOtpTo(Phone) {
phoneNumber = "+123456789"
}New:
supabase.auth.signInWith(OTP) {
email = "example@email.com"
//or
phone = "+123456789"
}Old:
supabase.gotrue.loginWith(SSO.withProvider("provider"))
//or
supabase.gotrue.loginWith(SSO.withDomain("domain"))New:
supabase.auth.signInWith(SSO) {
providerId = "providerId"
//or
domain = "domain"
}The Realtime module also had a few renames:
- Rename
Realtime#createChanneltoRealtime#channel - Remove
RealtimeChannel#joinand add newRealtimeChannel#subscribemethod, which does the same but also connects to the realtime websocket automatically - Add
Realtime.Config#connectOnSubscribeto disable this behaviour - Rename
RealtimeChannel#leavetoRealtimeChannel#unsubscribe - Add
SupabaseClient#channelextension function delegating toRealtime#channel - Rename
Realtime.Statusto reflect the new methods:UNSUBSCRIBEDSUBSCRIBINGSUBSCRIBEDUNSUBSCRIBING
The syntax for interacting with the PostgREST API has been refactored significantly. Each database method (SELECT, UPDATE, etc.)
now have a new builder and most of the properties which were a method parameter are now in this builder.
The filters now get applied within a filter {} block.
Select
Old:
supabase.postgrest.from("countries").select(count = Count.EXACT) {
eq("id", 1)
}New:
supabase.postgrest.from("countries").select {
count(Count.EXACT)
filter {
eq("id", 1)
}
}Insert
Old:
supabase.postgrest.from("countries").update(country, returning = Returning.REPRESENTATION) { //Returning is representation by default
eq("id", 1)
}New:
supabase.postgrest.from("countries").update(country) {
select() //Without this the "returning" parameter is `MINIMAL`, meaning you will not receive the data.
filter {
eq("id", 1)
}
}The same applies for all other database methods. Additionally, new methods have been added to this builder:
Example:
val result = supabase.postgrest["messages"].select {
single() //receive an object rather than an array
count(Count.EXACT) //receive amount of database entries
limit(10) //limit amount of results
range(2, 3) //change range of results
select() //return the data when updating/deleting/upserting (same as settings 'returning' to REPRESENTATION before)
csv() //Receive the data as csv
geojson() //Receive the data as geojson
explain(/* */) //Debug queries
filter {
eq("id", 1)
}
}Compose Auth also had some renames:
- Rename
ComposeAuth#rememberLoginWithGoogletoComposeAuth#rememberSignInWithGoogle - Rename
ComposeAuth#rememberLoginWithAppletoComposeAuth#rememberSignInWithApple - Rename
ComposeAuth#rememberSignOuttoComposeAuth#rememberSignOutWithGoogle
Additionally, Native Google Auth on Android will now use the Credential Manager for Android 14+ devices once again.