diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c2c096..e002446e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 1.0.0-BETA32 * Added `onChange` method to the PowerSync client. This allows for observing table changes. +* Removed unnecessary `User-Id` header from internal PowerSync service requests. ## 1.0.0-BETA31 diff --git a/README.md b/README.md index d10e1d23..10f95790 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,6 @@ Current limitations: - Integration with SQLDelight schema and API generation (ORM) is not yet supported. -Future work/ideas: -- Attachments helper package. - ## Installation Add the PowerSync Kotlin Multiplatform SDK to your project by adding the following to your `build.gradle.kts` file: diff --git a/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt b/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt index 388b70e6..022df0c2 100644 --- a/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt +++ b/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt @@ -164,11 +164,9 @@ public class SupabaseConnector( check(session.user != null) { "No user data" } - // userId is for debugging purposes only PowerSyncCredentials( endpoint = powerSyncEndpoint, token = session.accessToken, // Use the access token to authenticate against PowerSync - userId = session.user!!.id, ) } diff --git a/core/src/commonIntegrationTest/kotlin/com/powersync/testutils/TestUtils.kt b/core/src/commonIntegrationTest/kotlin/com/powersync/testutils/TestUtils.kt index 9dc16317..7560d8cb 100644 --- a/core/src/commonIntegrationTest/kotlin/com/powersync/testutils/TestUtils.kt +++ b/core/src/commonIntegrationTest/kotlin/com/powersync/testutils/TestUtils.kt @@ -100,7 +100,6 @@ internal class ActiveDatabaseTest( everySuspend { getCredentialsCached() } returns PowerSyncCredentials( token = "test-token", - userId = "test-user", endpoint = "https://test.com", ) diff --git a/core/src/commonMain/kotlin/com/powersync/connectors/PowerSyncCredentials.kt b/core/src/commonMain/kotlin/com/powersync/connectors/PowerSyncCredentials.kt index e3c99d75..7ba63410 100644 --- a/core/src/commonMain/kotlin/com/powersync/connectors/PowerSyncCredentials.kt +++ b/core/src/commonMain/kotlin/com/powersync/connectors/PowerSyncCredentials.kt @@ -19,7 +19,12 @@ public data class PowerSyncCredentials( /** * User ID. */ - @SerialName("user_id") val userId: String?, + @Deprecated( + message = "This property is no longer used and should be removed.", + level = DeprecationLevel.WARNING, + ) + @SerialName("user_id") + val userId: String? = null, ) { override fun toString(): String = "PowerSyncCredentials" diff --git a/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt b/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt index 1f6e00d6..56859443 100644 --- a/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt +++ b/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt @@ -174,7 +174,6 @@ internal class SyncStream( contentType(ContentType.Application.Json) headers { append(HttpHeaders.Authorization, "Token ${credentials.token}") - append("User-Id", credentials.userId ?: "") } } if (response.status.value == 401) { @@ -202,7 +201,6 @@ internal class SyncStream( contentType(ContentType.Application.Json) headers { append(HttpHeaders.Authorization, "Token ${credentials.token}") - append("User-Id", credentials.userId ?: "") } timeout { socketTimeoutMillis = Long.MAX_VALUE } setBody(bodyJson) diff --git a/core/src/commonTest/kotlin/com/powersync/TestConnector.kt b/core/src/commonTest/kotlin/com/powersync/TestConnector.kt index 1319e637..1c59b889 100644 --- a/core/src/commonTest/kotlin/com/powersync/TestConnector.kt +++ b/core/src/commonTest/kotlin/com/powersync/TestConnector.kt @@ -7,7 +7,6 @@ class TestConnector : PowerSyncBackendConnector() { var fetchCredentialsCallback: suspend () -> PowerSyncCredentials? = { PowerSyncCredentials( token = "test-token", - userId = "test-user", endpoint = "https://test.com", ) } diff --git a/core/src/commonTest/kotlin/com/powersync/sync/SyncStreamTest.kt b/core/src/commonTest/kotlin/com/powersync/sync/SyncStreamTest.kt index d335b4b4..b9011a46 100644 --- a/core/src/commonTest/kotlin/com/powersync/sync/SyncStreamTest.kt +++ b/core/src/commonTest/kotlin/com/powersync/sync/SyncStreamTest.kt @@ -86,7 +86,6 @@ class SyncStreamTest { everySuspend { getCredentialsCached() } returns PowerSyncCredentials( token = "test-token", - userId = "test-user", endpoint = "https://test.com", ) }