refactor(environment): rename urls payload to data

- replace hardcoded URL keys with a generic key-value data map

- align backend DTOs, MCP schemas, and service import/export mapping

- update environment UI forms to edit JSON data instead of fixed fields
This commit is contained in:
ars9 committed 2026-04-10 21:22:46 +03:00
1 parent b45f95d8cf
commit fd515ee459
15 files changed
+141 -143

No files matched your search

@@ -7,7 +7,7 @@ import { TraceLogger } from "../common/trace-logger";
import { parse } from "acorn";
import type { Page, BrowserContext } from "playwright";
import { dumpDom } from "./dom-helpers";
import type { EnvironmentUrls } from "../environment/environment.entity";
import type { EnvironmentData } from "../environment/environment.entity";
export interface ExecResult {
result: unknown;
@@ -49,7 +49,7 @@ export class CodeExecutorService {
log?: ScriptLogger,
getStepOutput?: (order: number) => Promise<unknown>,
credentials?: Record<string, unknown>,
environment?: EnvironmentUrls | null,
environment?: EnvironmentData | null,
snippets?: Record<string, string> | null,
result?: unknown,
): Promise<ExecResult> {
@@ -61,7 +61,7 @@ export class CodeExecutorService {
.join(" ");
const credMap: Record<string, unknown> = credentials ?? {};
const envUrls: EnvironmentUrls = environment ?? {};
const envData: EnvironmentData = environment ?? {};
const snippetMap: Record<string, string> = snippets ?? {};
// pageHelpers is referenced by runSnippet, so we declare it as a var first.
@@ -91,14 +91,14 @@ export class CodeExecutorService {
}
return credMap[alias];
},
/** All URLs defined for the current environment (may be empty if no environment is set). */
env: { ...envUrls },
/** Returns the URL for the given key, or throws if it is not defined. */
/** All values defined for the current environment (may be empty if no environment is set). */
env: { ...envData },
/** Returns the value for the given key, or throws if it is not defined. */
getEnvUrl: (key: string): string => {
const value = envUrls[key];
const value = envData[key];
if (value == null) {
throw new Error(
`Environment URL "${key}" is not defined for this environment`,
`Environment value "${key}" is not defined for this environment`,
);
}
return value;