import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { IsOptional, IsString, IsUrl } from "class-validator"; export class ExecDto { @ApiPropertyOptional({ description: "Optional named browser session. If it does not exist yet, it is created automatically.", example: "test-session-1", }) @IsOptional() @IsString() sessionName?: string; @ApiPropertyOptional({ description: "URL to navigate to before executing code. Skipped if omitted.", example: "https://cabinet-liquio-diia-stg.kitsoft.ua/messages", }) @IsOptional() @IsUrl({ require_tld: true, require_protocol: true }) url?: string; @ApiProperty({ description: "JavaScript code to execute. Receives `page` (Playwright Page) and `context` (BrowserContext) as arguments. May be async. Return value is serialised and returned.", example: "return await page.title();", }) @IsString() code: string; }