- add ScenarioRunLogEntity to persist step script output to DB - stepLogger dual-writes to NestJS logger and DB (fire-and-forget) - add GET /scenarios/:id/run/:runId returning run, stepRuns and logs - add POST /scenarios/:id/run/:runId/wait (polls until terminal state) - 9 new integration tests for the two endpoints (136 total) - add eslint with typescript-eslint and eslint-config-prettier - add npm scripts: format, lint, lint:fix - resolve all lint errors across src and test (no any types) - add CONTRIBUTING.md covering dev workflow
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import {
|
|
IsIn,
|
|
IsInt,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
Min,
|
|
} from "class-validator";
|
|
import { StepType } from "../scenario-step.entity";
|
|
|
|
export class CreateScenarioStepDto {
|
|
@ApiProperty({ example: 0, description: "Execution order (ascending)" })
|
|
@IsInt()
|
|
@Min(0)
|
|
order: number;
|
|
|
|
@ApiProperty({ enum: ["login", "exec", "sign"], example: "exec" })
|
|
@IsIn(["login", "exec", "sign"])
|
|
type: StepType;
|
|
|
|
@ApiProperty({
|
|
description:
|
|
"Session name used by this step. login steps create it; exec steps consume it.",
|
|
example: "my-session",
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
sessionName: string;
|
|
|
|
@ApiPropertyOptional({ example: "return await page.title();" })
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
execCode?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
example:
|
|
'return { success: result !== null, description: "title present" };',
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
validateCode?: string;
|
|
}
|