TRPCEffectRuntime
This commit is contained in:
@@ -5,14 +5,14 @@ import { MainLive, type MainR } from "./Main"
|
||||
import { TodoRepository } from "./TodoRepository"
|
||||
|
||||
|
||||
export class TRPCEffectRunner extends Context.Tag("TRPCEffectRunner")<TRPCEffectRunner,
|
||||
export class TRPCEffectRuntime extends Context.Tag("TRPCEffectRuntime")<TRPCEffectRuntime,
|
||||
<A, E>(
|
||||
self: Effect.Effect<A, E, MainR>,
|
||||
options?: Runtime.RunForkOptions,
|
||||
) => RuntimeFiber<A, E>
|
||||
>() {}
|
||||
|
||||
export const TRPCEffectRunnerLive = Layer.effect(TRPCEffectRunner,
|
||||
export const TRPCEffectRuntimeLive = Layer.effect(TRPCEffectRuntime,
|
||||
Effect.runtime<MainR>().pipe(
|
||||
Effect.map(Runtime.runFork)
|
||||
)
|
||||
@@ -35,7 +35,7 @@ export const t = initTRPC.create()
|
||||
// )
|
||||
|
||||
const testRouter = Effect.gen(function*() {
|
||||
const run = yield* TRPCEffectRunner
|
||||
const run = yield* TRPCEffectRuntime
|
||||
|
||||
return t.router({
|
||||
// test1: t.procedure.query(
|
||||
@@ -3,8 +3,8 @@ import { Todo } from "@todo-tests/common/data"
|
||||
import { Identifiable } from "@todo-tests/common/traits"
|
||||
import { Array, Duration, Effect, Fiber, Layer, Option, Stream } from "effect"
|
||||
import { MainLive } from "./Main"
|
||||
import { TRPCEffectRuntimeLive } from "./TRPCEffectRuntime"
|
||||
import { TodoRepository, createDefaultTodos } from "./TodoRepository"
|
||||
import { TRPCEffectRunnerLive } from "./trpc"
|
||||
|
||||
|
||||
const watchTodoChanges = Effect.gen(function*() {
|
||||
@@ -58,7 +58,7 @@ const main = Effect.gen(function*() {
|
||||
const runnableMain = main.pipe(
|
||||
Effect.provide(
|
||||
Layer.mergeAll(
|
||||
TRPCEffectRunnerLive,
|
||||
TRPCEffectRuntimeLive,
|
||||
MainLive,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user