upstream.ts
This file
Path
packages/git/src/upstream.ts
33 lines · 998 bytes · TypeScript
Last changed by
Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
History of this fileTake it
12345678910111213141516171819202122232425262728293031323334import { RepoName } from "@repo/artifacts/repo-host";import type { RepoNotFound } from "@repo/artifacts/repo-host";import { Context, Data, Schema } from "effect";import type { Effect } from "effect";
export type Service = "git-upload-pack" | "git-receive-pack";
/** The client's credentials are never among the headers. */export type Exchange = Data.TaggedEnum<{ Advertise: { readonly service: Service; readonly headers: Headers }; Call: { readonly service: Service; readonly headers: Headers; readonly body: ReadableStream<Uint8Array>; };}>;
export const Exchange = Data.taggedEnum<Exchange>();
export class UpstreamFailure extends Schema.TaggedError<UpstreamFailure>()( "UpstreamFailure", { reason: Schema.String, repo: RepoName }) {}
export class Upstream extends Context.Service< Upstream, { readonly exchange: ( repo: RepoName, exchange: Exchange ) => Effect.Effect<Response, RepoNotFound | UpstreamFailure>; }>()("git/Upstream") {}