@rstreamlabs/tunnels 3.0.0 → 3.2.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/index.js CHANGED
@@ -60,12 +60,14 @@ __export(index_exports, {
60
60
  listTunnelsResponseSchema: () => listTunnelsResponseSchema,
61
61
  normalizeEngineAddress: () => normalizeEngineAddress,
62
62
  parseWebTTYServers: () => parseWebTTYServers,
63
+ projectLogEventsSchema: () => projectLogEventsSchema,
63
64
  resolveControlPlaneCredentials: () => resolveControlPlaneCredentials,
64
65
  resolveManagedTunnelsProject: () => resolveManagedTunnelsProject,
65
66
  resolveTunnelsAPIURL: () => resolveTunnelsAPIURL,
66
67
  resolveTunnelsCredentials: () => resolveTunnelsCredentials,
67
68
  resolveTunnelsEngine: () => resolveTunnelsEngine,
68
69
  streamEndpointSchema: () => streamEndpointSchema,
70
+ streamSummaryEventSchema: () => streamSummaryEventSchema,
69
71
  streamSummarySchema: () => streamSummarySchema,
70
72
  streamTLSInfoSchema: () => streamTLSInfoSchema,
71
73
  tunnelFilterSchema: () => tunnelFilterSchema,
@@ -547,15 +549,23 @@ var commonEventsSchema = [
547
549
  object: import_tunnel.tunnelSchema
548
550
  })
549
551
  ];
552
+ var webhookDeliverableEventsSchema = [
553
+ commonEventsSchema[0],
554
+ commonEventsSchema[2],
555
+ commonEventsSchema[3],
556
+ commonEventsSchema[5]
557
+ ];
550
558
  var wsEventsSchema = z3.union([
551
559
  stateInitialEventSchema,
552
560
  ...commonEventsSchema
553
561
  ]);
