| 1 | import { RequestMethod } from '@nestjs/common'; |
| 2 | import { NestFactory } |
| 3 | |
| 4 | export const GIT_SERVICES = |
| 5 | |
| 6 | export type GitServiceName |
| 7 | |
| 8 | // this is not written by AI - This is handcrafted slop |
| 9 | export type RouteInfo |
| 10 | Exclude< |
| 11 | Exclude< |
| 12 | Parameters< |
| 13 | Awaited<ReturnType |
| 14 | >[1] |
| 15 | undefined |
| 16 | >['exclude' |
| 17 | undefined |
| 18 | >[number] |
| 19 | string |
| 20 | >; |
| 21 | |
| 22 | export function isGitServiceName(value |
| 23 | return GIT_SERVICES.includes |
| 24 | } |
| 25 | |
| 26 | export function toGitBinary(service |
| 27 | return service.replace |
| 28 | } |
| 29 | |
| 30 | export const FLUSH_PACKET = |
| 31 | |
| 32 | /** Git's smart-HTTP endpoints. Clients append these paths to the clone URL, so they have to sit at the root rather than behind the `/api` prefix - they are the only routes excluded from it. */ |
| 33 | export const GIT_PACK_ROUTES = |
| 34 | { path: ':username/:repo/git-upload-pack', |
| 35 | { path: ':username/:repo/git-receive-pack', |
| 36 | ]; |
| 37 | |
| 38 | export const GIT_TRANSPORT_ROUTES = |
| 39 | { path: ':username/:repo/info/refs', |
| 40 | ...GIT_PACK_ROUTES, |
| 41 | ]; |