Open History to see the last commit
1import * as Effect from "effect/Effect";
2import type { HttpClient } from "effect/http";
3import { AtomRegistry } from "effect/reactivity";
4
5import { connectionAtomRuntime } from "../connection/runtime";
6import { appAtomRegistry } from "../rpc/atomRegistry";
7
8// Relay (DPoP) environments authorize through services only the connection runtime provides.
9export function inEnvironmentSpeechRuntime<A, E>(
10 effect: Effect.Effect<A, E, HttpClient.HttpClient>,
11) {
12 return AtomRegistry.getResult(appAtomRegistry, connectionAtomRuntime).pipe(
13 Effect.flatMap((context) => Effect.provide(effect, context)),
14 );
15}
16
17export function runEnvironmentSpeech<A, E>(
18 effect: Effect.Effect<A, E, HttpClient.HttpClient>,
19 options?: Effect.RunOptions,
20): Promise<A> {
21 return Effect.runPromise(inEnvironmentSpeechRuntime(effect), options);
22}