mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -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
|
||||||
graphql-kotlin-server = { module = "com.expediagroup:graphql-kotlin-server", version.ref = "graphqlkotlin" }
|
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-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 ORM
|
||||||
exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
|
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
|
# Substitute for duktape-android
|
||||||
polyglot-core = { module = "org.graalvm.polyglot:polyglot", version.ref = "polyglot" }
|
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
|
||||||
settings-core = { module = "com.russhwolf:multiplatform-settings-jvm", version.ref = "settings" }
|
settings-core = { module = "com.russhwolf:multiplatform-settings-jvm", version.ref = "settings" }
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ dependencies {
|
|||||||
// GraphQL
|
// GraphQL
|
||||||
implementation(libs.graphql.kotlin.server)
|
implementation(libs.graphql.kotlin.server)
|
||||||
implementation(libs.graphql.kotlin.scheme)
|
implementation(libs.graphql.kotlin.scheme)
|
||||||
implementation(libs.graphql.scalars)
|
implementation(libs.graphql.java.core)
|
||||||
|
implementation(libs.graphql.java.scalars)
|
||||||
|
|
||||||
// Exposed ORM
|
// Exposed ORM
|
||||||
implementation(libs.bundles.exposed)
|
implementation(libs.bundles.exposed)
|
||||||
|
|||||||
@@ -21,16 +21,14 @@ import kotlinx.coroutines.GlobalScope
|
|||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import suwayomi.tachidesk.graphql.server.subscriptions.ApolloSubscriptionProtocolHandler
|
import suwayomi.tachidesk.graphql.server.subscriptions.ApolloSubscriptionProtocolHandler
|
||||||
import suwayomi.tachidesk.graphql.server.subscriptions.GraphQLSubscriptionHandler
|
|
||||||
|
|
||||||
class TachideskGraphQLServer(
|
class TachideskGraphQLServer(
|
||||||
requestParser: JavalinGraphQLRequestParser,
|
requestParser: JavalinGraphQLRequestParser,
|
||||||
contextFactory: TachideskGraphQLContextFactory,
|
contextFactory: TachideskGraphQLContextFactory,
|
||||||
requestHandler: GraphQLRequestHandler,
|
requestHandler: GraphQLRequestHandler,
|
||||||
subscriptionHandler: GraphQLSubscriptionHandler,
|
|
||||||
) : GraphQLServer<Context>(requestParser, contextFactory, requestHandler) {
|
) : GraphQLServer<Context>(requestParser, contextFactory, requestHandler) {
|
||||||
private val objectMapper = jacksonObjectMapper()
|
private val objectMapper = jacksonObjectMapper()
|
||||||
private val subscriptionProtocolHandler = ApolloSubscriptionProtocolHandler(contextFactory, subscriptionHandler, objectMapper)
|
private val subscriptionProtocolHandler = ApolloSubscriptionProtocolHandler(contextFactory, requestHandler, objectMapper)
|
||||||
|
|
||||||
@OptIn(DelicateCoroutinesApi::class)
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
fun handleSubscriptionMessage(context: WsMessageContext) {
|
fun handleSubscriptionMessage(context: WsMessageContext) {
|
||||||
@@ -59,9 +57,8 @@ class TachideskGraphQLServer(
|
|||||||
val requestParser = JavalinGraphQLRequestParser()
|
val requestParser = JavalinGraphQLRequestParser()
|
||||||
val contextFactory = TachideskGraphQLContextFactory()
|
val contextFactory = TachideskGraphQLContextFactory()
|
||||||
val requestHandler = GraphQLRequestHandler(graphQL, TachideskDataLoaderRegistryFactory.create())
|
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
|
package suwayomi.tachidesk.graphql.server.subscriptions
|
||||||
|
|
||||||
|
import com.expediagroup.graphql.server.execution.GraphQLRequestHandler
|
||||||
import com.expediagroup.graphql.server.types.GraphQLRequest
|
import com.expediagroup.graphql.server.types.GraphQLRequest
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.fasterxml.jackson.module.kotlin.convertValue
|
import com.fasterxml.jackson.module.kotlin.convertValue
|
||||||
@@ -43,7 +44,7 @@ import suwayomi.tachidesk.graphql.server.toGraphQLContext
|
|||||||
*/
|
*/
|
||||||
class ApolloSubscriptionProtocolHandler(
|
class ApolloSubscriptionProtocolHandler(
|
||||||
private val contextFactory: TachideskGraphQLContextFactory,
|
private val contextFactory: TachideskGraphQLContextFactory,
|
||||||
private val subscriptionHandler: GraphQLSubscriptionHandler,
|
private val subscriptionHandler: GraphQLRequestHandler,
|
||||||
private val objectMapper: ObjectMapper,
|
private val objectMapper: ObjectMapper,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user