supabase-kt

A Kotlin Multiplatform Client for Supabase.

MIT License

Stars
389
Committers
22

Bot releases are hidden (Show)

supabase-kt - 1.0.0-alpha-1

Published by jan-tennert over 1 year ago

Changes

  • Add new demo showcasing how to implement Google Native/OneTap sign in on android & use an in-app web browser for oauth
  • Add experimental support for SSO Logins (untested, feedback appreciated)
    SSO Logins
    client.gotrue.loginWith(SSO.withProvider("providerId"))
    client.gotrue.loginWith(SSO.withDomain("domain"))
    
    Works same as oauth, deeplinking used for mobile and http callback server on desktop
  • Add GoTrue#retrieveSSOUrl(type)
  • Add experimental support for the PKCE login flow. Changing to it is as simple as:
    //change the login flow to PKCE in the GoTrue configuration
    val client = createSupabaseClient(url, key) {
        install(GoTrue) {
            flowType = FlowType.PKCE 
        }
    }
    
    Note: You can customize the way the code verifiers get saved in the GoTrue config
  • Add GoTrue#exchangeCodeForSession(code)
  • Expose GoTrue#parseFragmentAndImportSession(fragment), so you don't have to parse all this by yourself when using a custom OAuth implementation
  • Add GoTrue#oAuthUrl(provider), to easily get the oauth url when using a custom implementation
  • Add scopes & queryParams properties to OAuth configuration:
    client.gotrue.loginWith(Google) {
       scopes.add("email")
       queryParams["key"] = "value"
    } 
    
  • Add missing properties to UserSession: providerToken & providerRefreshToken

(tag is pointing to the wrong branch, the right one would be development)

supabase-kt - 0.9.5

Published by jan-tennert over 1 year ago

Changes

  • Fix RealtimeChannel#track not sending the payload correctly
supabase-kt - 0.9.4

Published by jan-tennert over 1 year ago

Changes

  • Improve storage download & upload by @jan-tennert in https://github.com/supabase-community/supabase-kt/pull/120
    There are new upload & download method variants to provide a ByteReadChannel/ByteWriteChannel instead of a ByteArray
    This allows you to stream data rather than loading everything into memory. The JVM and Android extension functions use this approach by default.
  • Fix realtime channel status not changing to JOINED when not listening for postgres changes
  • Add more logging to IOS deeplinking
  • (Forgot to add this in a previous changelog) When calling Storage#get or Storage#from, the StorageApi instances are now cached
supabase-kt - 0.9.3

Published by jan-tennert over 1 year ago

