Skip to content

[cache] javaify() & jsify() JS objects in shared cache & [rules] Make EventObject::raw contain raw data - #549

Merged
florian-h05 merged 5 commits into
openhab:mainfrom
Nadahar:jsify-use
Jul 21, 2026
Merged

[cache] javaify() & jsify() JS objects in shared cache & [rules] Make EventObject::raw contain raw data#549
florian-h05 merged 5 commits into
openhab:mainfrom
Nadahar:jsify-use

Conversation

@Nadahar

@Nadahar Nadahar commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This isn't meant to be used as is - I just found it easier to show what I'm thinking that trying to explain it.

I've dealt with both _getTriggeredData() and the shared cache, but I am somewhat confused about the raw property as I thought that was supposed to be "unjsified".

Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
@Nadahar

Nadahar commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@florian-h05 Please take a look at what I've suggested here as well. It's primarily about the shared cache, but it also modifies getTriggeredData() a bit, in that it calls jsify() on the data to be jsified instead of javaMapToJsObj(), which I assume only converts the outer map. Then I also put the raw map directly in raw, but perhaps it should be treated with javaMapToJsObj() first?

Comment thread src/rules/rules.js Outdated
Comment thread src/cache.js Outdated
Comment thread src/cache.js
@florian-h05

Copy link
Copy Markdown
Contributor

Then I also put the raw map directly in raw, but perhaps it should be treated with javaMapToJsObj() first?

I would actually keep raw the raw Java Map according to its name. Not sure when or why I changed it to a JS object ...
WDYT?

@Nadahar

Nadahar commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

I would actually keep raw the raw Java Map according to its name. Not sure when or why I changed it to a JS object ...
WDYT?

Yes, I agree, my expectation would be that it should be "raw". I also think it makes little difference in most cases, since Graal already lets you do a lot of things "natively" with a Java map.

Ravi Nadahar added 2 commits July 19, 2026 17:34
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
Comment thread src/rules/rules.js Outdated
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
@Nadahar
Nadahar marked this pull request as ready for review July 19, 2026 19:10
@Nadahar
Nadahar requested a review from a team as a code owner July 19, 2026 19:10
@Nadahar

Nadahar commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@florian-h05 It sounds like you think the rest of this is good, so I took it out of draft. That leaves only the change to input.raw, otherwise the changes only apply to the shared cache.

@Nadahar

Nadahar commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Also, if somebody you check/test/verify openhab/openhab-webui#4315 and it's OK, I could give creating blocks for javaify() and jsify() a shot.

Comment thread src/cache.js Outdated
Comment thread src/cache.js
Comment thread src/cache.js Outdated
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>

@florian-h05 florian-h05 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@florian-h05 florian-h05 changed the title Suggest possible jsify() use [cache] javaify() & jsify() JS objects in shared cache & [rules] Make EventObject::raw contain raw data Jul 21, 2026
@florian-h05 florian-h05 added the enhancement New feature or request label Jul 21, 2026
@florian-h05 florian-h05 added this to the to be released milestone Jul 21, 2026
@florian-h05
florian-h05 merged commit 8d4494d into openhab:main Jul 21, 2026
6 checks passed
@Nadahar
Nadahar deleted the jsify-use branch July 21, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants