( replacements: LayerNode.Replacements = [], )
| 82 | export type LocationError = LayerNode.Error<typeof locationServices> |
| 83 | |
| 84 | export function buildLocationServiceMap( |
| 85 | replacements: LayerNode.Replacements = [], |
| 86 | ): Layer.Layer<LocationServiceMap.Service> { |
| 87 | return Layer.effect( |
| 88 | LocationServiceMap.Service, |
| 89 | LayerMap.make( |
| 90 | (ref: Location.Ref) => { |
| 91 | const allReplacements = replacements.concat([[Location.node, Location.boundNode(ref)]]) |
| 92 | const location = LayerNode.hoist(locationServices, Node.tags.values.global, allReplacements) |
| 93 | |
| 94 | return LayerNode.compile(location.node).pipe( |
| 95 | Layer.fresh, |
| 96 | Layer.tap(() => |
| 97 | Effect.logInfo("booting location services", { |
| 98 | directory: ref.directory, |
| 99 | workspaceID: ref.workspaceID, |
| 100 | }), |
| 101 | ), |
| 102 | Layer.provide(LayerNode.compile(location.hoisted)), |
| 103 | ) |
| 104 | }, |
| 105 | { idleTimeToLive: "60 minutes" }, |
| 106 | ), |
| 107 | ) |
| 108 | } |
| 109 | |
| 110 | // This is temporary for backwards compatibility |
| 111 | export const locationServiceMapLayer = buildLocationServiceMap() |
no test coverage detected