Changes

  • Update cache4k to the newest version, which fixes the duplicate class bug (fixes #119)
  • Improve GoTrue error messages

Dependency updates

  • Bump com.apollographql.apollo3:apollo-runtime from 3.8.0 to 3.8.1
  • Bump io.github.reactivecircus.cache4k:cache4k from 0.10.0 to 0.11.0
supabase-kt - 0.9.2

Published by jan-tennert over 1 year ago

Changes

0.9.2 introduces new experimental methods I originally planned for 0.9.0, but they took a little bit longer:

  • Use the supabaseKey as fallback for api endpoints if no session is available (allows you to interact with the api as anon)
  • Introduce new resumable upload api for storage by @jan-tennert in https://github.com/supabase-community/supabase-kt/pull/97 (see wiki)
  • Add new storage android methods: BucketApi#upload(path, uri), BucketApi#uploadAsFlow(path, uri), BucketApi#update(path, uri), BucketApi#updateAsFlow(path, uri), BucketApi#uploadToSignedUrl(path, uri), BucketApi#uploadToSignedUrl(path, uri) (make sure your app has access to them)
  • Add new demo showcasing the resumable uploads

Dependency updates

  • Bump ktor from 2.2.4 to 2.3.0
  • Bump io.github.reactivecircus.cache4k:cache4k from 0.9.0 to 0.10.0
supabase-kt - 0.9.1

Published by jan-tennert over 1 year ago

Changes

  • Make PostgrestResult#body nullable (shouldn't affect anyone using the normal decoding methods) (fixes #106)
supabase-kt - 0.9.0

Published by jan-tennert over 1 year ago

Changes

  • Add experimental support for IOS (#53)

  • Add new Troubleshooting page in the Wiki

  • Fix functions-kt using gotrue as it's namespace

  • Use actual error message from Storage HTTP request by @jollygreenegiant in https://github.com/supabase-community/supabase-kt/pull/92

  • Add new 'upsert' parameter to upload/update functions by @jan-tennert in https://github.com/supabase-community/supabase-kt/pull/93

  • Introduce experimental flow variants for uploading and downloading files in storage by @jan-tennert in https://github.com/supabase-community/supabase-kt/pull/90

  • Add new methods to ImageTransformation: cover, fill, contain, size

  • Add new Storage LW7 features: (untested, see PR)
    More options when creating a bucket (& move public to builder): (Breaking if using public)

    client.storage.createBucket("test", "test")  {
       public = true
       fileSizeLimit = 1000000.kilobytes
       allowedMimeTypes(ContentType.Image.PNG, ContentType.Image.JPEG)
    }
    

    Create presigned urls for upload images:

    val signedUrl = client.storage["test"].createUploadSignedUrl("test.txt")
    println(signedUrl.url)
    client.storage["test"].uploadToSignedUrl(
        path = "test.txt",
        token = signedUrl.token,
        data = File("mydata.txt").readBytes()
    )
    

    New image transformation options:

    client.storage["icons"].downloadPublic("icon.png") {
        width = 100
        height = 100
        format = "origin" //image format
        resize = ImageTransformation.Resize.FILL
        quality = 40 //image quality
    }
    
  • Improve select syntax for postgrest (#87)
    You can now restrict the columns you want to receive using the Columns value class:

    //user class
    @Serializable
    data class User(val id: String, val name: String)
    
    client.postgrest["table"].select(Columns.list(columns)).decodeSingle<User>()
    //or
    client.postgrest["table"].select(Columns.list("id", "name")).decodeSingle<User>()
    //or
    client.postgrest["table"].select(Columns.type<User>()).decodeSingle<User>() //uses the class properties serial names as column restriction
    //defaults to Columns.ALL
    client.postgrest["table"].select().decodeSingle<User>()
    
  • Improve exceptions

  • Make Identity#lastSignInAt optional

  • Fix various documentation issues

Dependency updates

Various dependency updates, see pre-releases for full list

supabase-kt - 0.9.0-rc-1

Published by jan-tennert over 1 year ago

Changes

  • Fix functions-kt using gotrue as it's namespace

Dependency updates

  • Update android lifecycle to 2.6.1
  • Update kotlin to 1.8.20
  • Update AGP to 8.0.0
  • Update atomicfu 0.20.2
supabase-kt - 0.9.0-beta-4

Published by jan-tennert over 1 year ago

Changes

New Contributors

supabase-kt - 0.9.0-beta-3

Published by jan-tennert over 1 year ago

Changes

  • Introduce experimental flow variants for uploading and downloading files in storage by @jan-tennert in https://github.com/supabase-community/supabase-kt/pull/90
  • Allow using ContentType for BucketBuilder#allowedMimeTypes instead of String
  • Add new methods to ImageTransformation: cover, fill, contain, size
  • Fix StorageApi#uploadToSignedUrl implementation
  • Fix various documentation issues
supabase-kt - 0.9.0-beta-2

Published by jan-tennert over 1 year ago

Changes

  • Add 'None' PropertyConversionMethod

  • Throw an error when SERIAL_NAME PropertyConversionMethod is used on IOS/JS

  • Add new Storage LW7 features: (untested, see PR)
    More options when creating a bucket (& move public to builder): (Breaking if using public)

    client.storage.createBucket("test", "test")  {
       public = true
       fileSizeLimit = 1000000.kilobytes
       allowedMimeTypes("image/png", "image/jpeg")
    }
    

    Create presigned urls for upload images:

    val signedUrl = client.storage["test"].createUploadSignedUrl("test.txt")
    println(signedUrl.url)
    client.storage["test"].uploadToSignedUrl(
        path = "test.txt",
        token = signedUrl.token,
        data = File("mydata.txt").readBytes()
    )
    

    New image transformation options:

    client.storage["icons"].downloadPublic("icon.png") {
        width = 100
        height = 100
        format = "origin" //image format
        resize = ImageTransformation.Resize.FILL
        quality = 40 //image quality
    }
    
  • Add new Troubleshooting page in the Wiki

supabase-kt - 0.9.0-beta-1

Published by jan-tennert over 1 year ago

Changes

  • Add experimental support for IOS (#53)
  • Improve select syntax for postgrest (#87)
    You can now restrict the columns you want to receive using the Columns value class:
    //user class
    @Serializable
    data class User(val id: String, val name: String)
    
    client.postgrest["table"].select(Columns.list(columns)).decodeSingle<User>()
    //or
    client.postgrest["table"].select(Columns.list("id", "name")).decodeSingle<User>()
    //or
    client.postgrest["table"].select(Columns.type<User>()).decodeSingle<User>() //uses the class properties serial names as column restriction
    //defaults to Columns.ALL
    client.postgrest["table"].select().decodeSingle<User>()
    
  • Improve exceptions
  • Make Identity#lastSignInAt optional

Depdendency updates

  • Update Kotlin to 1.8.20
  • Update apollo-kotlin to 3.8.0
  • Update atomicfu to 0.20.1
  • Update androidx lifecycle to 2.6.1
supabase-kt - 0.8.5

Published by jan-tennert over 1 year ago

Changes

  • Fix GoTrue#retrieveUserForCurrentSession and GoTrue#refreshCurrentSession

Dependency updates

  • Update apollo runtime to 3.7.5
supabase-kt - 0.9.0-alpha-3

Published by jan-tennert over 1 year ago

Changes

  • Fix GoTrue#retrieveUserForCurrentSession and GoTrue#refreshCurrentSession
  • Improve error when GoTrue can't create a default Settings instance.

Dependency updates

  • Update apollo runtime to 3.7.5
supabase-kt - 0.9.0-alpha-2

Published by jan-tennert over 1 year ago

Changes

  • Add new json function property to PostgrestBuilder#insert and PostgrestBuilder#update (to customize Json encoding)

  • Add new PostgrestBuilder#update overload to use an DTO instead of the DSL:

    client.postgrest["test"].update(SomeData(2)) {
        eq("id", 2)
    }
    
  • Add new overloads to PostgrestFilterBuilder: sl (rangeLt), sr (rangeGt), nxr (rangeLte), nxl (rangeGte)

  • Add new methods to PostgrestFilterBuilder: cs/contains, cd/contained, ov/overlaps

  • Change value type of PostgrestFilterBuilder methods sl, sr, nxl, nxr to LongRange instead of String

  • Add new config property propertyConversionMethod to Postgrest:

    You can now specify which method postgrest-kt should use to convert a property to a column name:

    If you have this data class:

    @Serializable
    data class Test(
        @SerialName("some_property") val someProperty: String
    )
    

    And want to use this syntax:

    client.postgrest["table"].select {
       Test::someProperty eq "test"
    }
    

    you can now specify how someProperty gets converted to a column name in the Postgrest config:

    val client = createSupabaseClient(url, key) {
       install(Postgrest) {
           propertyConversionMethod = PropertyConversionMethod.SERIAL_NAME //only works for JVM/Android
           //or 
           propertyConverisonMethod = PropertyConversionMethod.CAMEL_CASE_TO_SNAKE_CASE //works for all platforms
           //or write your own (defaults to CAMEL_CASE_TO_SNAKE_CASE 
       }
    }
    

    depending on the method the resulting column name will either be the @SerialName value or the property name just gets converted to snake case.
    Note: same works for the update DSL

  • Make values in PostgrestUpdate nullable

  • Add Postgrest Tests

  • Remove deprecated methods in Storage

  • Remove experimental annotations

supabase-kt - 0.9.0-alpha-1

Published by jan-tennert over 1 year ago

Changes

New Contributors

supabase-kt - 0.8.4

Published by jan-tennert over 1 year ago

Changes

  • Add experimental DSL for and & or sql statements by @jan-tennert in https://github.com/supabase-community/supabase-kt/pull/64
  • Add new experimental methods:
    • PostgrestResult#count()
    • PostgrestResult#range()
  • Deprecate methods:
    • Storage#getAllBuckets() - use retrieveBuckets() instead
    • Storage#getBucket() - use retrieveBucketById() instead

Dependency updates

  • Update dokka to 1.8.10
  • Update ktor to 2.2.4
supabase-kt - 0.8.4-ios

Published by jan-tennert over 1 year ago

Changes

  • Add support for apollo-graphql plugin
supabase-kt - 0.8.3

Published by jan-tennert over 1 year ago

Changes

Full Changelog: https://github.com/supabase-community/supabase-kt/compare/0.8.2...0.8.3

supabase-kt - 0.8.2

Published by jan-tennert over 1 year ago

Changes

  • Fix stack overflow exception when adding the GraphQL plugin (#60)