openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

[actions] Add Transformation Actions as a class & Add arg type checking lib #180

Closed florian-h05 closed 1 year ago

florian-h05 commented 1 year ago

Fixes #100.

Description

Bundle-size increases from 852 KB to 868 KB, which is really not much.

florian-h05 commented 1 year ago

@jpg0 Can you review?

florian-h05 commented 1 year ago

@digitaldan @jpg0 Can one of you please review so we can get this merged before the 3.4.0 feature freeze?

jpg0 commented 1 year ago

I would prefer that the Transformation class is pulled out into it's own file, but whatever, that can be done later.

jpg0 commented 1 year ago

Does the failing check matter here? I don't know how the docs system works.

florian-h05 commented 1 year ago

Does the failing check matter here? I don't know how the docs system works.

In this case, no I expect that failure. It is caused, because I reference the JSDoc for the Transformation class from the README. The JSDoc it references is not available online yet, it will be when this PR is merged and JSDoc updates.

florian-h05 commented 1 year ago

@jpg0 Can we merge then?

jpg0 commented 1 year ago

FYI the inverse of this work: transformations using ES6 - has not yet been implemented, and still uses Nashorn.

florian-h05 commented 1 year ago

You refer to the JavaScript Transformation service, right? I am aware that it is still using Nashorn, the question is if we need to replace it with a new Transformation service addon, or if using the JS Scripting add-on with https://github.com/openhab/openhab-core/pull/2883 is fine.

jpg0 commented 1 year ago

Oh wow, there's lots of progress there that I wasn't aware of. Thanks for the pointer.

florian-h05 commented 1 year ago

@jpg0 There are also docs for this (added today): https://github.com/openhab/openhab-docs/pull/1940.

I’ll add a section to our README to document the usage of JS Scripting for transformations.