Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 7x 7x 7x 7x 13x 7x 13x 7x | import {
IsDefined,
IsIn,
IsNotEmpty,
IsOptional,
IsString,
ValidateIf,
} from 'class-validator';
import { SanitizeCodeBlock } from './sanitizer.decorator';
export class QuickEditArgsDto {
@IsString({ message: 'file_path must be a string.' })
@IsNotEmpty({ message: 'file_path must not be empty.' })
file_path: string;
@IsOptional()
@IsIn(['insert_after', 'insert_before', 'replace', 'delete_block'], {
message:
'action must be one of: insert_after, insert_before, replace, delete_block.',
})
action: 'insert_after' | 'insert_before' | 'replace' | 'delete_block' =
'replace';
@SanitizeCodeBlock()
@IsString({ message: 'search_block must be a string.' })
@IsNotEmpty({ message: 'search_block must not be empty.' })
search_block: string;
@ValidateIf(
(o) =>
!o.action ||
o.action === 'insert_after' ||
o.action === 'insert_before' ||
o.action === 'replace',
)
@IsDefined({
message:
'new_content is required for insert_after, insert_before, and replace actions.',
})
@IsString({ message: 'new_content must be a string.' })
@SanitizeCodeBlock()
new_content?: string;
}
|