diff --git a/build.sbt b/build.sbt index 8ce7e73e3..11a2ee63b 100644 --- a/build.sbt +++ b/build.sbt @@ -29,7 +29,7 @@ val zioInteropCats2Version = "22.0.0.0" val zioInteropCats3Version = "23.1.0.1" val zioInteropReactiveVersion = "2.0.2" val zioConfigVersion = "3.0.7" -val zqueryVersion = "0.6.0" +val zqueryVersion = "0.6.1" val zioJsonVersion = "0.6.2" val zioHttpVersion = "3.0.0-RC4" val zioOpenTelemetryVersion = "3.0.0-RC21" diff --git a/core/src/main/scala/caliban/execution/Executor.scala b/core/src/main/scala/caliban/execution/Executor.scala index 51c8b2952..18aa3b0fc 100644 --- a/core/src/main/scala/caliban/execution/Executor.scala +++ b/core/src/main/scala/caliban/execution/Executor.scala @@ -245,7 +245,7 @@ object Executor { ) } else { reduceStep( - QueryStep(ZQuery.fromZIO(stream.runCollect.map(chunk => ListStep(chunk.toList)))), + QueryStep(ZQuery.fromZIONow(stream.runCollect.map(chunk => ListStep(chunk.toList)))), currentField, arguments, path @@ -382,7 +382,7 @@ object Executor { ): URQuery[R, ResponseValue] = { def handleError(error: ExecutionError): UQuery[ResponseValue] = - ZQuery.fromZIO(errors.update(error :: _).as(NullValue)) + ZQuery.fromZIONow(errors.update(error :: _).as(NullValue)) def wrap(query: ExecutionQuery[ResponseValue], isPure: Boolean, fieldInfo: FieldInfo) = { @tailrec @@ -494,7 +494,7 @@ object Executor { val deferredSteps = nextSteps.map { case (step, label) => Deferred(path, step, label) } - ZQuery.fromZIO(deferred.update(deferredSteps ::: _)) *> loop(obj) + ZQuery.fromZIONow(deferred.update(deferredSteps ::: _)) *> loop(obj) } loop(step, isTopLevelField = true).catchAll(handleError) diff --git a/core/src/main/scala/caliban/schema/Schema.scala b/core/src/main/scala/caliban/schema/Schema.scala index 85f760f32..b7c00fc86 100644 --- a/core/src/main/scala/caliban/schema/Schema.scala +++ b/core/src/main/scala/caliban/schema/Schema.scala @@ -497,7 +497,7 @@ trait GenericSchema[R] extends SchemaDerivation[R] with TemporalSchema { new Schema[R0, URIO[R1, A]] { override def optional: Boolean = ev.optional override def toType(isInput: Boolean, isSubscription: Boolean): __Type = ev.toType_(isInput, isSubscription) - override def resolve(value: URIO[R1, A]): Step[R0] = QueryStep(ZQuery.fromZIO(value.map(ev.resolve))) + override def resolve(value: URIO[R1, A]): Step[R0] = QueryStep(ZQuery.fromZIONow(value.map(ev.resolve))) } implicit def effectSchema[R0, R1 >: R0, R2 >: R0, E <: Throwable, A](implicit ev: Schema[R2, A] @@ -505,7 +505,7 @@ trait GenericSchema[R] extends SchemaDerivation[R] with TemporalSchema { new Schema[R0, ZIO[R1, E, A]] { override def optional: Boolean = true override def toType(isInput: Boolean, isSubscription: Boolean): __Type = ev.toType_(isInput, isSubscription) - override def resolve(value: ZIO[R1, E, A]): Step[R0] = QueryStep(ZQuery.fromZIO(value.map(ev.resolve))) + override def resolve(value: ZIO[R1, E, A]): Step[R0] = QueryStep(ZQuery.fromZIONow(value.map(ev.resolve))) } def customErrorEffectSchema[R0, R1 >: R0, R2 >: R0, E, A](convertError: E => ExecutionError)(implicit ev: Schema[R2, A] @@ -514,7 +514,7 @@ trait GenericSchema[R] extends SchemaDerivation[R] with TemporalSchema { override def optional: Boolean = true override def toType(isInput: Boolean, isSubscription: Boolean): __Type = ev.toType_(isInput, isSubscription) override def resolve(value: ZIO[R1, E, A]): Step[R0] = QueryStep( - ZQuery.fromZIO(value.mapBoth(convertError, ev.resolve)) + ZQuery.fromZIONow(value.mapBoth(convertError, ev.resolve)) ) } implicit def infallibleQuerySchema[R0, R1 >: R0, R2 >: R0, A](implicit diff --git a/tracing/src/main/scala/caliban/tracing/FieldTracer.scala b/tracing/src/main/scala/caliban/tracing/FieldTracer.scala index 0eb75b598..605a4927e 100644 --- a/tracing/src/main/scala/caliban/tracing/FieldTracer.scala +++ b/tracing/src/main/scala/caliban/tracing/FieldTracer.scala @@ -16,13 +16,15 @@ object FieldTracer { ): ZQuery[R, CalibanError.ExecutionError, ResponseValue] = ZQuery.acquireReleaseWith( ZIO.serviceWithZIO[Tracing](_.spanUnsafe(info.name)) - ) { case (span, end) => end } { case (span, _) => + ) { case (_, end) => end } { case (span, _) => query.foldCauseQuery( - cause => { - val status = - cause.failureOption.flatMap(StatusMapper.default.failure.lift).fold(StatusCode.ERROR)(_.statusCode) - ZQuery.fromZIO(ZIO.succeed(span.setStatus(status, cause.prettyPrint))) *> ZQuery.failCause(cause) - }, + cause => + ZQuery.failCause { + val status = + cause.failureOption.flatMap(StatusMapper.default.failure.lift).fold(StatusCode.ERROR)(_.statusCode) + span.setStatus(status, cause.prettyPrint) + cause + }, value => ZQuery.succeed(value) ) }