101 featch available variables from previous steps (#8062)

- add outputSchema in workflow step settings
- use outputSchemas to compute step available variables


https://github.com/user-attachments/assets/6b851d8e-625c-49ff-b29c-074cd86cbfee
This commit is contained in:
martmull
2024-10-28 12:25:29 +01:00
committed by GitHub
parent 3ae987be92
commit 1aa961dedf
49 changed files with 706 additions and 83 deletions

View File

@ -12,6 +12,7 @@ import {
CodeIntrospectionException,
CodeIntrospectionExceptionCode,
} from 'src/modules/code-introspection/code-introspection.exception';
import { generateFakeValue } from 'src/engine/utils/generate-fake-value';
type FunctionParameter = {
name: string;
@ -89,4 +90,24 @@ export class CodeIntrospectionService {
type: parameter.getType().getText(),
};
}
public generateInputData(fileContent: string, fileName = 'temp.ts') {
const parameters = this.analyze(fileContent, fileName);
return this.generateFakeDataFromParams(parameters);
}
private generateFakeDataFromParams(
params: FunctionParameter[],
): Record<string, any> {
const data: Record<string, any> = {};
params.forEach((param) => {
const type = param.type;
data[param.name] = generateFakeValue(type);
});
return data;
}
}