Skip to content

Commit

Permalink
Merge pull request #262 from NucleoidAI/remove-static-find-and-filter
Browse files Browse the repository at this point in the history
Remove static methods from functions
  • Loading branch information
canmingir authored May 9, 2024
2 parents c9dc69c + 5b3912c commit fb5b88e
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 fb5b88e

Please sign in to comment.