feat(browser): add environment, credentials, and script logger to POST /exec

- ExecDto gains optional `environment` and `credentials` fields
- BrowserService.exec forwards both to CodeExecutorService.execute so
  helpers.env, helpers.getEnvUrl(), and helpers.getCredential() work
  identically to scenario-scheduler steps
- script console.log/warn/error now routed through TraceLogger with
  session label prefix
- integration tests cover env/creds injection and missing-alias error
This commit is contained in:
2026-04-14 16:57:06 +03:00
parent d34ea9e943
commit 1a2e786ca8
4 changed files with 104 additions and 9 deletions
+20 -1
View File
@@ -1,5 +1,6 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsOptional, IsString, IsUrl } from "class-validator";
import { IsObject, IsOptional, IsString, IsUrl } from "class-validator";
import type { EnvironmentData } from "../../environment/environment.entity";
export class ExecDto {
@ApiPropertyOptional({
@@ -27,4 +28,22 @@ export class ExecDto {
})
@IsString()
code: string;
@ApiPropertyOptional({
description:
"Key/value map of environment variables available via `helpers.env` and `helpers.getEnvUrl()` in the script.",
example: { BASE_URL: "https://example.com" },
})
@IsOptional()
@IsObject()
environment?: EnvironmentData;
@ApiPropertyOptional({
description:
"Key/value map of credentials available via `helpers.getCredential()` in the script.",
example: { admin: { username: "user", password: "pass" } },
})
@IsOptional()
@IsObject()
credentials?: Record<string, unknown>;
}