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