From cae0580609ebe1e2ac3fdcec54c6111e07cc7746 Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 7 Mar 2026 15:51:29 +0000 Subject: [PATCH] Support multibyte path hashes across live pathing --- backend/package-lock.json | 1855 +++++++++++++++++ backend/package.json | 2 +- backend/src/db/index.ts | 9 +- backend/src/health/status.ts | 58 +- backend/src/mqtt/client.ts | 81 +- backend/src/mqtt/decodePacket.ts | 86 + backend/src/path-beta/resolver.ts | 84 +- backend/src/path-hash/utils.ts | 71 + backend/src/path-learning/rebuild.ts | 34 +- backend/src/types/index.ts | 2 +- backend/src/workers/path-sim.ts | 36 +- .../src/components/app/DisclaimerModal.tsx | 9 +- frontend/src/hooks/useNodes.ts | 42 +- frontend/src/pages/HealthPage.tsx | 37 + viewshed-worker/worker.py | 20 +- 15 files changed, 2313 insertions(+), 113 deletions(-) create mode 100644 backend/package-lock.json create mode 100644 backend/src/mqtt/decodePacket.ts create mode 100644 backend/src/path-hash/utils.ts diff --git a/backend/package-lock.json b/backend/package-lock.json new file mode 100644 index 0000000..a1c9dc2 --- /dev/null +++ b/backend/package-lock.json @@ -0,0 +1,1855 @@ +{ + "name": "meshcore-analytics-backend", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "meshcore-analytics-backend", + "version": "1.0.0", + "dependencies": { + "@michaelhart/meshcore-decoder": "^0.2.7", + "cors": "^2.8.5", + "express": "^4.19.2", + "express-rate-limit": "^7.4.1", + "ioredis": "^5.4.1", + "mqtt": "^5.10.1", + "pg": "^8.13.1", + "ws": "^8.18.0" + }, + "devDependencies": { + "@types/cors": "^2.8.17", + "@types/express": "^4.17.21", + "@types/node": "^20.17.6", + "@types/pg": "^8.11.10", + "@types/ws": "^8.5.12", + "tsx": "^4.19.1", + "typescript": "^5.6.3" + } + }, + "node_modules/@babel/runtime": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz", + "integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@ioredis/commands": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.5.1.tgz", + "integrity": "sha512-JH8ZL/ywcJyR9MmJ5BNqZllXNZQqQbnVZOqpPQqE1vHiFgAw4NHbvE0FOduNU8IX9babitBT46571OnPTT0Zcw==" + }, + "node_modules/@michaelhart/meshcore-decoder": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@michaelhart/meshcore-decoder/-/meshcore-decoder-0.2.7.tgz", + "integrity": "sha512-a3zNbqeACibYy7XlMx6F2fMfg8FT+mP7lcYCmr8EvQk2MvBw7Qs7+bV2DAnwTf+51IRZqFEPCq55GB0scsw1WA==", + "dependencies": { + "@noble/ed25519": "^2.3.0", + "chalk": "^4.1.2", + "commander": "^12.0.0", + "crypto-js": "^4.2.0" + }, + "bin": { + "meshcore-decoder": "dist/cli.js" + } + }, + "node_modules/@noble/ed25519": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-2.3.0.tgz", + "integrity": "sha512-M7dvXL2B92/M7dw9+gzuydL8qn/jiqNHaoR3Q+cb1q1GHV7uwE17WCyFMG+Y+TZb5izcaXk5TdJRrDUxHXL78A==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.6", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", + "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.25", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.25.tgz", + "integrity": "sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==", + "dev": true, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "^1" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.8", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.8.tgz", + "integrity": "sha512-02S5fmqeoKzVZCHPZid4b8JH2eM5HzQLZWN2FohQEy/0eXTq8VXZfSN6Pcr3F6N9R/vNrj7cpgbhjie6m/1tCA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", + "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", + "dev": true + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.19.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.35.tgz", + "integrity": "sha512-Uarfe6J91b9HAUXxjvSOdiO2UPOKLm07Q1oh0JHxoZ1y8HoqxDAu3gVrsrOHeiio0kSsoVBt4wFrKOm0dKxVPQ==", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/pg": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.18.0.tgz", + "integrity": "sha512-gT+oueVQkqnj6ajGJXblFR4iavIXWsGAFCk3dP4Kki5+a9R4NMt0JARdk6s8cUKcfUoqP5dAtDSLU8xYUTFV+Q==", + "dev": true, + "dependencies": { + "@types/node": "*", + "pg-protocol": "*", + "pg-types": "^2.2.0" + } + }, + "node_modules/@types/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", + "dev": true + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true + }, + "node_modules/@types/readable-stream": { + "version": "4.0.23", + "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.23.tgz", + "integrity": "sha512-wwXrtQvbMHxCbBgjHaMGEmImFTQxxpfMOR/ZoQnXxB1woqkUbdLGFDgauo00Py9IudiaqSeiBiulSV9i6XIPig==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", + "integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.10", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.10.tgz", + "integrity": "sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw==", + "dev": true, + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "<1" + } + }, + "node_modules/@types/serve-static/node_modules/@types/send": { + "version": "0.17.6", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.6.tgz", + "integrity": "sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==", + "dev": true, + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bl": { + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/bl/-/bl-6.1.6.tgz", + "integrity": "sha512-jLsPgN/YSvPUg9UX0Kd73CXpm2Psg9FxMeCSXnk3WBO3CMT10JMwijubhGfHCnFu6TPn1ei3b975dxv7K2pWVg==", + "dependencies": { + "@types/readable-stream": "^4.0.0", + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^4.2.0" + } + }, + "node_modules/body-parser": { + "version": "1.20.4", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz", + "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.14.0", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/broker-factory": { + "version": "3.1.13", + "resolved": "https://registry.npmjs.org/broker-factory/-/broker-factory-3.1.13.tgz", + "integrity": "sha512-H2VALe31mEtO/SRcNp4cUU5BAm1biwhc/JaF77AigUuni/1YT0FLCJfbUxwIEs9y6Kssjk2fmXgf+Y9ALvmKlw==", + "dependencies": { + "@babel/runtime": "^7.28.6", + "fast-unique-numbers": "^9.0.26", + "tslib": "^2.8.1", + "worker-factory": "^7.0.48" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cluster-key-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", + "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "engines": { + "node": ">=18" + } + }, + "node_modules/commist": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/commist/-/commist-3.2.0.tgz", + "integrity": "sha512-4PIMoPniho+LqXmpS5d3NuGYncG6XWlkBSVGiWycL22dd42OYdUGil2CWuzklaJoNxyxUSpO4MKIBU94viWNAw==" + }, + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/concat-stream/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==" + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/express": { + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz", + "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.3", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.14.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", + "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/fast-unique-numbers": { + "version": "9.0.26", + "resolved": "https://registry.npmjs.org/fast-unique-numbers/-/fast-unique-numbers-9.0.26.tgz", + "integrity": "sha512-3Mtq8p1zQinjGyWfKeuBunbuFoixG72AUkk4VvzbX4ykCW9Q4FzRaNyIlfQhUjnKw2ARVP+/CKnoyr6wfHftig==", + "dependencies": { + "@babel/runtime": "^7.28.6", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=18.2.0" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/help-me": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", + "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==" + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ioredis": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.10.0.tgz", + "integrity": "sha512-HVBe9OFuqs+Z6n64q09PQvP1/R4Bm+30PAyyD4wIEqssh3v9L21QjCVk4kRLucMBcDokJTcLjsGeVRlq/nH6DA==", + "dependencies": { + "@ioredis/commands": "1.5.1", + "cluster-key-slot": "^1.1.0", + "debug": "^4.3.4", + "denque": "^2.1.0", + "lodash.defaults": "^4.2.0", + "lodash.isarguments": "^3.1.0", + "redis-errors": "^1.2.0", + "redis-parser": "^3.0.0", + "standard-as-callback": "^2.1.0" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ioredis" + } + }, + "node_modules/ioredis/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/ioredis/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/js-sdsl": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==" + }, + "node_modules/lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mqtt": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.15.0.tgz", + "integrity": "sha512-KC+wAssYk83Qu5bT8YDzDYgUJxPhbLeVsDvpY2QvL28PnXYJzC2WkKruyMUgBAZaQ7h9lo9k2g4neRNUUxzgMw==", + "dependencies": { + "@types/readable-stream": "^4.0.21", + "@types/ws": "^8.18.1", + "commist": "^3.2.0", + "concat-stream": "^2.0.0", + "debug": "^4.4.1", + "help-me": "^5.0.0", + "lru-cache": "^10.4.3", + "minimist": "^1.2.8", + "mqtt-packet": "^9.0.2", + "number-allocator": "^1.0.14", + "readable-stream": "^4.7.0", + "rfdc": "^1.4.1", + "socks": "^2.8.6", + "split2": "^4.2.0", + "worker-timers": "^8.0.23", + "ws": "^8.18.3" + }, + "bin": { + "mqtt": "build/bin/mqtt.js", + "mqtt_pub": "build/bin/pub.js", + "mqtt_sub": "build/bin/sub.js" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/mqtt-packet": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-9.0.2.tgz", + "integrity": "sha512-MvIY0B8/qjq7bKxdN1eD+nrljoeaai+qjLJgfRn3TiMuz0pamsIWY2bFODPZMSNmabsLANXsLl4EMoWvlaTZWA==", + "dependencies": { + "bl": "^6.0.8", + "debug": "^4.3.4", + "process-nextick-args": "^2.0.1" + } + }, + "node_modules/mqtt-packet/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mqtt-packet/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/mqtt/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mqtt/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/number-allocator": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/number-allocator/-/number-allocator-1.0.14.tgz", + "integrity": "sha512-OrL44UTVAvkKdOdRQZIJpLkAdjXGTRda052sN4sO77bKEzYYqWKMBjQvrJFzqygI99gL6Z4u2xctPW1tB8ErvA==", + "dependencies": { + "debug": "^4.3.1", + "js-sdsl": "4.3.0" + } + }, + "node_modules/number-allocator/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/number-allocator/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==" + }, + "node_modules/pg": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.19.0.tgz", + "integrity": "sha512-QIcLGi508BAHkQ3pJNptsFz5WQMlpGbuBGBaIaXsWK8mel2kQ/rThYI+DbgjUvZrIr7MiuEuc9LcChJoEZK1xQ==", + "dependencies": { + "pg-connection-string": "^2.11.0", + "pg-pool": "^3.12.0", + "pg-protocol": "^1.12.0", + "pg-types": "2.2.0", + "pgpass": "1.0.5" + }, + "engines": { + "node": ">= 16.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.3.0" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.3.0.tgz", + "integrity": "sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.11.0.tgz", + "integrity": "sha512-kecgoJwhOpxYU21rZjULrmrBJ698U2RxXofKVzOn5UDj61BPj/qMb7diYUR1nLScCDbrztQFl1TaQZT0t1EtzQ==" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.12.0.tgz", + "integrity": "sha512-eIJ0DES8BLaziFHW7VgJEBPi5hg3Nyng5iKpYtj3wbcAUV9A1wLgWiY7ajf/f/oO1wfxt83phXPY8Emztg7ITg==", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.12.0.tgz", + "integrity": "sha512-uOANXNRACNdElMXJ0tPz6RBM0XQ61nONGAwlt8da5zs/iUOOCLBQOHSXnrC6fMsvtjxbOJrZZl5IScGv+7mpbg==" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "dependencies": { + "split2": "^4.1.0" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz", + "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.14.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz", + "integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==", + "engines": { + "node": ">=4" + } + }, + "node_modules/redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==", + "dependencies": { + "redis-errors": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", + "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", + "dependencies": { + "ip-address": "^10.0.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/standard-as-callback": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz", + "integrity": "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==" + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/worker-factory": { + "version": "7.0.48", + "resolved": "https://registry.npmjs.org/worker-factory/-/worker-factory-7.0.48.tgz", + "integrity": "sha512-CGmBy3tJvpBPjUvb0t4PrpKubUsfkI1Ohg0/GGFU2RvA9j/tiVYwKU8O7yu7gH06YtzbeJLzdUR29lmZKn5pag==", + "dependencies": { + "@babel/runtime": "^7.28.6", + "fast-unique-numbers": "^9.0.26", + "tslib": "^2.8.1" + } + }, + "node_modules/worker-timers": { + "version": "8.0.30", + "resolved": "https://registry.npmjs.org/worker-timers/-/worker-timers-8.0.30.tgz", + "integrity": "sha512-8P7YoMHWN0Tz7mg+9oEhuZdjBIn2z6gfjlJqFcHiDd9no/oLnMGCARCDkV1LR3ccQus62ZdtIp7t3aTKrMLHOg==", + "dependencies": { + "@babel/runtime": "^7.28.6", + "tslib": "^2.8.1", + "worker-timers-broker": "^8.0.15", + "worker-timers-worker": "^9.0.13" + } + }, + "node_modules/worker-timers-broker": { + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/worker-timers-broker/-/worker-timers-broker-8.0.15.tgz", + "integrity": "sha512-Te+EiVUMzG5TtHdmaBZvBrZSFNauym6ImDaCAnzQUxvjnw+oGjMT2idmAOgDy30vOZMLejd0bcsc90Axu6XPWA==", + "dependencies": { + "@babel/runtime": "^7.28.6", + "broker-factory": "^3.1.13", + "fast-unique-numbers": "^9.0.26", + "tslib": "^2.8.1", + "worker-timers-worker": "^9.0.13" + } + }, + "node_modules/worker-timers-worker": { + "version": "9.0.13", + "resolved": "https://registry.npmjs.org/worker-timers-worker/-/worker-timers-worker-9.0.13.tgz", + "integrity": "sha512-qjn18szGb1kjcmh2traAdki1eiIS5ikFo+L90nfMOvSRpuDw1hAcR1nzkP2+Hkdqz5thIRnfuWx7QSpsEUsA6Q==", + "dependencies": { + "@babel/runtime": "^7.28.6", + "tslib": "^2.8.1", + "worker-factory": "^7.0.48" + } + }, + "node_modules/ws": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", + "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + } + } +} diff --git a/backend/package.json b/backend/package.json index 12d22f2..2b52531 100644 --- a/backend/package.json +++ b/backend/package.json @@ -9,7 +9,7 @@ "start": "node dist/index.js" }, "dependencies": { - "@michaelhart/meshcore-decoder": "^0.1.7", + "@michaelhart/meshcore-decoder": "^0.2.7", "cors": "^2.8.5", "express": "^4.19.2", "express-rate-limit": "^7.4.1", diff --git a/backend/src/db/index.ts b/backend/src/db/index.ts index 571e0ef..d966dca 100644 --- a/backend/src/db/index.ts +++ b/backend/src/db/index.ts @@ -137,7 +137,7 @@ export async function getRecentPackets(limit = 200) { export async function getLastNPackets(n: number, network?: string) { // DISTINCT ON deduplicates by hash (same packet heard by multiple observers), - // picking the most recent observation per hash within the last 24 hours. + // preferring the richest observation per hash within the last 24 hours. const nFilter = network ? 'AND network = $2' : ''; const params: unknown[] = network ? [n, network] : [n]; const res = await pool.query( @@ -146,7 +146,12 @@ export async function getLastNPackets(n: number, network?: string) { packet_type, hop_count, payload, advert_count, path_hashes FROM packets WHERE time > NOW() - INTERVAL '24 hours' ${nFilter} - ORDER BY packet_hash, time DESC + ORDER BY packet_hash, + CASE WHEN payload ? 'appData' THEN 1 ELSE 0 END DESC, + CASE WHEN src_node_id IS NOT NULL THEN 1 ELSE 0 END DESC, + CASE WHEN packet_type = 4 THEN 1 ELSE 0 END DESC, + CASE WHEN payload->>'direction' = 'tx' THEN 1 ELSE 0 END DESC, + time DESC ) deduped ORDER BY time DESC LIMIT $1`, params diff --git a/backend/src/health/status.ts b/backend/src/health/status.ts index 98bbed5..0df0302 100644 --- a/backend/src/health/status.ts +++ b/backend/src/health/status.ts @@ -221,7 +221,7 @@ export async function captureWorkerHealthSnapshot(): Promise { } export async function getWorkerHealthOverview() { - const [workers, history, errors1h, ingest] = await Promise.all([ + const [workers, history, errors1h, ingest, pathHashWidths, multibyteSummary] = await Promise.all([ currentWorkers(), query<{ ts: string; @@ -272,6 +272,38 @@ export async function getWorkerHealthOverview() { (SELECT MAX(time)::text FROM packets) AS global_last_packet_at FROM active_rx`, ), + query<{ + hash_hex_len: string; + hop_count: string; + }>( + `SELECT length(h)::text AS hash_hex_len, COUNT(*)::text AS hop_count + FROM packets p + CROSS JOIN LATERAL unnest(p.path_hashes) AS h + WHERE p.time > NOW() - INTERVAL '24 hours' + GROUP BY 1`, + ), + query<{ + latest_multibyte_at: string | null; + multibyte_packets_24h: string; + }>( + `SELECT + MAX(time) FILTER ( + WHERE EXISTS ( + SELECT 1 + FROM unnest(path_hashes) AS h + WHERE length(h) > 2 + ) + )::text AS latest_multibyte_at, + COUNT(*) FILTER ( + WHERE EXISTS ( + SELECT 1 + FROM unnest(path_hashes) AS h + WHERE length(h) > 2 + ) + )::text AS multibyte_packets_24h + FROM packets + WHERE time > NOW() - INTERVAL '24 hours'`, + ), ]); const ingestRow = ingest.rows[0]; @@ -279,6 +311,25 @@ export async function getWorkerHealthOverview() { const activeNodes = Number(ingestRow?.active_nodes ?? 0); const maxStaleMinutes = Number(ingestRow?.max_stale_minutes ?? 0); const staleThresholdMinutes = Number(ingestRow?.stale_threshold_minutes ?? 15); + const widthToBucket: Record = { + 2: 'one_byte', + 4: 'two_byte', + 6: 'three_byte', + }; + const pathHashStats = { + one_byte: 0, + two_byte: 0, + three_byte: 0, + }; + + for (const row of pathHashWidths.rows) { + const width = Number(row.hash_hex_len ?? 0); + const bucket = widthToBucket[width]; + if (!bucket) continue; + pathHashStats[bucket] += Number(row.hop_count ?? 0); + } + + const multibyteRow = multibyteSummary.rows[0]; return { system: systemStats(), @@ -292,5 +343,10 @@ export async function getWorkerHealthOverview() { stale_threshold_minutes: staleThresholdMinutes, global_last_packet_at: ingestRow?.global_last_packet_at ?? null, }, + path_hashes: { + last_24h_hops: pathHashStats, + multibyte_packets_24h: Number(multibyteRow?.multibyte_packets_24h ?? 0), + latest_multibyte_at: multibyteRow?.latest_multibyte_at ?? null, + }, }; } diff --git a/backend/src/mqtt/client.ts b/backend/src/mqtt/client.ts index e6925da..4400b2e 100644 --- a/backend/src/mqtt/client.ts +++ b/backend/src/mqtt/client.ts @@ -6,6 +6,7 @@ import type { } from '@michaelhart/meshcore-decoder'; import { insertPacket, upsertNode, incrementAdvertCount, query } from '../db/index.js'; import type { LivePacket } from '../types/index.js'; +import { decodePacketCompat } from './decodePacket.js'; type PacketCallback = (packet: LivePacket) => void; type NodeCallback = (nodeId: string) => void; @@ -127,7 +128,7 @@ const keyStore = MeshCoreDecoder.createKeyStore({ /** Identify which channel a GroupText was sent on by trying each single-key keyStore. */ function identifyChannel(rawHex: string): string | undefined { for (const entry of channelEntries) { - const d = MeshCoreDecoder.decode(rawHex, { keyStore: entry.keyStore }); + const { decoded: d } = decodePacketCompat(rawHex, entry.keyStore); const p = d?.payload?.decoded as GroupTextPayload | undefined; if (p?.decrypted) return entry.name; } @@ -176,6 +177,23 @@ function buildSummary(payloadType: number, decoded: unknown, rawHex?: string): s } } +function buildAdvertFallbackPayload(originId: string, originName?: string): Record { + const appData: Record = { + flags: 0, + deviceRole: 2, + hasLocation: false, + hasName: Boolean(originName), + }; + if (originName) appData['name'] = originName; + return { + type: 4, + version: 0, + isValid: false, + publicKey: originId, + appData, + }; +} + export function startMqttClient(): void { const brokerUrl = process.env['MQTT_BROKER_URL'] ?? 'ws://mosquitto:9001'; @@ -223,9 +241,10 @@ async function handleMessage(topic: string, rawPayload: Buffer): Promise { } // ── Status: update observer node metadata ───────────────────────────────── + const origin = json['origin'] as string | undefined; + const originId = json['origin_id'] as string | undefined; + if (suffix === 'status') { - const origin = json['origin'] as string | undefined; - const originId = json['origin_id'] as string | undefined; const model = json['model'] as string | undefined; const firmware = json['firmware_version'] as string | undefined; @@ -265,13 +284,13 @@ async function handleMessage(topic: string, rawPayload: Buffer): Promise { if (rawHex) { try { - const decoded = MeshCoreDecoder.decode(rawHex, { keyStore }); + const { decoded, pathHashes, pathHashCount } = decodePacketCompat(rawHex, keyStore); if (decoded) { decodedHash = decoded.messageHash; - decodedHops = decoded.pathLength; - if (decoded.path && Array.isArray(decoded.path) && decoded.path.length > 0) { - path = decoded.path as string[]; + decodedHops = pathHashCount ?? decoded.pathLength; + if (pathHashes && pathHashes.length > 0) { + path = pathHashes; } const decodedInner = decoded.payload?.decoded; @@ -330,6 +349,27 @@ async function handleMessage(topic: string, rawPayload: Buffer): Promise { } } + // MeshCore v1.14.0 multibyte-path adverts can currently reach us with packet_type=4 + // on the MQTT envelope while the community decoder still classifies the raw payload + // as another type. For self-originated TX adverts, use the MQTT origin metadata as a + // safe fallback so the repeater still appears correctly on the site. + const hasDecodedAdvertPayload = Boolean( + innerPayload + && typeof innerPayload === 'object' + && 'appData' in innerPayload + && srcNodeId + ); + const useTxAdvertFallback = direction === 'tx' + && packetType === 4 + && Boolean(originId) + && !hasDecodedAdvertPayload; + + if (useTxAdvertFallback && originId) { + srcNodeId = originId; + summary ??= origin; + innerPayload = buildAdvertFallbackPayload(originId, origin); + } + // Use decoder hash as primary key — it's derived from packet content and is the // same for TX and RX of the same packet, enabling frontend deduplication. // Fall back to mctomqtt hash (RX only) when decode fails, then UUID. @@ -340,6 +380,27 @@ async function handleMessage(topic: string, rawPayload: Buffer): Promise { void upsertNode(observerKey, { iata, network }); emitNode(observerKey); + if (useTxAdvertFallback && originId) { + await upsertNode(originId, { + name: origin, + iata, + publicKey: originId, + network, + }); + if (tryCountAdvert(finalHash)) { + advertCount = await incrementAdvertCount(originId); + } + emitNodeUpsert({ + node_id: originId, + name: origin, + iata, + public_key: originId, + last_seen: new Date().toISOString(), + is_online: true, + advert_count: advertCount, + }); + } + { const livePacket: LivePacket = { id: crypto.randomUUID(), @@ -401,9 +462,9 @@ export async function backfillHistoricalLinks( let queued = 0; for (const row of res.rows) { try { - const decoded = MeshCoreDecoder.decode(row.raw_hex, { keyStore }); - if (decoded?.path && Array.isArray(decoded.path) && decoded.path.length > 0) { - queueFn(row.rx_node_id, row.src_node_id ?? undefined, decoded.path as string[], decoded.pathLength); + const compat = decodePacketCompat(row.raw_hex, keyStore); + if (compat.pathHashes && compat.pathHashes.length > 0) { + queueFn(row.rx_node_id, row.src_node_id ?? undefined, compat.pathHashes, compat.pathHashCount); queued++; } } catch { diff --git a/backend/src/mqtt/decodePacket.ts b/backend/src/mqtt/decodePacket.ts new file mode 100644 index 0000000..83eab82 --- /dev/null +++ b/backend/src/mqtt/decodePacket.ts @@ -0,0 +1,86 @@ +import { MeshCoreDecoder } from '@michaelhart/meshcore-decoder'; + +type KeyStore = ReturnType; + +type PathMeta = { + encodedLengthByte: number; + pathLengthOffset: number; + pathHashCount: number; + pathHashSize: number; + pathByteLength: number; + pathHashes: string[]; +}; + +export type CompatDecodedPacket = { + decoded: ReturnType; + pathHashes?: string[]; + pathHashCount?: number; + pathHashSize?: number; +}; + +function bytesToHex(bytes: Uint8Array): string { + return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('').toUpperCase(); +} + +function hexToBytes(rawHex: string): Uint8Array | null { + const hex = rawHex.trim(); + if (!hex || (hex.length % 2) !== 0 || !/^[0-9A-Fa-f]+$/.test(hex)) return null; + return Uint8Array.from(Buffer.from(hex, 'hex')); +} + +function parsePathMeta(rawHex: string): PathMeta | null { + const bytes = hexToBytes(rawHex); + if (!bytes || bytes.length < 2) return null; + + const routeType = bytes[0]! & 0x03; + let offset = 1; + if (routeType === 0 || routeType === 3) offset += 4; + if (bytes.length <= offset) return null; + + const encodedLengthByte = bytes[offset]!; + const pathHashCount = encodedLengthByte & 0x3f; + const pathHashSize = (encodedLengthByte >> 6) + 1; + if (pathHashSize > 3) return null; + + const pathByteLength = pathHashCount * pathHashSize; + const pathStart = offset + 1; + const pathEnd = pathStart + pathByteLength; + if (bytes.length < pathEnd) return null; + + const pathHashes: string[] = []; + for (let i = 0; i < pathHashCount; i++) { + const start = pathStart + (i * pathHashSize); + const end = start + pathHashSize; + pathHashes.push(bytesToHex(bytes.subarray(start, end))); + } + + return { + encodedLengthByte, + pathLengthOffset: offset, + pathHashCount, + pathHashSize, + pathByteLength, + pathHashes, + }; +} + +function buildCompatRawHex(rawHex: string, meta: PathMeta): string { + if (meta.encodedLengthByte < 64) return rawHex; + const bytes = hexToBytes(rawHex); + if (!bytes) return rawHex; + const compat = new Uint8Array(bytes); + compat[meta.pathLengthOffset] = meta.pathByteLength; + return bytesToHex(compat); +} + +export function decodePacketCompat(rawHex: string, keyStore: KeyStore): CompatDecodedPacket { + const meta = parsePathMeta(rawHex); + const compatRawHex = meta ? buildCompatRawHex(rawHex, meta) : rawHex; + const decoded = MeshCoreDecoder.decode(compatRawHex, { keyStore }); + return { + decoded, + pathHashes: meta?.pathHashes ?? (decoded.path as string[] | null) ?? undefined, + pathHashCount: meta?.pathHashCount ?? decoded.pathLength ?? undefined, + pathHashSize: meta?.pathHashSize ?? 1, + }; +} diff --git a/backend/src/path-beta/resolver.ts b/backend/src/path-beta/resolver.ts index d0a5031..4ed1c24 100644 --- a/backend/src/path-beta/resolver.ts +++ b/backend/src/path-beta/resolver.ts @@ -1,4 +1,11 @@ import { MIN_LINK_OBSERVATIONS, query } from '../db/index.js'; +import { + buildNodePathHashIndex, + countNodesForPathHash, + getNodesForPathHash, + nodePathHash, + normalizePathHash, +} from '../path-hash/utils.js'; type MeshNode = { node_id: string; @@ -371,14 +378,15 @@ function buildFallbackPrefixPath( const repeaters = Array.from(nodesById.values()).filter( (n) => hasCoords(n) && (n.role === null || n.role === 2), ); + const pathHashIndex = buildNodePathHashIndex(repeaters); const pickedNearRx: MeshNode[] = []; const visited = new Set([rx.node_id]); let prev = rx; for (const h of [...hopHashes].reverse()) { - const prefix = h.slice(0, 2).toUpperCase(); - const candidates = repeaters - .filter((n) => !visited.has(n.node_id) && n.node_id.slice(0, 2).toUpperCase() === prefix) + const prefix = normalizePathHash(h); + const candidates = getNodesForPathHash(pathHashIndex, prefix) + .filter((n) => !visited.has(n.node_id)) .sort((a, b) => { const score = (c: MeshNode) => { const distPenalty = distKm(c, prev) / 50; @@ -422,13 +430,7 @@ function enumeratePrefixContinuations( const candidates = Array.from(nodesById.values()).filter( (n) => hasCoords(n) && (n.role === null || n.role === 2), ); - const byPrefix = new Map(); - for (const n of candidates) { - const p = n.node_id.slice(0, 2).toUpperCase(); - const arr = byPrefix.get(p); - if (arr) arr.push(n); - else byPrefix.set(p, [n]); - } + const pathHashIndex = buildNodePathHashIndex(candidates); const start = nodesById.get(startNodeId); const end = nodesById.get(endNodeId); @@ -482,8 +484,8 @@ function enumeratePrefixContinuations( return; } - const prefix = remainingPrefixes[idx]!.slice(0, 2).toUpperCase(); - const nodesForPrefix = (byPrefix.get(prefix) ?? []) + const prefix = normalizePathHash(remainingPrefixes[idx]); + const nodesForPrefix = getNodesForPathHash(pathHashIndex, prefix) .filter((n) => !visited.has(n.node_id) && !blocked.has(n.node_id) && n.node_id !== end.node_id && distKm(n, current) <= MAX_PERMUTATION_HOP_KM) .sort((a, b) => distKm(a, current) - distKm(b, current)); if (nodesForPrefix.length < 1) { @@ -544,8 +546,9 @@ function resolveBetaPath( context: BetaResolveContext, options?: { forceIncludeSource?: boolean; disableSourcePrepend?: boolean; blockedNodeIds?: string[] }, ): { path: [number, number][]; confidence: number; segmentConfidence: number[]; nodeIds: string[] } | null { - if (!hasCoords(rx) || pathHashes.length === 0) return null; - if (pathHashes.length >= MAX_BETA_HOPS) return null; + const normalizedHashes = pathHashes.map(normalizePathHash).filter(Boolean); + if (!hasCoords(rx) || normalizedHashes.length === 0) return null; + if (normalizedHashes.length >= MAX_BETA_HOPS) return null; const rxLat = rx.lat!; const rxLon = rx.lon!; @@ -554,16 +557,7 @@ function resolveBetaPath( const candidatesPool = Array.from(context.nodesById.values()).filter( (n) => hasCoords(n) && (n.role === null || n.role === 2) && !blockedNodeIds.has(n.node_id), ); - - const prefixCounts = new Map(); - const prefixBuckets = new Map(); - for (const n of candidatesPool) { - const p = n.node_id.slice(0, 2).toUpperCase(); - prefixCounts.set(p, (prefixCounts.get(p) ?? 0) + 1); - const existing = prefixBuckets.get(p); - if (existing) existing.push(n); - else prefixBuckets.set(p, [n]); - } + const pathHashIndex = buildNodePathHashIndex(candidatesPool); const totalDist = hasCoords(src) ? distKm(src, rx) : 0; const corridorMaxKm = Math.max(10, Math.min(80, totalDist * 0.35)); @@ -652,9 +646,8 @@ function resolveBetaPath( return null; } - function localPrefixAmbiguityPenalty(candidate: MeshNode, prevNode: MeshNode): number { - const prefix = candidate.node_id.slice(0, 2).toUpperCase(); - const peers = prefixBuckets.get(prefix) ?? []; + function localPrefixAmbiguityPenalty(candidate: MeshNode, prevNode: MeshNode, pathHash: string): number { + const peers = getNodesForPathHash(pathHashIndex, pathHash); if (peers.length <= 1) return 0; const inRangeKm = Math.max(PREFIX_AMBIGUITY_FLOOR_KM, nodeRange(candidate.node_id, context.coverageByNode), nodeRange(prevNode.node_id, context.coverageByNode)); @@ -677,9 +670,8 @@ function resolveBetaPath( return clamp(localPenalty + hopPenalty, 0, 0.30); } - function clashPressure(candidate: MeshNode): number { - const prefix = candidate.node_id.slice(0, 2).toUpperCase(); - const peers = prefixBuckets.get(prefix) ?? []; + function clashPressure(candidate: MeshNode, pathHash: string): number { + const peers = getNodesForPathHash(pathHashIndex, pathHash); if (peers.length <= 1) return 0; let raw = 0; for (const peer of peers) { @@ -691,7 +683,7 @@ function resolveBetaPath( return clamp(raw / 3, 0, 1); } - function inCorridor(candidate: MeshNode, prevNode: MeshNode): boolean { + function inCorridor(candidate: MeshNode, prevNode: MeshNode, pathHash: string): boolean { if (!hasCoords(src)) return true; const bx = src.lon! - rxLon; const by = src.lat! - rxLat; @@ -700,7 +692,7 @@ function resolveBetaPath( const px = candidate.lon! - rxLon; const py = candidate.lat! - rxLat; const t = (px * bx + py * by) / segLen2; - const pressure = clashPressure(candidate); + const pressure = clashPressure(candidate, pathHash); const tPadding = 0.15 + (1 - pressure) * 0.15; if (t < -tPadding || t > 1 + tPadding) return false; @@ -718,7 +710,7 @@ function resolveBetaPath( } function getCandidates(prefix: string, prevPrefix: string, prevNode: MeshNode, nextTowardRx: string | null): Array<{ node: MeshNode; conf: number }> { - const all = candidatesPool.filter((n) => n.node_id.toUpperCase().startsWith(prefix)); + const all = getNodesForPathHash(pathHashIndex, prefix); if (all.length === 0) return []; function align(c: MeshNode): number { @@ -733,7 +725,7 @@ function resolveBetaPath( } function sortScore(c: MeshNode): number { - const corridorBonus = inCorridor(c, prevNode) ? 0.25 : -0.6; + const corridorBonus = inCorridor(c, prevNode, prefix) ? 0.25 : -0.6; return align(c) - distKm(c, prevNode) / 50 + corridorBonus; } @@ -760,7 +752,7 @@ function resolveBetaPath( const motifBoost = motifPrior([c.node_id, prevNode.node_id]) * 0.2 + (nextTowardRx ? motifPrior([c.node_id, prevNode.node_id, nextTowardRx]) * 0.25 : 0); const edgeBoost = edgePrior(c.node_id, prevNode.node_id) * 0.3; - const ambiguityPenalty = localPrefixAmbiguityPenalty(c, prevNode); + const ambiguityPenalty = localPrefixAmbiguityPenalty(c, prevNode, prefix); const confirmedFloor = strongConfirmedFloor(meta); const baseConf = confirmedLinkConfidence(meta, c.node_id, prevNode.node_id, { prefix: priorBoost, @@ -775,7 +767,7 @@ function resolveBetaPath( const reachable = all .filter((c) => { if (usedIds.has(c.node_id)) return false; - if (!inCorridor(c, prevNode)) return false; + if (!inCorridor(c, prevNode, prefix)) return false; const meta = context.linkMetrics.get(linkKey(c.node_id, prevNode.node_id)); const reachOk = canReach(c, prevNode, context.coverageByNode); const losOk = hasLoS(c, prevNode); @@ -792,7 +784,7 @@ function resolveBetaPath( const motifBoost = motifPrior([c.node_id, prevNode.node_id]) * 0.18 + (nextTowardRx ? motifPrior([c.node_id, prevNode.node_id, nextTowardRx]) * 0.2 : 0); const edgeBoost = edgePrior(c.node_id, prevNode.node_id) * 0.28; - const ambiguityPenalty = localPrefixAmbiguityPenalty(c, prevNode); + const ambiguityPenalty = localPrefixAmbiguityPenalty(c, prevNode, prefix); return { node: c, conf: Math.max(0.08, 0.2 + prior * 0.34 + prefixBoost + transitionBoost + motifBoost + edgeBoost - distancePenalty - ambiguityPenalty - (all.length - 1) * 0.01), @@ -802,7 +794,7 @@ function resolveBetaPath( const fallback = all .filter((c) => { if (usedIds.has(c.node_id)) return false; - if (!inCorridor(c, prevNode)) return false; + if (!inCorridor(c, prevNode, prefix)) return false; if (distKm(c, prevNode) >= MAX_HOP_KM * 0.5) return false; const meta = context.linkMetrics.get(linkKey(c.node_id, prevNode.node_id)); return hasLoS(c, prevNode) || isWeakOrBetter(meta); @@ -815,7 +807,7 @@ function resolveBetaPath( const transitionBoost = transitionPrior(c.node_id, prevNode.node_id) * 0.16; const motifBoost = motifPrior([c.node_id, prevNode.node_id]) * 0.12; const edgeBoost = edgePrior(c.node_id, prevNode.node_id) * 0.18; - const ambiguityPenalty = localPrefixAmbiguityPenalty(c, prevNode); + const ambiguityPenalty = localPrefixAmbiguityPenalty(c, prevNode, prefix); return { node: c, conf: Math.max(0.03, 0.04 + prior * 0.2 + prefixBoost + transitionBoost + motifBoost + edgeBoost - ambiguityPenalty) / Math.max(1, all.length), @@ -825,15 +817,15 @@ function resolveBetaPath( return [...confirmed, ...reachable, ...fallback]; } - const ambiguity = pathHashes.reduce((sum, h) => sum + (prefixCounts.get(h.slice(0, 2).toUpperCase()) ?? 0), 0); - let budget = Math.max(3_000, Math.min(308_232, 1_000 + pathHashes.length * 3_000 + ambiguity * 800)); + const ambiguity = normalizedHashes.reduce((sum, h) => sum + countNodesForPathHash(pathHashIndex, h), 0); + let budget = Math.max(3_000, Math.min(308_232, 1_000 + normalizedHashes.length * 3_000 + ambiguity * 800)); function solve(hopIdx: number, prevNode: MeshNode, nextTowardRx: string | null, visited: Set): HopResult[] | null { if (hopIdx < 0) return []; if (--budget <= 0) return null; - const prefix = pathHashes[hopIdx]!.slice(0, 2).toUpperCase(); - const prevPrefix = hopIdx > 0 ? pathHashes[hopIdx - 1]!.slice(0, 2).toUpperCase() : ''; + const prefix = normalizedHashes[hopIdx]!; + const prevPrefix = hopIdx > 0 ? normalizedHashes[hopIdx - 1]! : ''; const options = getCandidates(prefix, prevPrefix, prevNode, nextTowardRx).filter((o) => !visited.has(o.node.node_id)); for (const opt of options) { @@ -845,7 +837,7 @@ function resolveBetaPath( return null; } - const raw = solve(pathHashes.length - 1, rx, null, new Set([rx.node_id])); + const raw = solve(normalizedHashes.length - 1, rx, null, new Set([rx.node_id])); if (!raw) return null; const hops = [...raw].reverse(); @@ -858,8 +850,8 @@ function resolveBetaPath( const calibratedConfidence = rawConfidence * context.learningModel.confidenceScale + context.learningModel.confidenceBias; const confidence = clamp(calibratedConfidence, 0, 1); - const srcPrefix = hasCoords(src) ? src.node_id.slice(0, 2).toUpperCase() : null; - const firstHopPrefix = pathHashes[0]?.slice(0, 2).toUpperCase() ?? null; + const firstHopPrefix = normalizedHashes[0] ?? null; + const srcPrefix = hasCoords(src) && firstHopPrefix ? nodePathHash(src.node_id, firstHopPrefix) : null; const prependSource = options?.disableSourcePrepend ? false : Boolean(options?.forceIncludeSource diff --git a/backend/src/path-hash/utils.ts b/backend/src/path-hash/utils.ts new file mode 100644 index 0000000..42a910a --- /dev/null +++ b/backend/src/path-hash/utils.ts @@ -0,0 +1,71 @@ +type NodeWithId = { + node_id: string; +}; + +export type NodePathHashIndex = Map; + +export const SUPPORTED_PATH_HASH_HEX_LENGTHS = [2, 4, 6] as const; + +export function normalizePathHash(pathHash: string | null | undefined): string { + return String(pathHash ?? '').trim().toUpperCase(); +} + +export function nodePathHash(nodeId: string, pathHashOrLength: string | number): string { + const length = typeof pathHashOrLength === 'number' + ? pathHashOrLength + : normalizePathHash(pathHashOrLength).length; + if (!Number.isFinite(length) || length <= 0) return ''; + return nodeId.slice(0, length).toUpperCase(); +} + +export function nodeMatchesPathHash(nodeId: string, pathHash: string | null | undefined): boolean { + const normalized = normalizePathHash(pathHash); + return normalized.length > 0 && nodeId.toUpperCase().startsWith(normalized); +} + +export function collectPathHashLengths(pathHashes: Iterable): number[] { + const lengths = new Set(); + for (const pathHash of pathHashes) { + const normalized = normalizePathHash(pathHash); + if (normalized.length > 0) lengths.add(normalized.length); + } + return Array.from(lengths).sort((a, b) => a - b); +} + +export function buildNodePathHashIndex( + nodes: Iterable, + hashLengths: Iterable = SUPPORTED_PATH_HASH_HEX_LENGTHS, +): NodePathHashIndex { + const index: NodePathHashIndex = new Map(); + const lengths = Array.from(new Set( + Array.from(hashLengths) + .map((length) => Number(length)) + .filter((length) => Number.isInteger(length) && length > 0), + )).sort((a, b) => a - b); + + for (const node of nodes) { + for (const length of lengths) { + if (node.node_id.length < length) continue; + const key = nodePathHash(node.node_id, length); + const bucket = index.get(key); + if (bucket) bucket.push(node); + else index.set(key, [node]); + } + } + + return index; +} + +export function getNodesForPathHash( + index: NodePathHashIndex, + pathHash: string | null | undefined, +): T[] { + return index.get(normalizePathHash(pathHash)) ?? []; +} + +export function countNodesForPathHash( + index: NodePathHashIndex, + pathHash: string | null | undefined, +): number { + return getNodesForPathHash(index, pathHash).length; +} diff --git a/backend/src/path-learning/rebuild.ts b/backend/src/path-learning/rebuild.ts index 9354b1a..0f5875e 100644 --- a/backend/src/path-learning/rebuild.ts +++ b/backend/src/path-learning/rebuild.ts @@ -1,4 +1,10 @@ import { MIN_LINK_OBSERVATIONS, query } from '../db/index.js'; +import { + buildNodePathHashIndex, + getNodesForPathHash, + nodePathHash, + normalizePathHash, +} from '../path-hash/utils.js'; type LearningNode = { node_id: string; @@ -74,10 +80,10 @@ function recencyScore(lastSeenMs: number | undefined, nowMs: number): number { function localPrefixAmbiguityPenalty( anchor: LearningNode, target: LearningNode, - prefixMap: Map, + pathHash: string, + pathHashIndex: Map, ): number { - const prefix = target.node_id.slice(0, 2).toUpperCase(); - const samePrefixNodes = prefixMap.get(prefix) ?? []; + const samePrefixNodes = getNodesForPathHash(pathHashIndex, pathHash); if (samePrefixNodes.length <= 1) return 0; const targetDist = distKm(anchor, target); @@ -99,7 +105,7 @@ function resolvePathForPacket( pathHashes: string[], srcNode: LearningNode | undefined, rxNode: LearningNode, - prefixMap: Map, + pathHashIndex: Map, confirmedLinks: Set, ): ResolvedHop[] { const resolved: ResolvedHop[] = []; @@ -107,8 +113,8 @@ function resolvePathForPacket( let prev = rxNode; for (let i = pathHashes.length - 1; i >= 0; i--) { - const prefix = pathHashes[i]!.slice(0, 2).toUpperCase(); - const candidates = (prefixMap.get(prefix) ?? []).filter((n) => !visited.has(n.node_id)); + const prefix = normalizePathHash(pathHashes[i]); + const candidates = getNodesForPathHash(pathHashIndex, prefix).filter((n) => !visited.has(n.node_id)); if (candidates.length === 0) continue; let best: LearningNode | null = null; @@ -118,7 +124,7 @@ function resolvePathForPacket( const confirmed = confirmedLinks.has(linkKey(candidate.node_id, prev.node_id)) ? 1 : 0; const distanceScore = distancePrior(candidate, prev); const srcScore = srcNode ? (distKm(srcNode, prev) - distKm(srcNode, candidate)) / 100 : 0; - const ambiguityPenalty = localPrefixAmbiguityPenalty(prev, candidate, prefixMap); + const ambiguityPenalty = localPrefixAmbiguityPenalty(prev, candidate, prefix, pathHashIndex); const score = confirmed * 2.5 + distanceScore * 1.3 + srcScore - ambiguityPenalty; if (score > bestScore) { best = candidate; @@ -213,13 +219,7 @@ async function rebuildNetwork(modelNetwork: string, sourceNetwork: string | unde ); const nodesById = new Map(nodesResult.rows.map((n) => [n.node_id, n])); - const prefixMap = new Map(); - for (const node of nodesResult.rows) { - const prefix = node.node_id.slice(0, 2).toUpperCase(); - const existing = prefixMap.get(prefix); - if (existing) existing.push(node); - else prefixMap.set(prefix, [node]); - } + const pathHashIndex = buildNodePathHashIndex(nodesResult.rows); const linksResult = await query( `SELECT nl.node_a_id, nl.node_b_id, nl.itm_path_loss_db, nl.count_a_to_b, nl.count_b_to_a @@ -273,14 +273,14 @@ async function rebuildNetwork(modelNetwork: string, sourceNetwork: string | unde let confidenceSum = 0; for (const packet of packetsResult.rows) { - const hashes = packet.path_hashes?.map((h) => h.slice(0, 2).toUpperCase()) ?? []; + const hashes = packet.path_hashes?.map(normalizePathHash).filter(Boolean) ?? []; if (hashes.length === 0) continue; const rx = nodesById.get(packet.rx_node_id); if (!rx) continue; const src = packet.src_node_id ? nodesById.get(packet.src_node_id) : undefined; const region = rx.iata ?? 'unknown'; - const resolved = resolvePathForPacket(hashes, src, rx, prefixMap, confirmedLinks); + const resolved = resolvePathForPacket(hashes, src, rx, pathHashIndex, confirmedLinks); if (resolved.length === 0) continue; const ts = new Date(packet.time); @@ -429,7 +429,7 @@ async function rebuildNetwork(modelNetwork: string, sourceNetwork: string | unde const dKm = distKm(fromNode, toNode); if (dKm > 55 && pathLoss > 150) consistencyPenalty += 0.14; } - consistencyPenalty += localPrefixAmbiguityPenalty(fromNode, toNode, prefixMap); + consistencyPenalty += localPrefixAmbiguityPenalty(fromNode, toNode, nodePathHash(toNode.node_id, 2), pathHashIndex); } if (observed < 3 && missing >= 3) consistencyPenalty += 0.1; if (directional < 0.06 && observed >= 5) consistencyPenalty += 0.06; diff --git a/backend/src/types/index.ts b/backend/src/types/index.ts index 18dd328..d54877c 100644 --- a/backend/src/types/index.ts +++ b/backend/src/types/index.ts @@ -58,7 +58,7 @@ export interface LivePacket { direction?: string; // 'rx' | 'tx' from mctomqtt summary?: string; // human-readable decoded content payload?: Record; - path?: string[]; // relay node 2-char hex prefixes in hop order + path?: string[]; // relay hop hashes in packet order (1/2/3-byte => 2/4/6 hex chars) advertCount?: number; // for Advert packets: persistent DB count after this event ts: number; } diff --git a/backend/src/workers/path-sim.ts b/backend/src/workers/path-sim.ts index 3f1128d..d1bb5d8 100644 --- a/backend/src/workers/path-sim.ts +++ b/backend/src/workers/path-sim.ts @@ -1,5 +1,12 @@ import 'node:process'; import { initDb, query } from '../db/index.js'; +import { + buildNodePathHashIndex, + countNodesForPathHash, + getNodesForPathHash, + nodeMatchesPathHash, + normalizePathHash, +} from '../path-hash/utils.js'; const RUN_INTERVAL_MS = Number(process.env['PATH_SIM_INTERVAL_MS'] ?? 6 * 60 * 60 * 1000); const PERM_BUCKET_CAP = Number(process.env['PATH_SIM_PERM_BUCKET_CAP'] ?? 50); @@ -274,14 +281,14 @@ function lookupCalibration(model: LearningModel, network: string): { scale: numb function localHexClashPenalty( candidate: SimNode, current: SimNode, + pathHash: string, prefixCounts: Map, byPrefix: Map, weakAdjacency: Map>, ): number { - const prefix = candidate.node_id.slice(0, 2).toUpperCase(); - const total = prefixCounts.get(prefix) ?? 0; + const total = prefixCounts.get(pathHash) ?? 0; if (total <= 1) return 0; - const peers = byPrefix.get(prefix) ?? []; + const peers = byPrefix.get(pathHash) ?? []; let raw = 0; const inRangeKm = 75; for (const peer of peers) { @@ -316,7 +323,7 @@ function scoreCandidate(ctx: CandidateScoreContext, prefixCounts: Map 145 ? 0.12 : 0; @@ -350,11 +357,11 @@ function getCandidatesForPrefix( receiverRegion: string, hourBucket: number, ): Array<{ node: SimNode; conf: number }> { - const pool = context.byPrefix.get(prefix) ?? []; + const pool = getNodesForPathHash(context.byPrefix, prefix); const scored: Array<{ node: SimNode; conf: number }> = []; for (const node of pool) { if (visited.has(node.node_id)) continue; - if (node.node_id === srcNodeId && prefix !== srcNodeId.slice(0, 2).toUpperCase()) continue; + if (node.node_id === srcNodeId && !nodeMatchesPathHash(srcNodeId, prefix)) continue; const d = distKm(node, current); if (d > strategy.maxHopKm) continue; const conf = scoreCandidate({ @@ -396,7 +403,7 @@ function enumerateContinuationsMl( return { fullCount: 0, partialCount: 0, longestPrefixDepth: 0, truncated: false, bestConfidence: 0 }; } - const prefixes = pathHashes.map((h) => h.slice(0, 2).toUpperCase()); + const prefixes = pathHashes.map(normalizePathHash).filter(Boolean); const receiverRegion = rx.iata ?? 'unknown'; const hourBucket = currentHourBucket(packetTime, context.config); const calibration = lookupCalibration(context.model, packetNetwork); @@ -500,16 +507,13 @@ async function loadNodes(): Promise<{ byId: Map; byPrefix: Map< ); const byId = new Map(); - const byPrefix = new Map(); - const prefixCounts = new Map(); for (const row of nodeRows.rows) { byId.set(row.node_id, row); - const prefix = row.node_id.slice(0, 2).toUpperCase(); - const arr = byPrefix.get(prefix); - if (arr) arr.push(row); - else byPrefix.set(prefix, [row]); - prefixCounts.set(prefix, (prefixCounts.get(prefix) ?? 0) + 1); } + const byPrefix = buildNodePathHashIndex(nodeRows.rows); + const prefixCounts = new Map( + Array.from(byPrefix.entries()).map(([prefix, nodes]) => [prefix, nodes.length]), + ); return { byId, byPrefix, prefixCounts }; } @@ -824,7 +828,7 @@ async function runOnce( bump(packetTypeTotals, String(row.packet_type ?? -1)); const rx = row.rx_node_id ? context.byId.get(row.rx_node_id) : undefined; const src = row.src_node_id ? context.byId.get(row.src_node_id) : undefined; - const hashes = row.path_hashes ?? []; + const hashes = row.path_hashes?.map(normalizePathHash).filter(Boolean) ?? []; const hops = row.hop_count != null ? hashes.slice(0, Math.max(0, row.hop_count)) : hashes; const isDirectNoPath = hops.length === 0 && row.hop_count === 0; const packetNetwork = (row.network ?? NETWORK ?? 'teesside').trim().toLowerCase() || 'teesside'; @@ -838,7 +842,7 @@ async function runOnce( bump(skipReasons, 'no_path_hashes_for_multihop_or_unknown_hops'); continue; } - if (hops.length > 0 && hops.some((h) => !context.byPrefix.has(h.slice(0, 2).toUpperCase()))) { + if (hops.length > 0 && hops.some((h) => countNodesForPathHash(context.byPrefix, h) < 1)) { bump(skipReasons, 'unmapped_prefix_no_logged_repeater'); continue; } diff --git a/frontend/src/components/app/DisclaimerModal.tsx b/frontend/src/components/app/DisclaimerModal.tsx index 9c01baa..c2a8e9a 100644 --- a/frontend/src/components/app/DisclaimerModal.tsx +++ b/frontend/src/components/app/DisclaimerModal.tsx @@ -13,10 +13,11 @@ export const DisclaimerModal: React.FC = ({ onClose }) =>

Packet paths

The relay paths shown on this dashboard are a best estimate. MeshCore packets include - only the first 2 hex characters of each relay node's ID, so when resolving a path we - match those 2 characters against known nodes. If multiple nodes share the same prefix - the closest candidate is chosen, but the actual path the packet took may have been - different. + relay node ID hashes in the width chosen by the sending node. Depending on firmware and + settings that can be 1, 2, or 3 bytes per hop, so path resolution matches the exact + hash width present in the packet against known nodes. If multiple nodes still share the + same hash at that width, the closest or strongest candidate is chosen, but the actual + path the packet took may have been different.

diff --git a/frontend/src/hooks/useNodes.ts b/frontend/src/hooks/useNodes.ts index 054a98d..6813356 100644 --- a/frontend/src/hooks/useNodes.ts +++ b/frontend/src/hooks/useNodes.ts @@ -26,7 +26,7 @@ export interface LivePacketData { direction?: string; summary?: string; payload?: Record; - path?: string[]; // relay node 2-char hex prefixes in hop order + path?: string[]; // relay hop hashes in packet order (1/2/3-byte => 2/4/6 hex chars) advertCount?: number; // for Advert packets: persistent count from DB ts: number; } @@ -64,6 +64,18 @@ interface HashRecord { ts: number; } +function packetInfoScore(packet: Pick): number { + let score = 0; + if (packet.summary) score += 4; + if (packet.srcNodeId) score += 3; + if (packet.packetType === 4) score += 2; + else if (packet.packetType !== undefined) score += 1; + if (packet.hopCount !== undefined) score += 1; + if (packet.path && packet.path.length > 0) score += 1; + if ((packet.advertCount ?? 0) > 0) score += 1; + return score; +} + export function useNodes() { const [nodes, setNodes] = useState>(new Map()); const [packets, setPackets] = useState([]); @@ -106,9 +118,9 @@ export function useNodes() { for (const row of data.packets) { if (seen.has(row.packet_hash)) continue; seen.add(row.packet_hash); - // For Advert packets the payload stores the decoded inner payload with appData.name const appData = row.payload?.['appData'] as Record | undefined; - const summary = row.packet_type === 4 ? appData?.['name'] as string | undefined : undefined; + const summary = (appData?.['name'] as string | undefined) + ?? (row.payload?.['origin'] as string | undefined); initialPackets.push({ id: row.packet_hash, packetHash: row.packet_hash, @@ -134,12 +146,24 @@ export function useNodes() { if (idx >= 0) { // Known packet — increment count, bubble to top + const current = prev[idx]!; + const candidate: AggregatedPacket = { + ...current, + packetType: packet.packetType ?? current.packetType, + srcNodeId: packet.srcNodeId ?? current.srcNodeId, + summary: packet.summary ?? (packet.payload?.['origin'] as string | undefined) ?? current.summary, + hopCount: packet.hopCount ?? current.hopCount, + path: packet.path ?? current.path, + advertCount: Math.max(current.advertCount ?? 0, packet.advertCount ?? 0) || undefined, + rxCount: current.rxCount + (packet.direction !== 'tx' ? 1 : 0), + txCount: current.txCount + (packet.direction === 'tx' ? 1 : 0), + ts: packet.ts, + }; + const useCandidate = packetInfoScore(candidate) >= packetInfoScore(current); const entry: AggregatedPacket = { - ...prev[idx]!, - rxCount: prev[idx]!.rxCount + (packet.direction !== 'tx' ? 1 : 0), - txCount: prev[idx]!.txCount + (packet.direction === 'tx' ? 1 : 0), - // Adopt summary if we now have one and didn't before - summary: prev[idx]!.summary ?? packet.summary, + ...(useCandidate ? candidate : current), + rxCount: current.rxCount + (packet.direction !== 'tx' ? 1 : 0), + txCount: current.txCount + (packet.direction === 'tx' ? 1 : 0), ts: packet.ts, }; const next = prev.filter((_, i) => i !== idx); @@ -152,7 +176,7 @@ export function useNodes() { packetType: packet.packetType, rxNodeId: packet.rxNodeId, srcNodeId: packet.srcNodeId, - summary: packet.summary, + summary: packet.summary ?? (packet.payload?.['origin'] as string | undefined), hopCount: packet.hopCount, path: packet.path, rxCount: packet.direction !== 'tx' ? 1 : 0, diff --git a/frontend/src/pages/HealthPage.tsx b/frontend/src/pages/HealthPage.tsx index b3e2b76..6390140 100644 --- a/frontend/src/pages/HealthPage.tsx +++ b/frontend/src/pages/HealthPage.tsx @@ -33,6 +33,15 @@ type HealthPayload = { stale_threshold_minutes: number; global_last_packet_at: string | null; }; + path_hashes: { + last_24h_hops: { + one_byte: number; + two_byte: number; + three_byte: number; + }; + multibyte_packets_24h: number; + latest_multibyte_at: string | null; + }; }; function timeAgo(ts: string | null): string { @@ -192,6 +201,34 @@ export const HealthPage: React.FC = () => {
Disk{fmtGb(data?.system.disk.used_gb)} / {fmtGb(data?.system.disk.total_gb)}
+ +
+

Path Hashes

+
+
+ {fmtInt(data?.path_hashes.last_24h_hops.one_byte)} + 1-byte Hops (24h) +
+
+ {fmtInt(data?.path_hashes.last_24h_hops.two_byte)} + 2-byte Hops (24h) +
+
+ {fmtInt(data?.path_hashes.last_24h_hops.three_byte)} + 3-byte Hops (24h) +
+
+ {fmtInt(data?.path_hashes.multibyte_packets_24h)} + Multibyte Packets (24h) +
+
+
+
+ Latest Multibyte Packet + {data?.path_hashes.latest_multibyte_at ? timeAgo(data.path_hashes.latest_multibyte_at) : 'not seen yet'} +
+
+
); diff --git a/viewshed-worker/worker.py b/viewshed-worker/worker.py index 4b2dd72..e3bc88a 100644 --- a/viewshed-worker/worker.py +++ b/viewshed-worker/worker.py @@ -674,13 +674,19 @@ def process_link_job(db, r_client, job: dict): ((a['lon'] - b['lon']) * 111.32 * cos_m) ** 2 ) - def local_prefix_ambiguity_penalty(prefix: str, target_id: str, target_node: dict, anchor_node: dict, pool: list[tuple[str, dict]]) -> float: + def normalize_path_hash(value) -> str: + return str(value or '').strip().upper() + + def node_matches_path_hash(node_id: str, path_hash: str) -> bool: + return bool(path_hash) and node_id.upper().startswith(path_hash) + + def local_prefix_ambiguity_penalty(path_hash: str, target_id: str, target_node: dict, anchor_node: dict, pool: list[tuple[str, dict]]) -> float: target_dist = node_dist(target_node, anchor_node) raw = 0.0 for cand_id, cand_node in pool: if cand_id == target_id: continue - if not cand_id.upper().startswith(prefix): + if not node_matches_path_hash(cand_id, path_hash): continue cand_dist = node_dist(cand_node, anchor_node) if cand_dist > PREFIX_AMBIGUITY_RADIUS_KM: @@ -699,11 +705,13 @@ def process_link_job(db, r_client, job: dict): prev = rx visited = {rx_node_id} - for prefix in reversed(path_hashes): - prefix = prefix[:2].upper() + for raw_hash in reversed(path_hashes): + path_hash = normalize_path_hash(raw_hash) + if not path_hash: + continue candidates = [ (nid, nd) for nid, nd in all_nodes.items() - if nid.upper().startswith(prefix) + if node_matches_path_hash(nid, path_hash) and nid not in visited and (nd['role'] is None or nd['role'] == 2) and nd['name'] and '🚫' not in nd['name'] @@ -719,7 +727,7 @@ def process_link_job(db, r_client, job: dict): for nid, nd in candidates: confirmed_bonus = 2.5 if confirmed_link(nid, prev_id) else 0.0 distance_score = -node_dist(nd, prev) / 12.0 - ambiguity_penalty = local_prefix_ambiguity_penalty(prefix, nid, nd, prev, candidates) + ambiguity_penalty = local_prefix_ambiguity_penalty(path_hash, nid, nd, prev, candidates) score = confirmed_bonus + distance_score - ambiguity_penalty if score > best_score: best_score = score