Fix
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import { BunRuntime } from "@effect/platform-bun"
|
||||
import { Todo } from "@todo-tests/common/data"
|
||||
import { Todo, type IdentifiedTodo } from "@todo-tests/common/data"
|
||||
import { Identifiable } from "@todo-tests/common/traits"
|
||||
import { Array, Effect, Layer, Option, Stream } from "effect"
|
||||
import { Chunk, Effect, Layer, Stream } from "effect"
|
||||
import { ServicesLive } from "./Services"
|
||||
import { TodoRepository, createDefaultTodos } from "./TodoRepository"
|
||||
import { ExpressApp } from "./express/ExpressApp"
|
||||
import { ExpressHTTPServer } from "./express/ExpressHTTPServer"
|
||||
import { RPCPlayground } from "./rpc/RPCPlayground"
|
||||
import { RPCPlaygroundRoute } from "./rpc/RPCPlaygroundRoute"
|
||||
import { RPCRouter } from "./rpc/RPCRouter"
|
||||
import { RPCServer } from "./rpc/RPCServer"
|
||||
import { RPCServerRoute } from "./rpc/RPCServerRoute"
|
||||
import { RPCProcedureBuilder } from "./rpc/procedures/RPCProcedureBuilder"
|
||||
import { TRPCBuilder } from "./trpc/TRPCBuilder"
|
||||
import { TRPCContextCreator } from "./trpc/TRPCContextCreator"
|
||||
|
||||
|
||||
const ServerDev = ExpressHTTPServer.Live.pipe(
|
||||
Layer.provide(RPCServer.Live),
|
||||
Layer.provide(RPCPlayground.Dev),
|
||||
Layer.provide(RPCServerRoute.Live),
|
||||
Layer.provide(RPCPlaygroundRoute.Dev),
|
||||
Layer.provide(RPCRouter.Live),
|
||||
Layer.provide(RPCProcedureBuilder.Live),
|
||||
Layer.provide(TRPCBuilder.Live),
|
||||
@@ -30,11 +30,11 @@ const watchTodoChanges = Effect.gen(function*() {
|
||||
// yield* Stream.runForEach(todos.todos.changes, todos => Console.log(`Todos changed: ${ todos }`))
|
||||
yield* todos.todos.changes.pipe(
|
||||
Stream.runFold(
|
||||
Array.empty<Todo & { id: Option.Some<string> }>(),
|
||||
Chunk.empty<IdentifiedTodo>(),
|
||||
|
||||
(prev, curr) => {
|
||||
console.log(`Added todos: ${ Array.differenceWith<Todo>(Identifiable.equals)(curr, prev) }`)
|
||||
console.log(`Removed todos: ${ Array.differenceWith<Todo>(Identifiable.equals)(prev, curr) }`)
|
||||
console.log(`Added todos: ${ Chunk.differenceWith<Todo>(Identifiable.equals)(curr, prev) }`)
|
||||
console.log(`Removed todos: ${ Chunk.differenceWith<Todo>(Identifiable.equals)(prev, curr) }`)
|
||||
|
||||
return curr
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ import { RPCRouter } from "./RPCRouter"
|
||||
import { rpcPlaygroundRoot, rpcRoot } from "./config"
|
||||
|
||||
|
||||
export module RPCPlayground {
|
||||
export module RPCPlaygroundRoute {
|
||||
export const Live = Layer.empty
|
||||
|
||||
export const Dev = Layer.effectDiscard(Effect.gen(function*() {
|
||||
@@ -6,7 +6,7 @@ import { RPCRouter } from "./RPCRouter"
|
||||
import { rpcRoot } from "./config"
|
||||
|
||||
|
||||
export module RPCServer {
|
||||
export module RPCServerRoute {
|
||||
export const Live = Layer.effectDiscard(Effect.gen(function*() {
|
||||
const app = yield* ExpressApp
|
||||
|
||||
Reference in New Issue
Block a user