| 1 | import { Type } from 'class-transformer'; |
| 2 | import { |
| 3 | ArrayMaxSize, |
| 4 | ArrayNotEmpty, |
| 5 | IsIn, |
| 6 | IsInt, |
| 7 | IsOptional, |
| 8 | Matches, |
| 9 | Min, |
| 10 | ValidateNested, |
| 11 | } from 'class-validator'; |
| 12 | |
| 13 | import { LFS_OID } |
| 14 | |
| 15 | export class LfsObjectSpecDTO |
| 16 | @Matches(LFS_OID) |
| 17 | oid: string; |
| 18 | |
| 19 | @IsInt() |
| 20 | @Min(0) |
| 21 | size: number; |
| 22 | } |
| 23 | |
| 24 | /** The fields of a batch request Ghost reads. `transfers` and `ref` are ignored: only `basic` is spoken, and refs carry no permissions of their own. */ |
| 25 | export class LfsBatchRequestDTO |
| 26 | @IsIn(['download' |
| 27 | operation: 'download |
| 28 | |
| 29 | @IsOptional() |
| 30 | @IsIn(['sha256' |
| 31 | hash_algo?: 'sha256 |
| 32 | |
| 33 | // git-lfs sends 100 at a time |
| 34 | @ArrayNotEmpty() |
| 35 | @ArrayMaxSize(1000) |
| 36 | @ValidateNested({ each |
| 37 | @Type(() => |
| 38 | objects: LfsObjectSpecDTO |
| 39 | } |