@rstreamlabs/webtty 1.10.0 → 1.11.0

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.
package/dist/node.mjs CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  webTTYRecordedEventEncryptedPayload,
39
39
  webTTYServerProofTranscriptBytes,
40
40
  webTTYSigningKeyID
41
- } from "./chunk-6DA72SBW.mjs";
41
+ } from "./chunk-E7OURVTY.mjs";
42
42
 
43
43
  // src/local-e2e.ts
44
44
  var localKeyFileVersion = 1;
@@ -51,6 +51,12 @@ var knownServerKeyEnv = "RSTREAM_WEBTTY_KNOWN_SERVER_KEY";
51
51
  var knownServersFileEnv = "RSTREAM_WEBTTY_KNOWN_SERVERS_FILE";
52
52
  async function defaultWebTTYKnownServersPath(env) {
53
53
  const path = await nodePath();
54
+ const dataDir = cleanString((env ?? defaultEnv()).RSTREAM_DATA_DIR);
55
+ if (dataDir !== void 0) {
56
+ if (!path.isAbsolute(dataDir))
57
+ throw new Error("RSTREAM_DATA_DIR must be an absolute path.");
58
+ return path.join(dataDir, "webtty", "known_servers.json");
59
+ }
54
60
  return path.join(
55
61
  await homeDir(env ?? defaultEnv()),
56
62
  ".rstream",
@@ -402,7 +408,7 @@ function objectField(value, key) {
402
408
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
403
409
  return void 0;
404
410
  }
405
- return Object.fromEntries(Object.entries(value))[key];
411
+ return Reflect.get(value, key);
406
412
  }
407
413
  function stringRecord(value) {
408
414
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -417,6 +423,21 @@ function stringRecord(value) {
417
423
  function errorMessage(error) {
418
424
  return error instanceof Error ? error.message : String(error);
419
425
  }
426
+
427
+ // src/node-websocket.ts
428
+ import WebSocket from "ws";
429
+ var nodeWebSocketFactory = (url, options) => {
430
+ const socketOptions = {
431
+ closeTimeout: 1e3,
432
+ handshakeTimeout: 1e4,
433
+ maxPayload: options.maxMessageSize,
434
+ perMessageDeflate: false
435
+ };
436
+ const socket = new WebSocket(url, socketOptions);
437
+ socket.binaryType = "arraybuffer";
438
+ socket.on("error", () => void 0);
439
+ return socket;
440
+ };
420
441
  export {
421
442
  WebTTY,
422
443
  WebTTYCommand,
@@ -443,6 +464,7 @@ export {
443
464
  hashWebTTYServerProofTranscript,
444
465
  hashWebTTYSessionKeyGrant,
445
466
  loadWebTTYKnownServerKeysFile,
467
+ nodeWebSocketFactory,
446
468
  openWebTTYCommand,
447
469
  parseWebDAVMultiStatus,
448
470
  parseWebTTYKnownServerKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstreamlabs/webtty",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Client-side implementation of the rstream WebTTY protocol.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,16 +43,18 @@
43
43
  "devDependencies": {
44
44
  "@turbo/gen": "^2.10.11",
45
45
  "@types/node": "^26",
46
+ "@types/ws": "^8.18.1",
46
47
  "eslint": "9.39.5",
47
48
  "eslint-config": "*",
48
49
  "protobufjs-cli": "^2.6.2",
49
50
  "tsup": "^8.5.1",
50
51
  "typescript": "6.0.3",
51
- "typescript-config": "*",
52
- "ws": "^8.21.3"
52
+ "typescript-config": "*"
53
53
  },
54
54
  "dependencies": {
55
- "protobufjs": "^8.7.2"
55
+ "protobufjs": "^8.7.2",
56
+ "ws": "^8.21.3",
57
+ "@rstreamlabs/filesystem": "^0.2.0"
56
58
  },
57
59
  "publishConfig": {
58
60
  "access": "public"