diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 11190618..db9c4936 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -55,7 +55,8 @@ jackson-annotations = { module = "com.fasterxml.jackson.core:jackson-annotations # GraphQL graphql-kotlin-server = { module = "com.expediagroup:graphql-kotlin-server", version.ref = "graphqlkotlin" } graphql-kotlin-scheme = { module = "com.expediagroup:graphql-kotlin-schema-generator", version.ref = "graphqlkotlin" } -graphql-scalars = "com.graphql-java:graphql-java-extended-scalars:20.2" +graphql-java-core = "com.graphql-java:graphql-java:22.3" # Major version locked by graphql-kotlin +graphql-java-scalars = "com.graphql-java:graphql-java-extended-scalars:22.0" # Exposed ORM exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" } @@ -117,7 +118,7 @@ android-annotations = "androidx.annotation:annotation:1.9.1" # Substitute for duktape-android polyglot-core = { module = "org.graalvm.polyglot:polyglot", version.ref = "polyglot" } -polyglot-graaljs = { module = "org.graalvm.polyglot:js-community", version.ref = "polyglot" } # provides the same interface as 'javax.script' a.k.a Nashorn +polyglot-graaljs = { module = "org.graalvm.polyglot:js-community", version.ref = "polyglot" } # Settings settings-core = { module = "com.russhwolf:multiplatform-settings-jvm", version.ref = "settings" } diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 9b84c0d0..be86deef 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -43,7 +43,8 @@ dependencies { // GraphQL implementation(libs.graphql.kotlin.server) implementation(libs.graphql.kotlin.scheme) - implementation(libs.graphql.scalars) + implementation(libs.graphql.java.core) + implementation(libs.graphql.java.scalars) // Exposed ORM implementation(libs.bundles.exposed) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/TachideskGraphQLServer.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/TachideskGraphQLServer.kt index 2d2d5d96..6fd65c12 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/TachideskGraphQLServer.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/TachideskGraphQLServer.kt @@ -21,16 +21,14 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map import suwayomi.tachidesk.graphql.server.subscriptions.ApolloSubscriptionProtocolHandler -import suwayomi.tachidesk.graphql.server.subscriptions.GraphQLSubscriptionHandler class TachideskGraphQLServer( requestParser: JavalinGraphQLRequestParser, contextFactory: TachideskGraphQLContextFactory, requestHandler: GraphQLRequestHandler, - subscriptionHandler: GraphQLSubscriptionHandler, ) : GraphQLServer(requestParser, contextFactory, requestHandler) { private val objectMapper = jacksonObjectMapper() - private val subscriptionProtocolHandler = ApolloSubscriptionProtocolHandler(contextFactory, subscriptionHandler, objectMapper) + private val subscriptionProtocolHandler = ApolloSubscriptionProtocolHandler(contextFactory, requestHandler, objectMapper) @OptIn(DelicateCoroutinesApi::class) fun handleSubscriptionMessage(context: WsMessageContext) { @@ -59,9 +57,8 @@ class TachideskGraphQLServer( val requestParser = JavalinGraphQLRequestParser() val contextFactory = TachideskGraphQLContextFactory() val requestHandler = GraphQLRequestHandler(graphQL, TachideskDataLoaderRegistryFactory.create()) - val subscriptionHandler = GraphQLSubscriptionHandler(graphQL, TachideskDataLoaderRegistryFactory.create()) - return TachideskGraphQLServer(requestParser, contextFactory, requestHandler, subscriptionHandler) + return TachideskGraphQLServer(requestParser, contextFactory, requestHandler) } } } diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt index 8610fa3d..accda722 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt @@ -7,6 +7,7 @@ package suwayomi.tachidesk.graphql.server.subscriptions +import com.expediagroup.graphql.server.execution.GraphQLRequestHandler import com.expediagroup.graphql.server.types.GraphQLRequest import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.convertValue @@ -43,7 +44,7 @@ import suwayomi.tachidesk.graphql.server.toGraphQLContext */ class ApolloSubscriptionProtocolHandler( private val contextFactory: TachideskGraphQLContextFactory, - private val subscriptionHandler: GraphQLSubscriptionHandler, + private val subscriptionHandler: GraphQLRequestHandler, private val objectMapper: ObjectMapper, ) { companion object {