@camstack/system 1.2.116 → 1.2.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  15. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  17. package/dist/builtins/hub-forwarder/index.js +1 -1
  18. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  19. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  21. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  23. package/dist/builtins/local-network/ipv6-lan.d.ts +26 -0
  24. package/dist/builtins/local-network/local-network.addon.d.ts +28 -14
  25. package/dist/builtins/local-network/local-network.addon.js +195 -25
  26. package/dist/builtins/local-network/local-network.addon.mjs +191 -26
  27. package/dist/builtins/loki-logging/index.js +1 -1
  28. package/dist/builtins/loki-logging/index.mjs +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  31. package/dist/builtins/platform-probe/index.js +1 -1
  32. package/dist/builtins/platform-probe/index.mjs +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/snapshot/index.js +1 -1
  36. package/dist/builtins/snapshot/index.mjs +1 -1
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  38. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  40. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  41. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  43. package/dist/builtins/system-config/system-config.addon.js +1 -1
  44. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  45. package/dist/builtins/winston-logging/index.js +1 -1
  46. package/dist/builtins/winston-logging/index.mjs +1 -1
  47. package/dist/{dist-BpzbLPel.mjs → dist-D4Vmj8iw.mjs} +16 -8
  48. package/dist/{dist-Cri60Jd0.js → dist-DMEGlqg6.js} +16 -8
  49. package/dist/http/lan-http-bind.d.ts +12 -1
  50. package/dist/index.d.ts +1 -1
  51. package/dist/index.js +3 -2
  52. package/dist/index.mjs +3 -3
  53. package/dist/{lan-http-bind-CZ4EBeD_.js → lan-http-bind-DmgpFP6_.js} +53 -11
  54. package/dist/{lan-http-bind-BDJm4d-K.mjs → lan-http-bind-jKrj6OjQ.mjs} +48 -12
  55. package/dist/{retired-settings-keys-SrxMH3OT.mjs → retired-settings-keys--aM_vGF9.mjs} +1 -1
  56. package/dist/{retired-settings-keys-BVAxT5XL.js → retired-settings-keys-DET4YkAU.js} +1 -1
  57. package/package.json +1 -1
