Compute output schema on frontend (#16530)
Fixes https://github.com/twentyhq/core-team-issues/issues/1382 Current issue : all step output schemas are computed and stored on backend side. Which means that, when the database schema is updated - like a field creation - steps needs to be deleted an recreated. Which is invisible to users. Solution : schema generation is moved on frontend side 1. Coming on the page the first time, the schema is populated for all steps except a few ones that are handled differently (Code, Webhook, http node, Agent) 2. A separated state allow to determine if a step needs a recomputation. 3. The user only needs a refresh to see the whole schema re-computed Follow-up: - check if remaining backend steps could be moved to runtime computation. But Code will still require storage. - Clean backend service that is not used anymore
This commit is contained in:
+6
-9
@@ -175,15 +175,12 @@ export class WorkflowSchemaWorkspaceService {
|
||||
workspaceId: string;
|
||||
workflowVersionId: string;
|
||||
}): Promise<WorkflowAction> {
|
||||
// We don't enrich on the fly for code and HTTP request workflow actions.
|
||||
// For code actions, OutputSchema is computed and updated when testing the serverless function.
|
||||
// For HTTP requests, OutputSchema is determined by the example response input
|
||||
// AI agent OutputSchema is enriched from agent's responseFormat
|
||||
if (
|
||||
[WorkflowActionType.CODE, WorkflowActionType.HTTP_REQUEST].includes(
|
||||
step.type,
|
||||
)
|
||||
) {
|
||||
const BACKEND_ENRICHED_TYPES = [
|
||||
WorkflowActionType.AI_AGENT,
|
||||
WorkflowActionType.ITERATOR,
|
||||
];
|
||||
|
||||
if (!BACKEND_ENRICHED_TYPES.includes(step.type)) {
|
||||
return step;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user