Open amotl opened 1 year ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
772f9f5
) 49.75% compared to head (8cd99f7
) 49.96%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi there,
after bouncing on and off on the idea to leverage the
javascript
package for data transformation purposes, in order to get rid of our PutsReq instance, which is a resource hog, and ceased to exist anyway, and while being unsure whether or how to also bring it to Kotori or LorryStream exactly, I am finally making a start on behalf of mqttwarn.On the PutsReq instance I was referring to, we are running small snippets of JavaScript code like putsreq.hiveeyes.ttn_v3.js, in order to converge telemetry data packages received from TTN into a format digested by Kotori, effectively just unwrapping a few levels of JSON nestedness.
Following this idea, and annoyed about PutsReq itself, we've also explored the problem space on behalf of other projects like flow-heater already. At about the same time, Cloudflare Workers have been released, allowing to route and modify HTTP requests in different ways, using JavaScript or TypeScript. /cc @elbart
This patch essentially brings the same idea to mqttwarn, where all the routing and transforming machinery is already in place, and just needed a laughably small patch to achieve the same things with JavaScript without much further ado, thanks to the excellent JSPyBridge by @extremeheat. 💯
By providing an alternative way of writing user-defined functions, the patch challenges the current slogan "primarily written in Python". I hope you will still like it, and I will be happy to hear back about your opinion about it.
Rest assured I am not a strong advocate of the JavaScript language, nor its paradigms and its NPM ecosystem ^1. But I recognize the value of the V8 runtime underneath Node.js, that it's an excellent and robust piece of software, and that people are doing many amazing things of their own kind with it.
The preview of the corresponding documentation can be inspected here:
With kind regards, Andreas.
NB: Next stop: Lua? Edit: See GH-669. NB: Next stop: Java? See https://github.com/jpype-project/jpype and https://github.com/kivy/pyjnius. NB: Next stop: Golang? See https://github.com/grumpyhome/grumpy.