Skip to content
Myr

surfaces.ts

This file

Path

apps/web/src/surfaces.ts

33 lines · 1.2 KiB · TypeScript

Last changed by

Merge redesign into mainoscabrielbefore adoptioncaedd21

History of this file

Take it

The walk stopped after 200 commits: lines older than 678c8b8 point at it.

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 1–3why, one step back
1import { surfaced } from "@repo/protocol/contracts";
2import { Effect, Layer } from "effect";3import { FetchHttpClient } from "effect/http";

Merge fix/w12-reviewoscabrielbefore adoption7b8b393

line 4why, one step back
4import { Atom, AtomRpc } from "effect/reactivity";

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 5–8why, one step back
5import { RpcClient, RpcSerialization } from "effect/rpc";
67export const webContracts = surfaced("web");8

Merge build/comments-web-rest into mainoscabrielbefore adoption0eb1248

line 9why, one step back
9// One memo map for every registry, so they share one `Reactivity`: a write on a page's own registry

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 10why, one step back
10// must refetch the shell's counts in the root's too.

Merge fix/w12-reviewoscabrielbefore adoption7b8b393

lines 11–14why, one step back
11export const sharedRuntime = Atom.context({
12 memoMap: Layer.makeMemoMapUnsafe(),13});14

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 15–18why, one step back
15export class ContractsClient extends AtomRpc.Service<ContractsClient>()(
16 "web/ContractsClient",17 {18 group: webContracts,

Merge fix/w12-reviewoscabrielbefore adoption7b8b393

line 19why, one step back
19 runtime: sharedRuntime,

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 20–25why, one step back
20 protocol: RpcClient.layerProtocolHttp({ url: "/rpc" }).pipe(
21 Layer.provide([FetchHttpClient.layer, RpcSerialization.layerJson])22 ),23 }24) {}25

Merge build/comments-web-rest into mainoscabrielbefore adoption0eb1248

line 26why, one step back
26// NDJSON, which the platform answers message by message, so a stream stays open while the page reads it.

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 27–33why, one step back
27export const framedClient = RpcClient.make(webContracts).pipe(
28 Effect.provide(29 RpcClient.layerProtocolHttp({ url: "/rpc" }).pipe(30 Layer.provide([FetchHttpClient.layer, RpcSerialization.layerNdjson])31 )32 )33);