refactor: add typed decoder plugin runtime

This commit is contained in:
sjg
2026-08-01 13:02:54 +02:00
parent 6a83e2e90a
commit 508cf2ba87
23 changed files with 438 additions and 324 deletions
@@ -23,10 +23,13 @@ test("AIS entry forwards positioned vessels with normalized metadata", async ()
Map,
console,
});
const runtime = await readFile(new URL("../../assets/web/generated/plugin-runtime.js", import.meta.url), "utf8");
const source = await readFile(new URL("../../assets/web/generated/ais.js", import.meta.url), "utf8");
new vm.Script(runtime).runInContext(context);
new vm.Script(source).runInContext(context);
window.onServerAis({ mmsi: 261000001, lat: 54.5, lon: 18.5, channel: "A", ts_ms: Date.now() });
window.trxPluginRuntime.dispatch("ais", { mmsi: 261000001, lat: 54.5, lon: 18.5, channel: "A", ts_ms: Date.now() });
assert.equal(window.onServerAis, undefined);
assert.equal(forwarded.length, 1);
assert.equal(forwarded[0].mmsi, 261000001);
assert.equal(forwarded[0].rig_id, null);