1/**
2 * The engine's internal API: routes the engine calls on itself, never a
3 * user. Register `Git.InternalApiLive` beside public routes, outside user middleware.
4 */
5import * as HttpApiEndpoint from "effect/http-api/HttpApiEndpoint";
6import * as HttpApi from "effect/http-api/HttpApi";
7import * as HttpApiGroup from "effect/http-api/HttpApiGroup";
8import { HASH_ROUTE } from "../Hasher/Protocol.ts";
9
10/**
11 * The push pipeline's hashing endpoint (DESIGN §22.7), reached through the
12 * Worker's self service binding by the fan-out {@link Hasher} and
13 * authenticated with the deploy-time internal secret, never a user
14 * credential.
15 */
16export const HashPart = HttpApiEndpoint.post("hashPart", HASH_ROUTE);
17
18/** The internal group, mounted at the root. */
19export class Internal extends HttpApiGroup.make("internal", {
20 topLevel: true,
21}).add(HashPart) {}
22
23/**
24 * The internal API schema. `Git.InternalApiLive` registers its routes using
25 * `HttpApiBuilder.layer(Git.InternalApi)` with `Git.InternalLive`.
26 */
27export class InternalApi extends HttpApi.make("git-internal").add(Internal) {}