@stim-cli/server 1.20.0 → 1.20.1

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.
@@ -130,7 +130,7 @@ function validTimeZone(timeZone) {
130
130
  return false;
131
131
  }
132
132
  }
133
- const minuteOfDay$1 = (value) => Number.isInteger(value) && value >= 0 && value < 1440;
133
+ const minuteOfDay$1 = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value < 1440;
134
134
  /** Quiet hours as `push.register` takes them, or null when `value` is not valid. */
135
135
  function parseQuietHours(value) {
136
136
  if (!isJsonObject(value)) return null;
@@ -144,7 +144,7 @@ function parseQuietHours(value) {
144
144
  }
145
145
  /** Whether `value` is a stuck threshold `push.register` takes: whole minutes from 1 to 240. */
146
146
  function validStuckMinutes(value) {
147
- return Number.isInteger(value) && value >= 1 && value <= 240;
147
+ return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 240;
148
148
  }
149
149
  function serverDir() {
150
150
  return join(configDir(), "server");
@@ -7384,7 +7384,7 @@ var DeviceHost = class {
7384
7384
  const value = outcome.value;
7385
7385
  const installed = !owned.stopping && this.options.allowed(record.client) && !outcome.notice && outcome.settled && isJsonObject(value) && value.state === "installed" && parseHostedPlatformDevice(value.device, record.platform) !== null && record.device !== null && hostedDeviceId(parseHostedPlatformDevice(value.device, record.platform)) === hostedDeviceId(record.device) && (value.launched === true || value.launched === "unverified");
7386
7386
  if (installed) owned.installedAttempt = attempt;
7387
- if (installed && (record.platform !== "macos" || Number.isSafeInteger(value.pid) && value.pid > 0)) await this.startAgent(record, attempt, value.pid);
7387
+ if (installed && (record.platform !== "macos" || typeof value.pid === "number" && Number.isSafeInteger(value.pid) && value.pid > 0)) await this.startAgent(record, attempt, value.pid);
7388
7388
  const app = changeHostedApp(record.id, attempt, (current) => {
7389
7389
  current.state = installed ? "installed" : "unknown";
7390
7390
  current.launched = installed ? value.launched : null;
@@ -7936,11 +7936,13 @@ function connect$1(url, timeoutMs) {
7936
7936
  } catch {
7937
7937
  return;
7938
7938
  }
7939
- const waiter = typeof message.id === "number" ? pending.get(message.id) : void 0;
7939
+ if (!isJsonObject(message) || typeof message.id !== "number") return;
7940
+ const waiter = pending.get(message.id);
7940
7941
  if (!waiter) return;
7941
7942
  pending.delete(message.id);
7942
- if (message.error) waiter.reject(new Error(message.error.message ?? "DevTools command failed."));
7943
- else waiter.resolve(message.result ?? {});
7943
+ const { error, result } = message;
7944
+ if (error) waiter.reject(new Error(isJsonObject(error) && typeof error.message === "string" ? error.message : "DevTools command failed."));
7945
+ else waiter.resolve(isJsonObject(result) ? result : {});
7944
7946
  });
7945
7947
  socket.on("close", () => {
7946
7948
  for (const waiter of pending.values()) waiter.reject(/* @__PURE__ */ new Error("The DevTools connection closed."));
@@ -9896,7 +9898,7 @@ function parseInput(method, params, targetOf) {
9896
9898
  code: "bad-request",
9897
9899
  message: "input.touch needs phase (down, move or up), and x and y from 0 to 1."
9898
9900
  };
9899
- if (display !== void 0 && (!Number.isInteger(display) || display < 0 || display > 3)) return {
9901
+ if (display !== void 0 && (typeof display !== "number" || !Number.isInteger(display) || display < 0 || display > 3)) return {
9900
9902
  code: "bad-request",
9901
9903
  message: "display must be a display index from 0 to 3."
9902
9904
  };
@@ -11328,7 +11330,7 @@ function parseLogFilter(params) {
11328
11330
  if (slot !== void 0 && (typeof slot !== "string" || !SLOT_NAME.test(slot))) return { error: "slot must be 1-64 letters, digits, underscores or hyphens." };
11329
11331
  if (grep !== void 0 && (typeof grep !== "string" || grep.includes("\0") || compileGrep(grep).error)) return { error: "grep must be a valid regular expression without NUL characters." };
11330
11332
  if (errors !== void 0 && typeof errors !== "boolean") return { error: "errors must be true or false." };
11331
- if (tail !== void 0 && (!Number.isInteger(tail) || tail < 1 || tail > protocol_exports.MAX_LOG_TAIL)) return { error: `tail must be an integer from 1 to ${protocol_exports.MAX_LOG_TAIL}.` };
11333
+ if (tail !== void 0 && (typeof tail !== "number" || !Number.isInteger(tail) || tail < 1 || tail > protocol_exports.MAX_LOG_TAIL)) return { error: `tail must be an integer from 1 to ${protocol_exports.MAX_LOG_TAIL}.` };
11332
11334
  return { filter: {
11333
11335
  ...typeof params.archive === "string" ? { archive: params.archive } : { workspace: params.workspace },
11334
11336
  ...sources ? { sources } : {},
@@ -14211,8 +14213,8 @@ async function startServer(options) {
14211
14213
  if (video !== void 0 && (!Array.isArray(video) || !video.every((codec) => typeof codec === "string"))) return error(id, "bad-request", "video must be a list of codec names.");
14212
14214
  const wantsVideo = video?.includes("h264") === true;
14213
14215
  const maxFps = wantsVideo ? protocol_exports.FRAME_FPS.video : protocol_exports.FRAME_FPS.max;
14214
- if (fps !== void 0 && (!Number.isInteger(fps) || fps < 1 || fps > maxFps)) return error(id, "bad-request", `fps must be a whole number from 1 to ${maxFps}.`);
14215
- if (maxEdge !== void 0 && (!Number.isInteger(maxEdge) || maxEdge < protocol_exports.FRAME_EDGE.min || maxEdge > protocol_exports.FRAME_EDGE.max)) return error(id, "bad-request", `maxEdge must be a whole number of pixels from ${protocol_exports.FRAME_EDGE.min} to ${protocol_exports.FRAME_EDGE.max}.`);
14216
+ if (fps !== void 0 && (typeof fps !== "number" || !Number.isInteger(fps) || fps < 1 || fps > maxFps)) return error(id, "bad-request", `fps must be a whole number from 1 to ${maxFps}.`);
14217
+ if (maxEdge !== void 0 && (typeof maxEdge !== "number" || !Number.isInteger(maxEdge) || maxEdge < protocol_exports.FRAME_EDGE.min || maxEdge > protocol_exports.FRAME_EDGE.max)) return error(id, "bad-request", `maxEdge must be a whole number of pixels from ${protocol_exports.FRAME_EDGE.min} to ${protocol_exports.FRAME_EDGE.max}.`);
14216
14218
  const resolvedDir = hosted ? null : readDir(id, {
14217
14219
  workspace,
14218
14220
  archive
@@ -15224,7 +15226,7 @@ async function startServer(options) {
15224
15226
  if (message.method === "notifications.list") {
15225
15227
  const params = message.params ?? {};
15226
15228
  const since = isJsonObject(params) ? params.since : void 0;
15227
- if (!isJsonObject(params) || since !== void 0 && !(Number.isInteger(since) && since >= 0)) return error(id, "bad-request", "notifications.list takes an optional since, a cursor of 0 or more.");
15229
+ if (!isJsonObject(params) || since !== void 0 && !(typeof since === "number" && Number.isInteger(since) && since >= 0)) return error(id, "bad-request", "notifications.list takes an optional since, a cursor of 0 or more.");
15228
15230
  listeners.add(socket);
15229
15231
  return send(socket, {
15230
15232
  id,
@@ -4,6 +4,6 @@ const encode = (version) => version.split(".", 3).reduce((sum, part) => sum * 1e
4
4
  if (encode(process.versions.node) < encode("22.12.0")) {
5
5
  process.stderr.write(`STIM_NODE_UNSUPPORTED: stim-server needs Node 22.12.0 or later; this is Node ${process.versions.node} at ${process.execPath}. To run stim-server where a project pins an older Node, see https://stim.appandflow.com/docs/requirements#older-node-pins\n`);
6
6
  process.exitCode = 1;
7
- } else import("./stim-server-C5iKxjba.mjs");
7
+ } else import("./stim-server-Dy0DlR96.mjs");
8
8
  //#endregion
9
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stim-cli/server",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "Serves Stim status to paired clients over Tailscale, and runs reload and stop for clients granted control.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,8 +28,8 @@
28
28
  "./protocol.schema.json": "./dist/protocol.schema.json"
29
29
  },
30
30
  "dependencies": {
31
- "@stim-cli/core": "^1.20.0",
32
- "stim": "1.20.0",
31
+ "@stim-cli/core": "^1.20.1",
32
+ "stim": "1.20.1",
33
33
  "ws": "^8.21.3"
34
34
  },
35
35
  "devDependencies": {