layer-gate.ts
This file
Path
apps/platform/src/layer-gate.ts
42 lines · 1.2 KiB · TypeScript
Last changed by
Merge build/comments-platform into mainoscabrielbefore adoptionddf09e8
History of this fileTake 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–42why, one step back1import { RepoNotFound } from "@repo/artifacts/repo-host";2import type { RepoName } from "@repo/artifacts/repo-host";3import { Upstream } from "@repo/git/upstream";4import type { LayerAccess } from "@repo/project/visibility-port";5import type { LayerName, ProjectName } from "@repo/protocol/ids";6import type { Principal } from "@repo/protocol/principal";7import type { Option } from "effect";8import { Context, Effect, Layer } from "effect";910export interface LayerTarget {11 readonly layer: LayerName;12 readonly project: ProjectName;13}1415export interface LayerReach {16 readonly access: LayerAccess;17 readonly target: LayerTarget;18}1920export interface LayerGatePort {21 readonly classify: (22 repo: RepoName,23 who: Principal24 ) => Effect.Effect<Option.Option<LayerReach>>;25 readonly upstream: Upstream["Service"];26}2728export const noLayers: LayerGatePort = {29 classify: () => Effect.succeedNone,30 upstream: Upstream.of({31 exchange: (repo) => Effect.fail(new RepoNotFound({ name: repo })),32 }),33};3435export const LayerGate = Context.Reference<LayerGatePort>(36 "platform/LayerGate",37 {38 defaultValue: () => noLayers,39 }40);4142export const NoLayers: Layer.Layer<never> = Layer.succeed(LayerGate, noLayers);