Skip to content

Commit

Permalink
Merge main and resolve merging errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou committed Apr 27, 2024
2 parents 56fa54f + ac0a8f4 commit 6531319
Show file tree
Hide file tree
Showing 162 changed files with 2,845 additions and 1,765 deletions.
28 changes: 14 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.13.12 check ++3.3.1 check
- run: sbt ++2.13.13 check ++3.3.3 check
- save_cache:
key: sbtcache
paths:
Expand All @@ -23,7 +23,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.12.18 rootJVM212/test
- run: sbt ++2.12.19 rootJVM212/test
- save_cache:
key: sbtcache
paths:
Expand All @@ -38,7 +38,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.12.18 codegenSbt/scripted
- run: sbt ++2.12.19 codegenSbt/scripted
- save_cache:
key: sbtcache
paths:
Expand All @@ -53,7 +53,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt 'set ThisBuild / scalaVersion := "2.12.18"; codegenScriptedScala3'
- run: sbt 'set ThisBuild / scalaVersion := "2.12.19"; codegenScriptedScala3'
- save_cache:
key: sbtcache
paths:
Expand All @@ -68,7 +68,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.13.12 rootJVM213/test examples/compile benchmarks/compile
- run: sbt ++2.13.13 rootJVM213/test examples/compile benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand All @@ -83,7 +83,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.13.12 rootJVM213/test examples/compile benchmarks/compile
- run: sbt ++2.13.13 rootJVM213/test examples/compile benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand All @@ -98,7 +98,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++3.3.1 rootJVM3/test benchmarks/compile
- run: sbt ++3.3.3 rootJVM3/test benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand All @@ -113,7 +113,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++3.3.1 rootJVM3/test benchmarks/compile
- run: sbt ++3.3.3 rootJVM3/test benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand All @@ -129,7 +129,7 @@ jobs:
- restore_cache:
key: sbtcache
- run: ./.circleci/install-native-deps.sh
- run: sbt ++2.13.12 clientJS/test clientLaminextJS/Test/fastLinkJS clientNative/Test/nativeLink
- run: sbt ++2.13.13 clientJS/test clientLaminextJS/Test/fastLinkJS clientNative/Test/nativeLink
- save_cache:
key: sbtcache
paths:
Expand All @@ -145,7 +145,7 @@ jobs:
- restore_cache:
key: sbtcache
- run: ./.circleci/install-native-deps.sh
- run: sbt ++3.3.1 clientJS/test clientLaminextJS/Test/fastLinkJS clientNative/Test/nativeLink
- run: sbt ++3.3.3 clientJS/test clientLaminextJS/Test/fastLinkJS clientNative/Test/nativeLink
- save_cache:
key: sbtcache
paths:
Expand All @@ -161,8 +161,8 @@ jobs:
- restore_cache:
key: sbtcache
- run: |
sbt ++2.13.12 docs/mdoc
sbt "++2.13.12 doc"
sbt ++2.13.13 docs/mdoc
sbt "++2.13.13 doc"
- save_cache:
key: sbtcache
paths:
Expand All @@ -177,8 +177,8 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.13.12 http4s/mimaReportBinaryIssues akkaHttp/mimaReportBinaryIssues pekkoHttp/mimaReportBinaryIssues catsInterop/mimaReportBinaryIssues monixInterop/mimaReportBinaryIssues clientJVM/mimaReportBinaryIssues clientJS/mimaReportBinaryIssues clientLaminextJS/mimaReportBinaryIssues federation/mimaReportBinaryIssues reporting/mimaReportBinaryIssues tracing/mimaReportBinaryIssues core/mimaReportBinaryIssues tapirInterop/mimaReportBinaryIssues quickAdapter/mimaReportBinaryIssues zioHttp/mimaReportBinaryIssues play/mimaReportBinaryIssues # tools/mimaReportBinaryIssues
- run: sbt ++3.3.1 catsInterop/mimaReportBinaryIssues monixInterop/mimaReportBinaryIssues clientJVM/mimaReportBinaryIssues clientJS/mimaReportBinaryIssues clientLaminextJS/mimaReportBinaryIssues http4s/mimaReportBinaryIssues federation/mimaReportBinaryIssues reporting/mimaReportBinaryIssues tracing/mimaReportBinaryIssues core/mimaReportBinaryIssues tapirInterop/mimaReportBinaryIssues pekkoHttp/mimaReportBinaryIssues quickAdapter/mimaReportBinaryIssues zioHttp/mimaReportBinaryIssues play/mimaReportBinaryIssues # tools/mimaReportBinaryIssues
- run: sbt ++2.13.13 http4s/mimaReportBinaryIssues akkaHttp/mimaReportBinaryIssues pekkoHttp/mimaReportBinaryIssues catsInterop/mimaReportBinaryIssues monixInterop/mimaReportBinaryIssues clientJVM/mimaReportBinaryIssues clientJS/mimaReportBinaryIssues clientLaminextJS/mimaReportBinaryIssues federation/mimaReportBinaryIssues reporting/mimaReportBinaryIssues tracing/mimaReportBinaryIssues core/mimaReportBinaryIssues tapirInterop/mimaReportBinaryIssues quickAdapter/mimaReportBinaryIssues zioHttp/mimaReportBinaryIssues play/mimaReportBinaryIssues # tools/mimaReportBinaryIssues
- run: sbt ++3.3.3 catsInterop/mimaReportBinaryIssues monixInterop/mimaReportBinaryIssues clientJVM/mimaReportBinaryIssues clientJS/mimaReportBinaryIssues clientLaminextJS/mimaReportBinaryIssues http4s/mimaReportBinaryIssues federation/mimaReportBinaryIssues reporting/mimaReportBinaryIssues tracing/mimaReportBinaryIssues core/mimaReportBinaryIssues tapirInterop/mimaReportBinaryIssues pekkoHttp/mimaReportBinaryIssues quickAdapter/mimaReportBinaryIssues zioHttp/mimaReportBinaryIssues play/mimaReportBinaryIssues # tools/mimaReportBinaryIssues
- save_cache:
key: sbtcache
paths:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ Want to see your company here? [Submit a PR](https://github.com/ghostdogpr/calib
* [Soundtrack Your Brand](https://www.soundtrackyourbrand.com)
* [StepZen](https://www.stepzen.com)
* [Undo](https://www.undo.app)
* [Valamis Group](https://www.valamis.com)
6 changes: 5 additions & 1 deletion adapters/quick/src/main/scala/caliban/GraphiQLHandler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ object GraphiQLHandler {
* @see [[https://github.com/graphql/graphiql/tree/main/examples/graphiql-cdn]]
*/
def handler(apiPath: String, graphiqlPath: String): RequestHandler[Any, Nothing] =
Handler.fromBody(Body.fromString(html(apiPath, graphiqlPath)))
Response(
Status.Ok,
Headers(Header.ContentType(MediaType.text.html).untyped),
Body.fromString(html(apiPath, graphiqlPath))
).toHandler

def html(apiPath: String, uiPath: String): String =
s"""
Expand Down
24 changes: 17 additions & 7 deletions adapters/quick/src/main/scala/caliban/QuickAdapter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ final class QuickAdapter[-R] private (requestHandler: QuickRequestHandler[R]) {
*/
val handlers: QuickHandlers[R] = QuickHandlers(
api = Handler.fromFunctionZIO[Request](requestHandler.handleHttpRequest),
upload = Handler.fromFunctionZIO[Request](requestHandler.handleUploadRequest)
upload = Handler.fromFunctionZIO[Request](requestHandler.handleUploadRequest),
webSocket = Handler.fromFunctionZIO[Request](requestHandler.handleWebSocketRequest)
)

@deprecated("Use `handlers` instead", "2.5.0")
Expand All @@ -24,11 +25,13 @@ final class QuickAdapter[-R] private (requestHandler: QuickRequestHandler[R]) {
* @param apiPath The path where the GraphQL API will be served.
* @param graphiqlPath The path where the GraphiQL UI will be served. If None, GraphiQL will not be served.
* @param uploadPath The path where files can be uploaded. If None, uploads will be disabled.
* @param webSocketPath The path where websocket requests will be set. If None, websocket-based subscriptions will be disabled.
*/
def toApp(
apiPath: String,
graphiqlPath: Option[String] = None,
uploadPath: Option[String] = None
uploadPath: Option[String] = None,
webSocketPath: Option[String] = None
): HttpApp[R] = {
val apiRoutes = List(
RoutePattern(Method.POST, apiPath) -> handlers.api,
Expand All @@ -40,8 +43,10 @@ final class QuickAdapter[-R] private (requestHandler: QuickRequestHandler[R]) {
val uploadRoute = uploadPath.toList.map { uPath =>
RoutePattern(Method.POST, uPath) -> handlers.upload
}

Routes.fromIterable(apiRoutes ::: graphiqlRoute ::: uploadRoute).toHttpApp
val wsRoute = webSocketPath.toList.map { wsPath =>
RoutePattern(Method.ANY, wsPath) -> handlers.webSocket
}
Routes.fromIterable(apiRoutes ::: graphiqlRoute ::: uploadRoute ::: wsRoute).toHttpApp
}

/**
Expand All @@ -52,15 +57,17 @@ final class QuickAdapter[-R] private (requestHandler: QuickRequestHandler[R]) {
* @param apiPath The route to serve the API on, e.g., `/api/graphql`
* @param graphiqlPath Optionally define a route to serve the GraphiQL UI on, e.g., `/graphiql`
* @param uploadPath The route where files can be uploaded, e.g., /upload/graphql. If None, uploads will be disabled.
* @param webSocketPath The path where websocket requests will be set. If None, websocket-based subscriptions will be disabled.
*/
def runServer(
port: Int,
apiPath: String,
graphiqlPath: Option[String] = None,
uploadPath: Option[String] = None
uploadPath: Option[String] = None,
webSocketPath: Option[String] = None
)(implicit trace: Trace): RIO[R, Nothing] =
Server
.serve[R](toApp(apiPath, graphiqlPath = graphiqlPath, uploadPath = uploadPath))
.serve[R](toApp(apiPath, graphiqlPath = graphiqlPath, uploadPath = uploadPath, webSocketPath = webSocketPath))
.provideSomeLayer[R](Server.defaultWithPort(port))

def configure(config: ExecutionConfiguration)(implicit trace: Trace): QuickAdapter[R] =
Expand All @@ -69,13 +76,16 @@ final class QuickAdapter[-R] private (requestHandler: QuickRequestHandler[R]) {
def configure[R1](configurator: QuickAdapter.Configurator[R1])(implicit trace: Trace): QuickAdapter[R & R1] =
new QuickAdapter(requestHandler.configure[R1](configurator))

def configureWebSocket[R1](config: quick.WebSocketConfig[R1]): QuickAdapter[R & R1] =
new QuickAdapter(requestHandler.configureWebSocket(config))

}

object QuickAdapter {
type Configurator[-R] = URIO[R & Scope, Unit]

def apply[R](interpreter: GraphQLInterpreter[R, Any]): QuickAdapter[R] =
new QuickAdapter(new QuickRequestHandler(interpreter))
new QuickAdapter(new QuickRequestHandler(interpreter, quick.WebSocketConfig.default))

def handlers[R](implicit tag: Tag[R], trace: Trace): URIO[QuickAdapter[R], QuickHandlers[R]] =
ZIO.serviceWith(_.handlers)
Expand Down
6 changes: 4 additions & 2 deletions adapters/quick/src/main/scala/caliban/QuickHandlers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import zio.http.{ HandlerAspect, RequestHandler }

final case class QuickHandlers[-R](
api: RequestHandler[R, Nothing],
upload: RequestHandler[R, Nothing]
upload: RequestHandler[R, Nothing],
webSocket: RequestHandler[R, Nothing]
) {

/**
Expand All @@ -13,7 +14,8 @@ final case class QuickHandlers[-R](
def @@[R1 <: R](aspect: HandlerAspect[R1, Unit]): QuickHandlers[R1] =
QuickHandlers(
api = (api @@ aspect).merge,
upload = (upload @@ aspect).merge
upload = (upload @@ aspect).merge,
webSocket = (webSocket @@ aspect).merge
)

}
Loading

0 comments on commit 6531319

Please sign in to comment.