feat/modernize-self-service-deploy#2
Open
mateuscardosodeveloper wants to merge 5 commits into
Open
Conversation
Switch package management to pnpm with a committed lockfile and workspace build approval, add multi-stage Docker, compose, pm2, and a GitHub Actions test workflow. Point all scripts and entrypoints at dist/main.js and add the SDK dependency.
Replace the raw HTTP fetch with @tago-io/sdk, resolving each serial to a device token and forwarding the hex payload with Device.sendData. After every uplink, read a pending "downlink" configuration parameter and write its bytes back on the same socket for Class A devices. Refactor the frame splitter to a functional factory and warn when a connection closes on an unterminated frame.
Rewrite the README around the SDK uplink, the Class A downlink, and pnpm commands, with troubleshooting for port mapping, missing delimiters, and netcat availability. Add examples/payload-parser.js decoding temperature and humidity for the Connector.
Device-provided values (serial, frame) were interpolated into the console format string, which CodeQL flagged as a format-string injection. Pass them as %s/%d arguments instead so format specifiers in device data are not evaluated.
Drop the connection when a frame exceeds MAX_FRAME_LENGTH so a peer that never sends the delimiter can no longer grow the buffer until the process runs out of memory. Decode the delimiter to a string and split on it directly, removing the redundant Buffer round-trip in the splitter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does PR do?
Modernizes the TagoIO TCP middleware example so users can clone, configure, and deploy their own connector middleware without fighting an outdated codebase. Closes the self-service refactor requested in the issue and adds SDK-based uplink plus Class A downlink as a realistic reference.
📦 Dependencies & runtime
@tago-io/sdk(^12.2.2); targets Node.js 24📡 SDK-based uplink
Network.resolveToken) and forwards the hex payload viaDevice.sendData📥 Class A downlink over TCP
downlinkConfiguration Parameter (sent !== true)🧩 Connector example
examples/payload-parser.jsdecodingtemperatureandhumidity, with two matching test frames documented end to end🛠️ Process management & containerization
📚 Documentation
✅ Acceptance criteria (issue)
docker build/docker runbring it up with env-based configurationType of alteration