Skip to content

Commit

Permalink
Remove static find and filter from functions before sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
durulkoca committed May 9, 2024
1 parent d52ab92 commit 5b3912c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/widgets/ProcessDrawer/ProcessDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,37 @@ function ApiButton() {
}
}, [run.status]); //eslint-disable-line

const removeStaticMethods = (functions) => {
return functions.map((func) => {
if (func.type === "CLASS") {
const definitionLines = func.definition.split("\n");
const filteredLines = definitionLines.filter(
(line) =>
!line.includes("static filter") && !line.includes("static find")
);
return {
...func,
definition: filteredLines.join("\n"),
};
}
return func;
});
};

const runSandbox = async (context, specification, runtime) => {
const types = [
...(context?.types || []),
...getTypes(specification.functions),
];

const filteredFunctions = removeStaticMethods(context.functions);

setLoading(true);
try {
const openapi = {
openapi: {
...toOpenApi({ api: context.api, types }),
"x-nuc-functions": context.functions,
"x-nuc-functions": filteredFunctions,
"x-nuc-declerations": context.declarations,
action: "start",
},
Expand Down

0 comments on commit 5b3912c

Please sign in to comment.