Script editor plugin

Hi @daimadoshi85
I wanted to give it a try. Do I have to build the plugin myself - or is it enough to clone it in the plugins folder?
I ask because just cloning did not work:
image

There is a zip released on github. Download it and please make sure to unzip the folder to camunda-modeler/resources/plugins folder.
Else, you can clone the project, run npm install && npm run all and copy the cloned folder to the folder I wrote above.

@daimadoshi85 thanks - I can now start the plugin.

However if I push the the RUN button I get the following exception:

That’s correct about now, It’s, well…why I made this topic :slight_smile:

Running a script does not work now, because it’s blocked from CSP policy. I just kept it to show the exception to Camunda developers.

Ah ok - would be great if you could add an how to use / limitations chapter to your Github README (also an example with the context would be also appreciated :wink: ).

Thanks for the cool plugin - this will help a lot - I will definitely try it out!

1 Like

I did a quick try using JS-Interpreter with the latest acorn release and that did not break CSP. Of course, it’s probably a far cry from browser JS engine and possibly not even equal with Nashorn. Might need polyfills. :thinking:

2 Likes

For the purposes I meant to achieve, it could be one possible solution. Thank you! I’ll certainly give it a try!

I don’t know if acorn-version make any difference. Version 0.8.0 seems to be the first one to include acorn_csp-build, which works in the sandbox. The latest versions work by default. JS-interpreter’s interpreter.js required a few changes: 1) importing acorn into its namespace var acorn = require("acorn"); 2) exporting the module module.exports = Interpreter; 3) fix it to not to try dynamically require Node’s vm-module (it can fallback to other methods).

1 Like

Can you use a similar pattern as this project GitHub - bpmn-io/dmn-testing-plugin: Camunda Modeler plugin that allows testing of a DMN decision.. And pass your scripts into a jar execution?

2 Likes

We are also facing the same issue.

Looking at Script editor plugin - #16 by datakurre this seems to be the way to go.

We’ll not be able to follow up on the isolated execution thing any time soon. But given you persue the JS-interpreter route whenever we offer something, this may be a droping replacement.

Honestly speaking, an interpreted execution could have additional benefits, such as being able to debug and/or capture errors in a controlled environment.

Then again, I’m wondering how much value you get out of the script evaluation (RUN) feature? Most variables/context values won’t be there. Evaluation only works for selected languages. Or am I missing something?

The reason is exactly that, we want that also “simple” users (let’s say business users) with a very little programming knowledge can write bpmn with scripts, and fastly test if there is something wrong.
At this moment, it is working with javascript (Thank you @datakurre ) and I am working hard to make it work on groovy (@StephenOTT thank you for your suggestion, that was a good start), struggling with ipcMain event communication.
If anyone has some kind of suggestion for that is very welcome, I’m a bit stuck on menu plugin js file

Good evening! I just updated the code editor plugin and added groovy execution!
Here’s a brief example of how it works.

Download it and try it out! Let me know your opinion and your suggestions!

5 Likes

Thats fantastic!

1 Like

Thank you very much :slight_smile:

Just a little warning: to improve security, I had to use SecureASTCustomizer with static type checking. I understand it’s a bit limiting but I thought it as a necessary misure.

Hi @daimadoshi85
I tried the new version 0.3.0. I get the following exception (when hitting the run button):

Did I miss something?

Hi @pme123 ,
it seems that the groovy executor is not starting. Which version did you install? Linux or windows?

Linux (on a Mac) 0.3.0

I’ll send you a pm.