Package com.trib3.graphql.resources

Types

Link copied to clipboard
@Path(value = "/graphql")
@Produces(value = ["application/json"])
open class GraphQLResource @Inject constructor(graphQL: GraphQL, graphQLConfig: GraphQLConfig, creatorFactory: GraphQLContextWebSocketCreatorFactory, @Nullable dataLoaderRegistryFactory: DataLoaderRegistryFactory?, appConfig: TribeApplicationConfig)

Jersey Resource entry point to GraphQL execution. Configures the graphql schemas at injection time and then executes a GraphQLRequest specified query when requested.

Link copied to clipboard
@Path(value = "/graphql/stream")
@Produces(value = ["application/json"])
open class GraphQLSseResource @Inject constructor(graphQL: GraphQL, graphQLConfig: GraphQLConfig, objectMapper: ObjectMapper, @Nullable dataLoaderRegistryFactory: DataLoaderRegistryFactory?)

Implements the graphql-sse protocol from https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md Both "Single connection mode" and "Distinct connections mode" are supported at the /app/graphql/stream endpoint.

Link copied to clipboard
internal data class StreamInfo(scope: CoroutineScope, principal: Principal?, eventSink: SseEventSink, sse: Sse)

Connection level metadata for active streams to facilitate asynchronous processing

Functions

Link copied to clipboard
fun getGraphQLContextMap(scope: CoroutineScope, principal: Principal? = null): Map<*, Any>

Helper method to construct a GraphQLContext's underlying Map from a CoroutineScope and optional Principal.

Link copied to clipboard
inline fun <T> GraphQLContext.getInstance(): T?

Extension method to get GraphQLContext element as a singleton instance for a given T class. Internally used for getting a GraphQL request's Principal and CoroutineScope, and any GraphQL executor set NewCookie.

Link copied to clipboard
inline fun <T> GraphQLContext.setInstance(obj: T)

Extension method to set obj as a singleton instance of its T class. A GraphQL executor setting a NewCookie on the GraphQLContext during a GraphQL operation's execution will result in that cookie being sent to the client (note this only works via a POST request, not via an operation being executed over a websocket).

Link copied to clipboard
internal fun unauthorizedResponse(): Response

Returns a response telling the browser that basic authorization is required

Properties

Link copied to clipboard
private val log: KLogger
Link copied to clipboard
private val log: KLogger
Link copied to clipboard
private const val STREAM_TOKEN_HEADER: String
Link copied to clipboard
private const val STREAM_TOKEN_QUERY_PARAM: String