Open History to see the last commit
1import { Connection } from "@t3tools/client-runtime/connection";
2import { shellSnapshotLoaderLayer } from "@t3tools/client-runtime/state/shell";
3import { threadSnapshotLoaderLayer } from "@t3tools/client-runtime/state/threads";
4import * as Layer from "effect/Layer";
5import { Atom } from "effect/unstable/reactivity";
6
7import { runtimeContextLayer } from "../lib/runtime";
8import { connectionPlatformLayer } from "./platform";
9
10const providedConnectionPlatformLayer = connectionPlatformLayer.pipe(
11 Layer.provide(runtimeContextLayer),
12);
13
14const snapshotLoaderLayer = Layer.merge(threadSnapshotLoaderLayer, shellSnapshotLoaderLayer);
15
16type ConnectionLayerSource =
17 | typeof Connection.layer
18 | typeof snapshotLoaderLayer
19 | typeof runtimeContextLayer
20 | typeof connectionPlatformLayer;
21
22const connectionLayer = Layer.merge(Connection.layer, snapshotLoaderLayer).pipe(
23 Layer.provideMerge(Layer.mergeAll(runtimeContextLayer, providedConnectionPlatformLayer)),
24);
25
26export const connectionAtomRuntime: Atom.AtomRuntime<
27 Layer.Success<ConnectionLayerSource>,
28 Layer.Error<ConnectionLayerSource>
29> = Atom.runtime(connectionLayer);