554
- var webhookEventsSchema = z3.union([
555
- ...commonEventsSchema,
556
- streamSummaryEventSchema
562
+ var webhookEventsSchema = z3.union(webhookDeliverableEventsSchema);
563
+ var projectLogEventsSchema = streamSummaryEventSchema;
564
+ var eventSchema = z3.union([
565
+ wsEventsSchema,
566
+ webhookEventsSchema,
567
+ projectLogEventsSchema
557
568
  ]);
558
- var eventSchema = z3.union([wsEventsSchema, webhookEventsSchema]);
559
569
 
560
570
  // src/tunnel.ts
561
571
  var import_tunnel2 = require("@rstreamlabs/rstream/tunnel");
@@ -1876,34 +1886,50 @@ var Watch = class {
1876
1886
 
1877
1887
  // src/webtty.ts
1878
1888
  var z7 = __toESM(require("zod"));
1879
- var osFamilies = [
1889
+ var osFamilySchema = z7.enum([
1880
1890
  "linux",
1881
1891
  "macos",
1882
1892
  "windows",
1883
1893
  "netbsd",
1884
1894
  "openbsd",
1885
1895
  "freebsd"
1886
- ];
1896
+ ]);
1897
+ var webttyCapabilitySchema = z7.enum(["exec", "fs"]);
1898
+ var webttyFSModeSchema = z7.enum(["read-write", "read-only"]);
1887
1899
  var webttyServerSchema = z7.object({
1888
1900
  tunnel_id: z7.string(),
1889
1901
  host: z7.string(),
1890
1902
  token_auth: z7.boolean(),
1891
- os_family: z7.enum(osFamilies).optional(),
1903
+ capabilities: z7.array(webttyCapabilitySchema).optional(),
1904
+ exec_path: z7.string().optional(),
1905
+ fs_path: z7.string().optional(),
1906
+ fs_mode: webttyFSModeSchema.optional(),
1907
+ os_family: osFamilySchema.optional(),
1892
1908
  arch: z7.string().optional(),
1893
1909
  os_id: z7.string().optional(),
1894
- // /etc/os-release::ID (ubuntu, debian, rocky, etc.)
1895
1910
  os_version_id: z7.string().optional(),
1896
- // /etc/os-release::VERSION_ID (24.04, 22.04, 11, 10.0.19045, ...)
1897
1911
  os_version_codename: z7.string().optional(),
1898
- // /etc/os-release::VERSION_CODENAME (jammy, noble...)
1899
1912
  os_pretty_name: z7.string().optional(),
1900
- // /etc/os-release::PRETTY_NAME
1901
1913
  kernel_release: z7.string().optional(),
1902
- // uname -r
1903
1914
  hostname: z7.string().optional(),
1904
- // uname -n
1905
1915
  labels: z7.record(z7.string(), z7.string().optional()).optional()
1906
1916
  });
1917
+ function isWebTTYCapability(value) {
1918
+ return webttyCapabilitySchema.safeParse(value).success;
1919
+ }
1920
+ function parseWebTTYCapabilities(value) {
1921
+ const values = (value ?? "").split(",").map((capability) => capability.trim()).filter(isWebTTYCapability);
1922
+ return webttyCapabilitySchema.options.filter(
1923
+ (capability) => values.includes(capability)
1924
+ );
1925
+ }
1926
+ function webTTYCapabilitiesForLabels(labels) {
1927
+ const parsed = parseWebTTYCapabilities(labels["rstream.webtty.capabilities"]);
1928
+ return parsed.length > 0 ? parsed : ["exec"];
1929
+ }
1930
+ function webTTYHasCapability(capabilities, capability) {
1931
+ return capabilities.includes(capability);
1932
+ }
1907
1933
  function parser(tunnel) {
1908
1934
  if (tunnel.status !== "online") return null;
1909
1935
  if (tunnel.publish !== true) return null;
@@ -1912,6 +1938,7 @@ function parser(tunnel) {
1912
1938
  if (tunnelLabels["application-protocol"] !== "rstream.webtty") {
1913
1939
  return null;
1914
1940
  }
1941
+ const capabilities = webTTYCapabilitiesForLabels(tunnelLabels);
1915
1942
  const labels = {};
1916
1943
  for (const [key, value] of Object.entries(tunnelLabels)) {
1917
1944
  if (!key.startsWith("rstream.webtty.label.")) continue;
@@ -1923,6 +1950,10 @@ function parser(tunnel) {
1923
1950
  tunnel_id: tunnel.id,
1924
1951
  host: formatTunnelHost(tunnel),
1925
1952
  token_auth: tunnel.token_auth === true,
1953
+ capabilities,
1954
+ exec_path: webTTYHasCapability(capabilities, "exec") ? tunnelLabels["rstream.webtty.exec.path"] ?? "/" : void 0,
1955
+ fs_path: webTTYHasCapability(capabilities, "fs") ? tunnelLabels["rstream.webtty.fs.path"] ?? "/fs" : void 0,
1956
+ fs_mode: webTTYHasCapability(capabilities, "fs") ? tunnelLabels["rstream.webtty.fs.mode"] ?? "read-write" : void 0,
1926
1957
  os_family: tunnelLabels["rstream.webtty.os_family"],
1927
1958
  arch: tunnelLabels["rstream.webtty.arch"],
1928
1959
  os_id: tunnelLabels["rstream.webtty.os_id"],
@@ -1972,12 +2003,14 @@ function parseWebTTYServers(tunnels) {
1972
2003
  listTunnelsResponseSchema,
1973
2004
  normalizeEngineAddress,
1974
2005
  parseWebTTYServers,
2006
+ projectLogEventsSchema,
1975
2007
  resolveControlPlaneCredentials,
1976
2008
  resolveManagedTunnelsProject,
1977
2009
  resolveTunnelsAPIURL,
1978
2010
  resolveTunnelsCredentials,
1979
2011
  resolveTunnelsEngine,
1980
2012
  streamEndpointSchema,
2013
+ streamSummaryEventSchema,
1981
2014
  streamSummarySchema,
1982
2015
  streamTLSInfoSchema,
1983
2016
  tunnelFilterSchema,
package/dist/index.mjs CHANGED
@@ -9,13 +9,15 @@ import {
9
9
  listClientsResponseSchema,
10
10
  listTunnelsParamsSchema,
11
11
  listTunnelsResponseSchema,
12
+ projectLogEventsSchema,
12
13
  streamEndpointSchema,
14
+ streamSummaryEventSchema,
13
15
  streamSummarySchema,
14
16
  streamTLSInfoSchema,
15
17
  tunnelFilterSchema,
16
18
  webhookEventsSchema,
17
19
  wsEventsSchema
18
- } from "./chunk-UUZYVELQ.mjs";
20
+ } from "./chunk-VUAM3LRU.mjs";
19
21
 
20
22
  // src/auth-resource.ts
21
23
  import { createAuthTokenParamsSchema } from "@rstreamlabs/rstream/auth-token";
@@ -1137,34 +1139,50 @@ var Watch = class {
1137
1139
 
1138
1140
  // src/webtty.ts
1139
1141
  import * as z2 from "zod";
1140
- var osFamilies = [
1142
+ var osFamilySchema = z2.enum([
1141
1143
  "linux",
1142
1144
  "macos",
1143
1145
  "windows",
1144
1146
  "netbsd",
1145
1147
  "openbsd",
1146
1148
  "freebsd"
1147
- ];
1149
+ ]);
1150
+ var webttyCapabilitySchema = z2.enum(["exec", "fs"]);
1151
+ var webttyFSModeSchema = z2.enum(["read-write", "read-only"]);
1148
1152
  var webttyServerSchema = z2.object({
1149
1153
  tunnel_id: z2.string(),
1150
1154
  host: z2.string(),
1151
1155
  token_auth: z2.boolean(),
1152
- os_family: z2.enum(osFamilies).optional(),
1156
+ capabilities: z2.array(webttyCapabilitySchema).optional(),
1157
+ exec_path: z2.string().optional(),
1158
+ fs_path: z2.string().optional(),
1159
+ fs_mode: webttyFSModeSchema.optional(),
1160
+ os_family: osFamilySchema.optional(),
1153
1161
  arch: z2.string().optional(),
1154
1162
  os_id: z2.string().optional(),
1155
- // /etc/os-release::ID (ubuntu, debian, rocky, etc.)
1156
1163
  os_version_id: z2.string().optional(),
1157
- // /etc/os-release::VERSION_ID (24.04, 22.04, 11, 10.0.19045, ...)
1158
1164
  os_version_codename: z2.string().optional(),
1159
- // /etc/os-release::VERSION_CODENAME (jammy, noble...)
1160
1165
  os_pretty_name: z2.string().optional(),
1161
- // /etc/os-release::PRETTY_NAME
1162
1166
  kernel_release: z2.string().optional(),
1163
- // uname -r
1164
1167
  hostname: z2.string().optional(),
1165
- // uname -n
1166
1168
  labels: z2.record(z2.string(), z2.string().optional()).optional()
1167
1169
  });
1170
+ function isWebTTYCapability(value) {
1171
+ return webttyCapabilitySchema.safeParse(value).success;
1172
+ }
1173
+ function parseWebTTYCapabilities(value) {
1174
+ const values = (value ?? "").split(",").map((capability) => capability.trim()).filter(isWebTTYCapability);
1175
+ return webttyCapabilitySchema.options.filter(
1176
+ (capability) => values.includes(capability)
1177
+ );
1178
+ }
1179
+ function webTTYCapabilitiesForLabels(labels) {
1180
+ const parsed = parseWebTTYCapabilities(labels["rstream.webtty.capabilities"]);
1181
+ return parsed.length > 0 ? parsed : ["exec"];
1182
+ }
1183
+ function webTTYHasCapability(capabilities, capability) {
1184
+ return capabilities.includes(capability);
1185
+ }
1168
1186
  function parser(tunnel) {
1169
1187
  if (tunnel.status !== "online") return null;
1170
1188
  if (tunnel.publish !== true) return null;
@@ -1173,6 +1191,7 @@ function parser(tunnel) {
1173
1191
  if (tunnelLabels["application-protocol"] !== "rstream.webtty") {
1174
1192
  return null;
1175
1193
  }
1194
+ const capabilities = webTTYCapabilitiesForLabels(tunnelLabels);
1176
1195
  const labels = {};
1177
1196
  for (const [key, value] of Object.entries(tunnelLabels)) {
1178
1197
  if (!key.startsWith("rstream.webtty.label.")) continue;
@@ -1184,6 +1203,10 @@ function parser(tunnel) {
1184
1203
  tunnel_id: tunnel.id,
1185
1204
  host: formatTunnelHost(tunnel),
1186
1205
  token_auth: tunnel.token_auth === true,
1206
+ capabilities,
1207
+ exec_path: webTTYHasCapability(capabilities, "exec") ? tunnelLabels["rstream.webtty.exec.path"] ?? "/" : void 0,
1208
+ fs_path: webTTYHasCapability(capabilities, "fs") ? tunnelLabels["rstream.webtty.fs.path"] ?? "/fs" : void 0,
1209
+ fs_mode: webTTYHasCapability(capabilities, "fs") ? tunnelLabels["rstream.webtty.fs.mode"] ?? "read-write" : void 0,
1187
1210
  os_family: tunnelLabels["rstream.webtty.os_family"],
1188
1211
  arch: tunnelLabels["rstream.webtty.arch"],
1189
1212
  os_id: tunnelLabels["rstream.webtty.os_id"],
@@ -1232,12 +1255,14 @@ export {
1232
1255
  listTunnelsResponseSchema,
1233
1256
  normalizeEngineAddress,
1234
1257
  parseWebTTYServers,
1258
+ projectLogEventsSchema,
1235
1259
  resolveControlPlaneCredentials,
1236
1260
  resolveManagedTunnelsProject,
1237
1261
  resolveTunnelsAPIURL,
1238
1262
  resolveTunnelsCredentials,
1239
1263
  resolveTunnelsEngine,
1240
1264
  streamEndpointSchema,
1265
+ streamSummaryEventSchema,
1241
1266
  streamSummarySchema,
1242
1267
  streamTLSInfoSchema,
1243
1268
  tunnelFilterSchema,
package/dist/openapi.js CHANGED
@@ -353,15 +353,23 @@ var commonEventsSchema = [
353
353
  object: import_tunnel2.tunnelSchema
354
354
  })
355
355
  ];
356
+ var webhookDeliverableEventsSchema = [
357
+ commonEventsSchema[0],
358
+ commonEventsSchema[2],
359
+ commonEventsSchema[3],
360
+ commonEventsSchema[5]
361
+ ];
356
362
  var wsEventsSchema = z4.union([
357
363
  stateInitialEventSchema,
358
364
  ...commonEventsSchema
359
365
  ]);
360
- var webhookEventsSchema = z4.union([
361
- ...commonEventsSchema,
362
- streamSummaryEventSchema
366
+ var webhookEventsSchema = z4.union(webhookDeliverableEventsSchema);
367
+ var projectLogEventsSchema = streamSummaryEventSchema;
368
+ var eventSchema = z4.union([
369
+ wsEventsSchema,
370
+ webhookEventsSchema,
371
+ projectLogEventsSchema
363
372
  ]);
364
- var eventSchema = z4.union([wsEventsSchema, webhookEventsSchema]);
365
373
 
366
374
  // src/openapi.ts
367
375
  var z5 = __toESM(require("zod"));
package/dist/openapi.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  engineOpenApiDocument,
3
3
  engineOpenApiJson
4
- } from "./chunk-UUZYVELQ.mjs";
4
+ } from "./chunk-VUAM3LRU.mjs";
5
5
  export {
6
6
  engineOpenApiDocument,
7
7
  engineOpenApiJson
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstreamlabs/tunnels",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "JS/TS SDK for the rstream Engine API and tunnel runtime APIs.",
5
5
  "author": "@uartnet <hello@rstream.io>",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "typescript-config": "*"
48
48
  },
49
49
  "dependencies": {
50
- "@rstreamlabs/rstream": "3.0.0",
50
+ "@rstreamlabs/rstream": "3.1.0",
51
51
  "@types/jsonwebtoken": "^9.0.10",
52
52
  "jsonwebtoken": "^9.0.3",
53
53
  "zod": "^4.3.6"