mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-23 10:45:33 -04:00
19 lines
686 B
TypeScript
19 lines
686 B
TypeScript
import { Context, Effect, Layer, LayerMap } from "effect"
|
|
import { LayerNode } from "./effect/layer-node"
|
|
import { Node } from "./effect/app-node"
|
|
import { Location } from "./location"
|
|
import type { LocationError, LocationServices } from "./location-services"
|
|
|
|
export class Service extends Context.Service<
|
|
Service,
|
|
LayerMap.LayerMap<Location.Ref, LocationServices, LocationError>
|
|
>()("@opencode/example/LocationServiceMap") {
|
|
static get(ref: Location.Ref) {
|
|
return Layer.unwrap(Effect.map(Service, (locations) => locations.get(ref)))
|
|
}
|
|
}
|
|
|
|
export const node = LayerNode.unbound(Service, Node.tags.values.global)
|
|
|
|
export * as LocationServiceMap from "./location-service-map"
|