diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b93e7a6..a97931b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog -## 1.8.2 (unreleased) +## 1.9.0 (unreleased) +- Sync options: `newClientImplementation` is now the default. - Make `androidx.sqlite:sqlite-bundled` an API dependency of `:core` to avoid toolchain warnings. ## 1.8.1 diff --git a/common/src/androidMain/kotlin/com/powersync/ConnectionFactory.android.kt b/common/src/androidMain/kotlin/com/powersync/ConnectionFactory.android.kt index 2c35a546..1039bc32 100644 --- a/common/src/androidMain/kotlin/com/powersync/ConnectionFactory.android.kt +++ b/common/src/androidMain/kotlin/com/powersync/ConnectionFactory.android.kt @@ -1,5 +1,4 @@ package com.powersync -@ExperimentalPowerSyncAPI @Throws(PowerSyncException::class) public actual fun resolvePowerSyncLoadableExtensionPath(): String? = "libpowersync.so" diff --git a/common/src/appleNonWatchOsMain/kotlin/com/powersync/DatabaseDriverFactory.appleNonWatchOs.kt b/common/src/appleNonWatchOsMain/kotlin/com/powersync/DatabaseDriverFactory.appleNonWatchOs.kt index 53cc0039..1dbed111 100644 --- a/common/src/appleNonWatchOsMain/kotlin/com/powersync/DatabaseDriverFactory.appleNonWatchOs.kt +++ b/common/src/appleNonWatchOsMain/kotlin/com/powersync/DatabaseDriverFactory.appleNonWatchOs.kt @@ -1,5 +1,4 @@ package com.powersync -@ExperimentalPowerSyncAPI @Throws(PowerSyncException::class) public actual fun resolvePowerSyncLoadableExtensionPath(): String? = powerSyncExtensionPath diff --git a/common/src/commonMain/kotlin/com/powersync/ConnectionFactory.kt b/common/src/commonMain/kotlin/com/powersync/ConnectionFactory.kt index 1a8119dc..5fd2fa1d 100644 --- a/common/src/commonMain/kotlin/com/powersync/ConnectionFactory.kt +++ b/common/src/commonMain/kotlin/com/powersync/ConnectionFactory.kt @@ -59,7 +59,6 @@ public open class DriverBasedInMemoryFactory( * configuring external database connections not managed by PowerSync to work with the PowerSync * SDK. */ -@ExperimentalPowerSyncAPI @Throws(PowerSyncException::class) public expect fun resolvePowerSyncLoadableExtensionPath(): String? diff --git a/common/src/commonMain/kotlin/com/powersync/PowerSyncDatabase.kt b/common/src/commonMain/kotlin/com/powersync/PowerSyncDatabase.kt index dc01ec67..42271ebe 100644 --- a/common/src/commonMain/kotlin/com/powersync/PowerSyncDatabase.kt +++ b/common/src/commonMain/kotlin/com/powersync/PowerSyncDatabase.kt @@ -105,7 +105,7 @@ public interface PowerSyncDatabase : Queries { crudThrottleMs: Long = 1000L, retryDelayMs: Long = 5000L, params: Map = emptyMap(), - options: SyncOptions = SyncOptions.defaults, + options: SyncOptions = SyncOptions(), ) /** @@ -246,7 +246,6 @@ public interface PowerSyncDatabase : Queries { * identifier, and uses internal locks to ensure these two databases are not synced at the * same time (which would be inefficient and can cause consistency issues). */ - @ExperimentalPowerSyncAPI public fun opened( pool: SQLiteConnectionPool, scope: CoroutineScope, @@ -264,7 +263,6 @@ public interface PowerSyncDatabase : Queries { * * This can be useful for writing tests relying on PowerSync databases. */ - @ExperimentalPowerSyncAPI public fun openInMemory( factory: InMemoryConnectionFactory, schema: Schema, @@ -285,7 +283,6 @@ public interface PowerSyncDatabase : Queries { ) } - @ExperimentalPowerSyncAPI internal fun openedWithGroup( pool: SQLiteConnectionPool, scope: CoroutineScope, diff --git a/common/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt b/common/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt index 1141c127..bf23a5af 100644 --- a/common/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt +++ b/common/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt @@ -326,7 +326,6 @@ internal class PowerSyncDatabaseImpl( return powerSyncVersion } - @ExperimentalPowerSyncAPI override suspend fun useConnection( readOnly: Boolean, block: suspend (SQLiteConnectionLease) -> T, diff --git a/common/src/commonMain/kotlin/com/powersync/db/Queries.kt b/common/src/commonMain/kotlin/com/powersync/db/Queries.kt index 90e955f5..3534fb77 100644 --- a/common/src/commonMain/kotlin/com/powersync/db/Queries.kt +++ b/common/src/commonMain/kotlin/com/powersync/db/Queries.kt @@ -196,8 +196,7 @@ public interface Queries { * connection with a `BEGIN` statement or forgetting to close it, can disrupt the rest of the * PowerSync SDK. For this reason, this method should only be used if absolutely necessary. */ - @ExperimentalPowerSyncAPI() - @HiddenFromObjC() + @HiddenFromObjC public suspend fun useConnection( readOnly: Boolean = false, block: suspend (SQLiteConnectionLease) -> T, diff --git a/common/src/commonMain/kotlin/com/powersync/db/driver/SQLiteConnectionPool.kt b/common/src/commonMain/kotlin/com/powersync/db/driver/SQLiteConnectionPool.kt index ceff6577..e5066224 100644 --- a/common/src/commonMain/kotlin/com/powersync/db/driver/SQLiteConnectionPool.kt +++ b/common/src/commonMain/kotlin/com/powersync/db/driver/SQLiteConnectionPool.kt @@ -13,7 +13,6 @@ import kotlinx.coroutines.runBlocking * built on. The SDK provides its own pool, but can also use existing implementations (via * [com.powersync.PowerSyncDatabase.opened]). */ -@ExperimentalPowerSyncAPI() public interface SQLiteConnectionPool { /** * Calls the callback with a read-only connection temporarily leased from the pool. @@ -49,7 +48,6 @@ public interface SQLiteConnectionPool { public suspend fun close() } -@ExperimentalPowerSyncAPI public interface SQLiteConnectionLease { /** * Queries the autocommit state on the connection. diff --git a/common/src/commonMain/kotlin/com/powersync/sync/SyncOptions.kt b/common/src/commonMain/kotlin/com/powersync/sync/SyncOptions.kt index 30902d3d..3cad9022 100644 --- a/common/src/commonMain/kotlin/com/powersync/sync/SyncOptions.kt +++ b/common/src/commonMain/kotlin/com/powersync/sync/SyncOptions.kt @@ -11,7 +11,6 @@ import kotlin.native.HiddenFromObjC * Configuration options for the [PowerSyncDatabase.connect] method, allowing customization of * the HTTP client used to connect to the PowerSync service. */ -@OptIn(ExperimentalObjCRefinement::class) public sealed class SyncClientConfiguration { /** * Extends the default Ktor [HttpClient] configuration with the provided block. @@ -29,48 +28,42 @@ public sealed class SyncClientConfiguration { * this method when instantiating the client. The PowerSync SDK does not modify the provided client. */ @HiddenFromObjC - @ExperimentalPowerSyncAPI public class ExistingClient( public val client: HttpClient, ) : SyncClientConfiguration() } /** - * Experimental options that can be passed to [PowerSyncDatabase.connect] to specify an experimental - * connection mechanism. - * - * The new connection implementation is more efficient and we expect it to become the default in - * the future. At the moment, the implementation is not covered by the stability guarantees we offer - * for the rest of the SDK though. + * Options for [PowerSyncDatabase.connect] to customize the connection mechanism. */ -public class SyncOptions - @ExperimentalPowerSyncAPI - constructor( - @property:ExperimentalPowerSyncAPI - public val newClientImplementation: Boolean = false, - /** - * The user agent to use for requests made to the PowerSync service. - */ - public val userAgent: String = userAgent(), - @property:ExperimentalPowerSyncAPI - /** - * Allows configuring the [HttpClient] used for connecting to the PowerSync service. - */ - public val clientConfiguration: SyncClientConfiguration? = null, +public class SyncOptions( + /** + * Enables the new client implementation written in Rust. + * + * The new implementation is more efficient and enabled by default. It can be disabled if compatibility issues occur. + * The old implementation will be removed in a future version of the PowerSync SDK. + * Please report any issues experienced with the new implementation. + */ + public val newClientImplementation: Boolean = true, + /** + * The user agent to use for requests made to the PowerSync service. + */ + public val userAgent: String = userAgent(), + /** + * Allows configuring the [HttpClient] used for connecting to the PowerSync service. + */ + public val clientConfiguration: SyncClientConfiguration? = null, + /** + * Whether streams that have been defined with `auto_subscribe: true` should be synced even + * when they don't have an explicit subscription. + */ + public val includeDefaultStreams: Boolean = true, +) { + public companion object { /** - * Whether streams that have been defined with `auto_subscribe: true` should be synced even - * when they don't have an explicit subscription. + * The default sync options, which are safe and stable to use. */ - public val includeDefaultStreams: Boolean = true, - ) { - public companion object { - /** - * The default sync options, which are safe and stable to use. - * - * Constructing non-standard sync options requires an opt-in to experimental PowerSync - * APIs, and those might change in the future. - */ - @OptIn(ExperimentalPowerSyncAPI::class) - public val defaults: SyncOptions = SyncOptions() - } + @Deprecated("Customizing sync options is no longer necessary, use constructor instead", replaceWith = ReplaceWith("SyncOptions()")) + public val defaults: SyncOptions = SyncOptions() } +} diff --git a/common/src/jvmMain/kotlin/com/powersync/ConnectionFactory.jvm.kt b/common/src/jvmMain/kotlin/com/powersync/ConnectionFactory.jvm.kt index 2ecb6741..e6f91923 100644 --- a/common/src/jvmMain/kotlin/com/powersync/ConnectionFactory.jvm.kt +++ b/common/src/jvmMain/kotlin/com/powersync/ConnectionFactory.jvm.kt @@ -2,7 +2,6 @@ package com.powersync import com.powersync.db.runWrapped -@ExperimentalPowerSyncAPI @Throws(PowerSyncException::class) public actual fun resolvePowerSyncLoadableExtensionPath(): String? = runWrapped { powersyncExtension } diff --git a/common/src/watchosMain/kotlin/com/powersync/ConnectionFactory.watchos.kt b/common/src/watchosMain/kotlin/com/powersync/ConnectionFactory.watchos.kt index 5758700f..de64b198 100644 --- a/common/src/watchosMain/kotlin/com/powersync/ConnectionFactory.watchos.kt +++ b/common/src/watchosMain/kotlin/com/powersync/ConnectionFactory.watchos.kt @@ -17,7 +17,6 @@ private val didLoadExtension by lazy { true } -@ExperimentalPowerSyncAPI @Throws(PowerSyncException::class) public actual fun resolvePowerSyncLoadableExtensionPath(): String? { didLoadExtension