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:
2026-04-10 21:22:46 +03:00
parent b45f95d8cf
commit fd515ee459
15 changed files with 141 additions and 143 deletions
+11 -13
View File
@@ -6,7 +6,7 @@ import type { Request, Response } from "express";
import { SessionService } from "../session/session.service";
import { SessionContextService } from "../session/session-context.service";
import { EnvironmentService } from "../environment/environment.service";
import type { EnvironmentUrls } from "../environment/environment.entity";
import type { EnvironmentData } from "../environment/environment.entity";
import { BrowserService } from "../browser/browser.service";
import { CodeExecutorService } from "../code-executor/code-executor.service";
import { ScenarioService } from "../scenario/scenario.service";
@@ -174,23 +174,21 @@ export class McpService {
server.registerTool(
"create_environment",
{
description: "Create a new named environment with a set of URLs",
description: "Create a new named environment with generic data",
inputSchema: {
name: z
.string()
.describe("Unique environment name, e.g. liquio-diia-stg"),
urls: z
data: z
.record(z.string(), z.string())
.describe(
"Map of URL keys to URL strings (id_url, cabinet_url, admin_url, …)",
),
.describe("Map of string keys to string values"),
},
},
async ({ name, urls }) => {
async ({ name, data }) => {
try {
const env = await this.environmentService.create({
name,
urls: urls as EnvironmentUrls,
data: data as EnvironmentData,
});
return {
content: [{ type: "text" as const, text: JSON.stringify(env) }],
@@ -207,21 +205,21 @@ export class McpService {
server.registerTool(
"update_environment",
{
description: "Update an existing environment (name and/or urls)",
description: "Update an existing environment (name and/or data)",
inputSchema: {
id: z.string().uuid().describe("Environment ID to update"),
name: z.string().optional().describe("New name"),
urls: z
data: z
.record(z.string(), z.string())
.optional()
.describe("New URLs map"),
.describe("New data map"),
},
},
async ({ id, name, urls }) => {
async ({ id, name, data }) => {
try {
const env = await this.environmentService.update(id, {
name,
urls: urls as EnvironmentUrls | undefined,
data: data as EnvironmentData | undefined,
});
return {
content: [{ type: "text" as const, text: JSON.stringify(env) }],