@@ -621,11 +621,15 @@ function readTlsAccessStatus(dataDir, restartRequired = false) {
621
621
  * Second HTTP listener that shares the hub's existing request handler.
622
622
  *
623
623
  * Fastify is one protocol per instance; HTTPS stays on :4443 and this
624
- * binds a plain `http.Server` that emits `request` onto the same
625
- * handler graph (tRPC, cookies, data-plane, static).
624
+ * binds a plain `http.Server` that emits `request` AND `upgrade` onto the
625
+ * same handler graph (tRPC HTTP, cookies, data-plane, static, tRPC WS).
626
+ *
627
+ * Forwarding only `request` is not enough: the viewer speaks tRPC exclusively
628
+ * over WebSocket (`wsLink`). `/health` wins the LAN race, then `ws://…/trpc`
629
+ * hangs because nobody handles the upgrade on this socket.
626
630
  */
627
631
  var DEFAULT_HTTP_PORT = 4480;
628
- var handler = null;
632
+ var handlers = null;
629
633
  var server = null;
630
634
  var pending = null;
631
635
  var state = {
@@ -633,9 +637,21 @@ var state = {
633
637
  error: null,
634
638
  port: DEFAULT_HTTP_PORT
635
639
  };
640
+ var boundRequestedHost = null;
636
641
  var DEFAULT_LAN_HTTP_PORT = DEFAULT_HTTP_PORT;
642
+ /** Map "all IPv4" to dual-stack IPv6 (`::`, ipv6Only false) so IPv4 still works. */
643
+ function allFamiliesListenHost(host) {
644
+ if (host === "0.0.0.0" || host === "*" || host === "") return {
645
+ host: "::",
646
+ ipv6Only: false
647
+ };
648
+ return {
649
+ host,
650
+ ipv6Only: false
651
+ };
652
+ }
637
653
  function registerLanHttpHandler(next) {
638
- handler = next;
654
+ handlers = next;
639
655
  }
640
656
  function readLanHttpState() {
641
657
  return state;
@@ -651,7 +667,7 @@ async function applyLanHttp(options) {
651
667
  };
652
668
  return state;
653
669
  }
654
- if (handler === null) {
670
+ if (handlers === null) {
655
671
  state = {
656
672
  listening: false,
657
673
  error: "HTTP listener is not registered yet",
@@ -659,14 +675,17 @@ async function applyLanHttp(options) {
659
675
  };
660
676
  return state;
661
677
  }
662
- if (server !== null && state.listening && state.port === options.port) return state;
678
+ if (server !== null && state.listening && (options.port === 0 || state.port === options.port) && boundRequestedHost === options.host) return state;
663
679
  await closeLanHttp();
664
680
  try {
665
- server = await listenHttp(options.port, options.host, handler);
681
+ const bound = await listenHttp(options.port, options.host, handlers);
682
+ server = bound;
683
+ boundRequestedHost = options.host;
684
+ const addr = bound.address();
666
685
  state = {
667
686
  listening: true,
668
687
  error: null,
669
- port: options.port
688
+ port: typeof addr === "object" && addr !== null ? addr.port : options.port
670
689
  };
671
690
  return state;
672
691
  } catch (err) {
@@ -691,16 +710,29 @@ async function bindPendingLanHttp() {
691
710
  async function closeLanHttp() {
692
711
  const current = server;
693
712
  server = null;
713
+ boundRequestedHost = null;
694
714
  if (current === null) return;
695
715
  await new Promise((resolve) => {
696
716
  current.close(() => resolve());
697
717
  });
698
718
  }
699
- function listenHttp(port, host, onRequest) {
719
+ function listenHttp(port, host, next) {
720
+ const resolved = allFamiliesListenHost(host);
721
+ return listenOn(port, resolved, next).catch((err) => {
722
+ if (resolved.host === "::" && host !== "::") return listenOn(port, {
723
+ host: "0.0.0.0",
724
+ ipv6Only: false
725
+ }, next);
726
+ throw err;
727
+ });
728
+ }
729
+ function listenOn(port, bind, next) {
700
730
  return new Promise((resolve, reject) => {
701
- const created = createServer(onRequest);
731
+ const created = createServer(next.onRequest);
732
+ created.on("upgrade", next.onUpgrade);
702
733
  const onError = (err) => {
703
734
  created.off("listening", onListening);
735
+ created.close();
704
736
  reject(err);
705
737
  };
706
738
  const onListening = () => {
@@ -709,8 +741,12 @@ function listenHttp(port, host, onRequest) {
709
741
  };
710
742
  created.once("error", onError);
711
743
  created.once("listening", onListening);
712
- created.listen(port, host);
744
+ created.listen({
745
+ port,
746
+ host: bind.host,
747
+ ipv6Only: bind.ipv6Only
748
+ });
713
749
  });
714
750
  }
715
751
  //#endregion
716
- export { evaluateExistingCert as S, collectCertIdentity as _, readLanHttpState as a, MAX_LEAF_VALIDITY_DAYS as b, readTlsAccessStatus as c, writeTlsMode as d, validateUploadedTls as f, CA_COMMON_NAME as g, reissueTlsLeaf as h, closeLanHttp as i, readTlsMode as l, loadTlsCert as m, applyLanHttp as n, registerLanHttpHandler as o, ensureTlsCert as p, bindPendingLanHttp as r, readExtraSans as s, DEFAULT_LAN_HTTP_PORT as t, writeExtraSans as u, CA_VALIDITY_DAYS as v, SERVER_AUTH_OID as x, LEAF_RENEWAL_WINDOW_DAYS as y };
752
+ export { evaluateExistingCert as C, SERVER_AUTH_OID as S, CA_COMMON_NAME as _, closeLanHttp as a, LEAF_RENEWAL_WINDOW_DAYS as b, readExtraSans as c, writeExtraSans as d, writeTlsMode as f, reissueTlsLeaf as g, loadTlsCert as h, bindPendingLanHttp as i, readTlsAccessStatus as l, ensureTlsCert as m, allFamiliesListenHost as n, readLanHttpState as o, validateUploadedTls as p, applyLanHttp as r, registerLanHttpHandler as s, DEFAULT_LAN_HTTP_PORT as t, readTlsMode as u, collectCertIdentity as v, MAX_LEAF_VALIDITY_DAYS as x, CA_VALIDITY_DAYS as y };
@@ -1,4 +1,4 @@
1
- import { kt as asJsonObject } from "./dist-BpzbLPel.mjs";
1
+ import { kt as asJsonObject } from "./dist-D4Vmj8iw.mjs";
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-Cri60Jd0.js");
1
+ const require_dist = require("./dist-DMEGlqg6.js");
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.116",
3
+ "version": "1.2.117",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",