Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nodejs #215

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Functions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ kotlin {
enabled = false
}
}

nodejs {
testTask {
enabled = false
}
}
}
ios()
iosSimulatorArm64()
Expand Down
6 changes: 5 additions & 1 deletion GoTrue/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ kotlin {
enabled = false
}
}

nodejs {
testTask {
enabled = false
}
}
}
ios()
iosSimulatorArm64()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.github.jan.supabase.gotrue

import io.github.jan.supabase.annotations.SupabaseInternal
import io.github.jan.supabase.gotrue.user.UserSession
import io.ktor.util.PlatformUtils.IS_BROWSER
import kotlinx.browser.window
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -46,11 +47,13 @@ actual fun GoTrue.setupPlatform() {
window.history.replaceState({}, window.document.title, newURL);
}

window.onhashchange = {
checkForHash()
}
window.onload = {
checkForHash()
checkForPCKECode()
if(IS_BROWSER) {
window.onhashchange = {
checkForHash()
}
window.onload = {
checkForHash()
checkForPCKECode()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.github.jan.supabase.gotrue

import com.russhwolf.settings.Settings
import io.github.jan.supabase.annotations.SupabaseInternal
import io.ktor.util.PlatformUtils.IS_NODE


@SupabaseInternal
Expand All @@ -12,7 +13,6 @@ fun createDefaultSettings() = try {
}

@SupabaseInternal
actual fun GoTrue.createDefaultSessionManager(): SessionManager = SettingsSessionManager()

actual fun GoTrue.createDefaultSessionManager(): SessionManager = if(!IS_NODE) SettingsSessionManager() else MemorySessionManager()
@SupabaseInternal
actual fun GoTrue.createDefaultCodeVerifierCache(): CodeVerifierCache = SettingsCodeVerifierCache()
actual fun GoTrue.createDefaultCodeVerifierCache(): CodeVerifierCache = if(!IS_NODE) SettingsCodeVerifierCache() else MemoryCodeVerifierCache()
6 changes: 5 additions & 1 deletion Postgrest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ kotlin {
enabled = false
}
}

nodejs {
testTask {
enabled = false
}
}
}
ios()
iosSimulatorArm64()
Expand Down
6 changes: 5 additions & 1 deletion Realtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ kotlin {
enabled = false
}
}

nodejs {
testTask {
enabled = false
}
}
}
ios()
iosSimulatorArm64()
Expand Down
6 changes: 5 additions & 1 deletion Storage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ kotlin {
enabled = false
}
}

nodejs {
testTask {
enabled = false
}
}
}
ios()
iosSimulatorArm64()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.russhwolf.settings.ExperimentalSettingsApi
import com.russhwolf.settings.Settings
import com.russhwolf.settings.coroutines.toSuspendSettings
import io.github.jan.supabase.annotations.SupabaseInternal
import io.ktor.util.PlatformUtils.IS_NODE
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json

Expand Down Expand Up @@ -51,4 +52,4 @@ class SettingsResumableCache(settings: Settings = Settings()) : ResumableCache {
}

@SupabaseInternal
actual fun createDefaultResumableCache(): ResumableCache = SettingsResumableCache()
actual fun createDefaultResumableCache(): ResumableCache = if(!IS_NODE) SettingsResumableCache() else MemoryResumableCache()
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ kotlin {
enabled = false
}
}

nodejs {
testTask {
enabled = false
}
}
}
ios()
iosSimulatorArm64()
Expand Down
6 changes: 5 additions & 1 deletion plugins/ApolloGraphQL/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ kotlin {
enabled = false
}
}

nodejs {
testTask {
enabled = false
}
}
}
ios()
iosSimulatorArm64()
Expand Down
Loading