2026-03-16 16:55:14 +00:00
|
|
|
import { Effect, Layer, ManagedRuntime } from "effect"
|
2026-03-10 16:53:47 +00:00
|
|
|
import { AccountService } from "@/account/service"
|
2026-03-13 00:43:24 +00:00
|
|
|
import { AuthService } from "@/auth/service"
|
2026-03-16 16:55:14 +00:00
|
|
|
import { Instances } from "@/effect/instances"
|
|
|
|
|
import type { InstanceServices } from "@/effect/instances"
|
|
|
|
|
import { Instance } from "@/project/instance"
|
2026-03-10 16:53:47 +00:00
|
|
|
|
2026-03-14 15:58:00 +00:00
|
|
|
export const runtime = ManagedRuntime.make(
|
2026-03-16 16:55:14 +00:00
|
|
|
Layer.mergeAll(AccountService.defaultLayer, Instances.layer).pipe(Layer.provideMerge(AuthService.defaultLayer)),
|
2026-03-14 15:58:00 +00:00
|
|
|
)
|
2026-03-16 16:55:14 +00:00
|
|
|
|
|
|
|
|
export function runPromiseInstance<A, E>(effect: Effect.Effect<A, E, InstanceServices>) {
|
|
|
|
|
return runtime.runPromise(effect.pipe(Effect.provide(Instances.get(Instance.directory))))
|
|
|
|
|
}
|