@zixt/host 0.0.125 → 0.0.126

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 (2) hide show
  1. package/dist/index.js +17 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import { homedir as homedir4 } from "node:os";
28
28
  // package.json
29
29
  var package_default = {
30
30
  name: "@zixt/host",
31
- version: "0.0.125",
31
+ version: "0.0.126",
32
32
  type: "module",
33
33
  exports: {
34
34
  ".": "./src/client.ts",
@@ -24051,6 +24051,11 @@ var HostClient = class _HostClient {
24051
24051
  if (inventoryRetryTimer) clearTimeout(inventoryRetryTimer);
24052
24052
  void this.handleClose(ws, code, closeReason, frameTail, closeDetail(reason));
24053
24053
  });
24054
+ ws.on("unexpected-response", (_request, response) => {
24055
+ if (response.statusCode === 401) closeReason = "unauthorized";
24056
+ response.resume();
24057
+ ws.terminate();
24058
+ });
24054
24059
  ws.on("error", () => {
24055
24060
  });
24056
24061
  }
@@ -24103,7 +24108,9 @@ var HostClient = class _HostClient {
24103
24108
  if (code === CLOSE_CODES.protocolError) {
24104
24109
  this.opts.onStatus?.("rejected", detail);
24105
24110
  } else {
24106
- this.opts.onStatus?.(closeReason === "heartbeat_timeout" ? "unresponsive" : "disconnected");
24111
+ this.opts.onStatus?.(
24112
+ closeReason === "heartbeat_timeout" ? "unresponsive" : closeReason === "unauthorized" ? "unauthorized" : "disconnected"
24113
+ );
24107
24114
  }
24108
24115
  if (this.stopped) return;
24109
24116
  await this.unwindAllRuns(
@@ -44516,6 +44523,14 @@ var client = new HostClient({
44516
44523
  localCloudState = "connecting";
44517
44524
  publishLocalStatus();
44518
44525
  break;
44526
+ case "unauthorized":
44527
+ log.error("Zixt Cloud does not recognize this Machine pairing anymore", {
44528
+ ...connectionContext,
44529
+ next: "Pair this Machine again from the desktop app, or re-run the setup command"
44530
+ });
44531
+ localCloudState = "unauthorized";
44532
+ publishLocalStatus();
44533
+ break;
44519
44534
  case "unresponsive":
44520
44535
  log.warn("Zixt Cloud stopped answering; Tasks unwound before reconnecting", {
44521
44536
  ...connectionContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zixt/host",
3
- "version": "0.0.125",
3
+ "version": "0.0.126",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/client.ts",