| 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 | */ |
| 5 | import * as HttpApiEndpoint from "effect/http-api/HttpApiEndpoint"; |
| 6 | import * as HttpApi from "effect/http-api/HttpApi"; |
| 7 | import * as HttpApiGroup from "effect/http-api/HttpApiGroup"; |
| 8 | import { 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 | */ |
| 16 | export const HashPart = HttpApiEndpoint.post("hashPart", HASH_ROUTE); |
| 17 | |
| 18 | /** The internal group, mounted at the root. */ |
| 19 | export 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 | */ |
| 27 | export class InternalApi extends HttpApi.make("git-internal").add(Internal) {} |