* [jsscripting] Refactor ThreadsafeTimers to create futures inline instead of in an extra methods
* [jsscripting] Introduce utility class for providing easy access to script services
* [jsscripting] Reimplement timer creation methods from ScriptExecution for thread-safety
* [jsscripting] Add missing JavaDoc for reimplement timer creation methods
* [jsscripting] Remove the future from the map when setTimeout expires
* [jsscripting] Rename `GraalJSScriptServiceUtil` to `JSScriptServiceUtil`
* [jsscripting] Remove the `createTimerWithArgument` method
* [jsscripting] Replace the OSGi workaround of `JSScriptServiceUtil` with an injection mechanism
* [jsscripting] Use constructor to inject `JSScriptServiceUtil` into `GraalJSScriptEngineFactory`
* [jsscripting] Minor improvements by @J-N-K (#1)
* [jsscripting] Minor changes related to last commit to keep flexibility of `JSRuntimeFeatures`
* [jsscripting] Upgrade openhab-js to v2.1.1
* [jsscripting] Remove unused code
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Co-authored-by: Jan N. Klug <github@klug.nrw>
This fixed the maven build, that fails because webpack-cli version 5.0.0 doesn’t properly process the given entrypoint.
Instead, webpack tries to use the entrypoint from openhab-js‘ webpack config file.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* [jsscripting] Downgrade GraalVM to fix issue with armv7l & OpenJDK 11.0.16
The community reported several cases where JS Scripting was not working due to some issue with the injection of the global script.
This issue seems to only occur on armv7l (e.g. Raspberry Pi 32bit) and OpenJDK 11.0.16.
Investigation showed that the occurrence of the problem depends on the GraalJS version.
See https://community.openhab.org/t/js-scripting-all-scripts-stop-working-when-upgrading-to-3-4-0-m4/140837.
* [jsscripting] Add logging for injection of JSRuntimeFeatures
* [jsscripting] Lint `@jsscripting-globals.js` with semistandard
* [jsscripting] Remove ICU4J as it moved to `org.graalvm.truffle`
Reference f5661d4655/CHANGELOG.md (version-2200).
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* [jsscripting] Reimplement timers to conform standard JS
* [jsscripting] Name scheduled jobs by loggerName + id
* [jsscripting] Update timer identifiers
* [jsscripting] Update identifiers for scheduled jobs
* [jsscripting] Synchronize method that is called when the script is reloaded
* [jsscripting] Cancel all scheduled jobs when the engine is closed
* [jsscripting] Ensure that a timerId is never reused by a subsequent call & Use long primitive type instead of Integer
* [jsscripting] Use an abstraction class to inject features into the JS runtime
* [jsscripting] Make ThreadsafeTimers threadsafe for concurrent access to the class itself
* [jsscripting] Move the locking for `invokeFunction` to `OpenhabGraalJSScriptEngine`
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* [jsscripting] Share the lock mechanism that was used only for rules
This change moves the lock object that was originally created for ThreadsafeSimpleRuleDelegate to OpenhabGraalJSScriptEngine to make share it across the whole engine.
* [jsscripting] Inject the lock object into the JS runtime
* [jsscripting] Update `setTimeout` & `setInterval` polyfills to enable threadsafety
* [jsscripting] Upgrade GraalJS from 21.3.0 to 22.3.0
* [jsscripting] Reduce compiler warnings
* [jsscripting] Update node version of frontend-maven-plugin
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* Bump openhab-js version to 2.0.0
* Update README for current openhab-js version
* README: Fix paths to images
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* Appends the ruleID or file name to the logger when console logging.
* Adds configurable logging, updates scriptId logic
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
* New translations astro.properties (Finnish)
* New translations astro.properties (German)
* New translations bluetooth.properties (German)
* New translations boschshc.properties (Italian)
* New translations comfoair.properties (German)
* New translations dwdunwetter.properties (German)
* New translations epsonprojector.properties (German)
* New translations gpio.properties (German)
* New translations heliosventilation.properties (German)
* New translations homeconnect.properties (German)
* New translations homematic.properties (German)
* New translations ipp.properties (German)
* New translations jruby.properties (Hungarian)
* New translations jsscripting.properties (German)
* New translations jsscripting.properties (Hungarian)
* New translations map.properties (German)
* New translations map.properties (Hungarian)
* New translations mqttbroker.properties (Italian)
* New translations nanoleaf.properties (German)
* New translations ocean.properties (German)
* New translations openhabcloud.properties (Finnish)
* New translations samsungtv.properties (Hungarian)
* New translations shelly.properties (German)
* New translations snmp.properties (German)
* New translations sonos.properties (German)
* New translations spotify.properties (German)
* New translations tr064.properties (German)
* New translations tradfri.properties (German)
* New translations unifi.properties (German)
* New translations unifi.properties (Hungarian)
* New translations valloxmv.properties (Finnish)
* New translations volvooncall.properties (German)
* New translations xslt.properties (German)
This adds a minor refactoring of loading local resource paths that i didn't have time to get into 3.2 and moves the docs directory to doc.
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
* [jsscripting] Library and Doc updates
This updates the documentation, bumps the NPM version library, and implements conversion of JS date types (js-joda) to Java types
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Updated the documentation with:
* Core Actions
* Cloud Notification Actions
* Persistence Extensions
* Ephemeris Actions
* Types and Units
Instead of the single "imports", the default scope
(openhab-core/DefaultScriptScopeProvider.java) is used.
It's imported as `openhab`, services are under `openhab.service`.
As the helper library is on the way (openhab/openhab-js):
* Added note about console.log and logging in general.
* Added note that the lib is on the way.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>