mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 09:24:34 -05:00
Manually update GraphQL-Java to fix subscription data loaders (#1186)
This commit is contained in:
@@ -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" }
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Context>(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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user