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:
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user