@rstreamlabs/tunnels 3.10.2 → 4.0.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.
@@ -1,23 +1,8 @@
1
1
  // src/client.ts
2
2
  import * as z from "zod";
3
- var clientSchema = z.object({
4
- id: z.string(),
5
- status: z.enum(["online", "offline"]),
6
- user_id: z.string().optional(),
7
- workspace_id: z.string().optional(),
8
- project_id: z.string().optional(),
9
- cluster_id: z.string().optional(),
10
- plan: z.string().optional(),
11
- provider: z.string().optional(),
12
- region: z.string().optional(),
13
- agent: z.string().optional(),
14
- channel: z.string().optional(),
15
- version: z.string().optional(),
16
- os: z.string().optional(),
17
- arch: z.string().optional(),
18
- protocol_version: z.string().optional(),
19
- labels: z.record(z.string(), z.string()).optional()
20
- });
3
+ import { clientSchema } from "@rstreamlabs/rstream/client";
4
+ import { clientSchema as clientSchema2 } from "@rstreamlabs/rstream/client";
5
+ var listedClientSchema = clientSchema.partial();
21
6
  var clientFilterSchema = clientSchema.pick({
22
7
  id: true,
23
8
  status: true,
@@ -34,22 +19,53 @@ var listClientsParamsSchema = z.object({
34
19
  limit: z.number().int().min(1).optional(),
35
20
  filters: clientFilterSchema.optional()
36
21
  });
37
- var listClientsResponseSchema = z.array(clientSchema);
22
+ var listClientsResponseSchema = z.array(listedClientSchema);
38
23
 
39
- // src/webtty-schemas.ts
24
+ // src/tunnel.ts
25
+ import { tunnelSchema } from "@rstreamlabs/rstream/tunnel";
40
26
  import * as z2 from "zod";
41
- var webTTYTransportSchema = z2.enum([
27
+ var DEFAULT_PUBLISHED_PORT = 443;
28
+ var tunnelFilterSchema = tunnelSchema.pick({
29
+ id: true,
30
+ name: true,
31
+ type: true,
32
+ status: true,
33
+ client_id: true,
34
+ user_id: true,
35
+ publish: true,
36
+ protocol: true,
37
+ hostname: true,
38
+ http_version: true,
39
+ labels: true
40
+ }).partial();
41
+ var listTunnelsParamsSchema = z2.object({
42
+ limit: z2.number().int().min(1).optional(),
43
+ filters: tunnelFilterSchema.optional()
44
+ });
45
+ var listedTunnelSchema = tunnelSchema.partial();
46
+ var listTunnelsResponseSchema = z2.array(listedTunnelSchema);
47
+ function formatTunnelHost(tunnel) {
48
+ if (!tunnel.hostname) return tunnel.host;
49
+ if (!tunnel.port || tunnel.port === DEFAULT_PUBLISHED_PORT) {
50
+ return tunnel.hostname;
51
+ }
52
+ return `${tunnel.hostname}:${tunnel.port}`;
53
+ }
54
+
55
+ // src/webtty-schemas.ts
56
+ import * as z3 from "zod";
57
+ var webTTYTransportSchema = z3.enum([
42
58
  "plain",
43
59
  "websocket",
44
60
  "webtransport"
45
61
  ]);
46
- var webTTYRecordingModeSchema = z2.enum(["recorded", "private"]);
47
- var webTTYEncryptionModeSchema = z2.enum(["managed", "e2e"]);
48
- var webTTYSessionModeSchema = z2.enum([
62
+ var webTTYRecordingModeSchema = z3.enum(["recorded", "private"]);
63
+ var webTTYEncryptionModeSchema = z3.enum(["managed", "e2e"]);
64
+ var webTTYSessionModeSchema = z3.enum([
49
65
  "interactive",
50
66
  "non-interactive"
51
67
  ]);
52
- var webTTYOriginSchema = z2.enum([
68
+ var webTTYOriginSchema = z3.enum([
53
69
  "human",
54
70
  "codex",
55
71
  "api",
@@ -57,259 +73,259 @@ var webTTYOriginSchema = z2.enum([
57
73
  "ci",
58
74
  "scheduled-job"
59
75
  ]);
60
- var webTTYParticipantRoleSchema = z2.enum(["controller", "spectator"]);
61
- var webTTYInitiatorKindSchema = z2.enum([
76
+ var webTTYParticipantRoleSchema = z3.enum(["controller", "spectator"]);
77
+ var webTTYInitiatorKindSchema = z3.enum([
62
78
  "user",
63
79
  "app",
64
80
  "agent",
65
81
  "service-account"
66
82
  ]);
67
- var webTTYContextMetadataSchema = z2.object({
83
+ var webTTYContextMetadataSchema = z3.object({
68
84
  origin: webTTYOriginSchema.optional(),
69
- origin_id: z2.string().optional(),
70
- purpose: z2.string().optional(),
85
+ origin_id: z3.string().optional(),
86
+ purpose: z3.string().optional(),
71
87
  initiator_kind: webTTYInitiatorKindSchema.optional(),
72
- agent_name: z2.string().optional(),
73
- agent_version: z2.string().optional(),
74
- request_id: z2.string().optional(),
75
- labels: z2.record(z2.string(), z2.string()).optional()
88
+ agent_name: z3.string().optional(),
89
+ agent_version: z3.string().optional(),
90
+ request_id: z3.string().optional(),
91
+ labels: z3.record(z3.string(), z3.string()).optional()
76
92
  }).passthrough();
77
93
 
78
94
  // src/stream.ts
79
- import * as z3 from "zod";
80
- var nonEmptyStringSchema = z3.string().min(1);
81
- var isoDateTimeSchema = z3.string().datetime({ offset: true });
82
- var ipAddressSchema = z3.string();
83
- var intNonNegSchema = z3.number().int().nonnegative();
84
- var numNonNegSchema = z3.number().nonnegative();
85
- var geolocationSchema = z3.object({
86
- country: z3.string().optional(),
87
- region: z3.string().optional()
95
+ import * as z4 from "zod";
96
+ var nonEmptyStringSchema = z4.string().min(1);
97
+ var isoDateTimeSchema = z4.string().datetime({ offset: true });
98
+ var ipAddressSchema = z4.string();
99
+ var intNonNegSchema = z4.number().int().nonnegative();
100
+ var numNonNegSchema = z4.number().nonnegative();
101
+ var geolocationSchema = z4.object({
102
+ country: z4.string().optional(),
103
+ region: z4.string().optional()
88
104
  });
89
- var streamTLSInfoSchema = z3.object({
90
- version: z3.string().min(1).optional(),
91
- cipher: z3.string().min(1).optional(),
92
- protocol: z3.string().min(1).optional(),
93
- curve: z3.string().min(1).optional(),
94
- ech: z3.boolean().optional()
105
+ var streamTLSInfoSchema = z4.object({
106
+ version: z4.string().min(1).optional(),
107
+ cipher: z4.string().min(1).optional(),
108
+ protocol: z4.string().min(1).optional(),
109
+ curve: z4.string().min(1).optional(),
110
+ ech: z4.boolean().optional()
95
111
  });
96
- var streamEndpointSchema = z3.object({
112
+ var streamEndpointSchema = z4.object({
97
113
  ip: ipAddressSchema.optional(),
98
114
  geolocation: geolocationSchema.optional(),
99
115
  tls: streamTLSInfoSchema.optional()
100
116
  });
101
- var httpHeadersSchema = z3.record(
102
- z3.string(),
103
- z3.union([z3.string(), z3.array(z3.string())])
117
+ var httpHeadersSchema = z4.record(
118
+ z4.string(),
119
+ z4.union([z4.string(), z4.array(z4.string())])
104
120
  );
105
- var httpProtocolSchema = z3.enum(["http/1.1", "h2", "h2c", "h3"]);
106
- var httpRequestSchema = z3.object({
121
+ var httpProtocolSchema = z4.enum(["http/1.1", "h2", "h2c", "h3"]);
122
+ var httpRequestSchema = z4.object({
107
123
  method: nonEmptyStringSchema,
108
- scheme: z3.string().min(1).optional(),
124
+ scheme: z4.string().min(1).optional(),
109
125
  host: nonEmptyStringSchema.optional(),
110
126
  path: nonEmptyStringSchema.optional(),
111
- query: z3.string().optional(),
127
+ query: z4.string().optional(),
112
128
  url: nonEmptyStringSchema.optional(),
113
129
  headers: httpHeadersSchema.optional(),
114
- userAgent: z3.string().optional()
130
+ userAgent: z4.string().optional()
115
131
  });
116
- var httpResponseSchema = z3.object({
117
- status: z3.number().int().min(100).max(999),
132
+ var httpResponseSchema = z4.object({
133
+ status: z4.number().int().min(100).max(999),
118
134
  headers: httpHeadersSchema.optional()
119
135
  });
120
- var httpRequestStageSchema = z3.object({
136
+ var httpRequestStageSchema = z4.object({
121
137
  protocol: httpProtocolSchema.optional(),
122
138
  request: httpRequestSchema
123
139
  });
124
- var httpResponseStageSchema = z3.object({
140
+ var httpResponseStageSchema = z4.object({
125
141
  protocol: httpProtocolSchema.optional(),
126
142
  response: httpResponseSchema
127
143
  });
128
- var streamEntrySchema = z3.object({
129
- kind: z3.enum([
144
+ var streamEntrySchema = z4.object({
145
+ kind: z4.enum([
130
146
  "published_tunnel",
131
147
  "private_rstream",
132
148
  "proxy_egress",
133
149
  "internal"
134
150
  ]),
135
- transport: z3.enum(["rstream", "tls", "quic", "dtls", "http", "tcp"]).optional()
151
+ transport: z4.enum(["rstream", "tls", "quic", "dtls", "http", "tcp"]).optional()
136
152
  });
137
- var tokenSourceSchema = z3.enum([
153
+ var tokenSourceSchema = z4.enum([
138
154
  "authorization",
139
155
  "query",
140
156
  "client",
141
157
  "unknown"
142
158
  ]);
143
- var tokenTypeSchema = z3.enum(["auth", "pat", "app", "unknown"]);
144
- var firewallRuleSchema = z3.discriminatedUnion("kind", [
145
- z3.object({ kind: z3.literal("none") }),
146
- z3.object({ kind: z3.literal("mtls") }),
147
- z3.object({
148
- kind: z3.literal("rstream_auth"),
149
- source: z3.literal("rstream_auth")
159
+ var tokenTypeSchema = z4.enum(["auth", "pat", "app", "unknown"]);
160
+ var firewallRuleSchema = z4.discriminatedUnion("kind", [
161
+ z4.object({ kind: z4.literal("none") }),
162
+ z4.object({ kind: z4.literal("mtls") }),
163
+ z4.object({
164
+ kind: z4.literal("rstream_auth"),
165
+ source: z4.literal("rstream_auth")
150
166
  }),
151
- z3.object({
152
- kind: z3.literal("rstream"),
153
- source: z3.literal("private_rstream").optional()
167
+ z4.object({
168
+ kind: z4.literal("rstream"),
169
+ source: z4.literal("private_rstream").optional()
154
170
  }),
155
- z3.object({
156
- kind: z3.literal("token"),
171
+ z4.object({
172
+ kind: z4.literal("token"),
157
173
  source: tokenSourceSchema.optional(),
158
174
  tokenType: tokenTypeSchema.optional()
159
175
  })
160
176
  ]);
161
- var unauthorizedSourceSchema = z3.object({
177
+ var unauthorizedSourceSchema = z4.object({
162
178
  source: tokenSourceSchema
163
179
  });
164
- var unauthorizedReasonSchema = (shape) => z3.object(shape).merge(unauthorizedSourceSchema);
165
- var unauthorizedSchema = z3.discriminatedUnion("reason", [
180
+ var unauthorizedReasonSchema = (shape) => z4.object(shape).merge(unauthorizedSourceSchema);
181
+ var unauthorizedSchema = z4.discriminatedUnion("reason", [
166
182
  unauthorizedReasonSchema({
167
- reason: z3.literal("missing_token")
183
+ reason: z4.literal("missing_token")
168
184
  }),
169
185
  unauthorizedReasonSchema({
170
- reason: z3.literal("invalid_token")
186
+ reason: z4.literal("invalid_token")
171
187
  }),
172
188
  unauthorizedReasonSchema({
173
- reason: z3.literal("expired_token")
189
+ reason: z4.literal("expired_token")
174
190
  }),
175
191
  unauthorizedReasonSchema({
176
- reason: z3.literal("invalid_secret")
192
+ reason: z4.literal("invalid_secret")
177
193
  }),
178
194
  unauthorizedReasonSchema({
179
- reason: z3.literal("user_mismatch")
195
+ reason: z4.literal("user_mismatch")
180
196
  }),
181
197
  unauthorizedReasonSchema({
182
- reason: z3.literal("insufficient_scope")
198
+ reason: z4.literal("insufficient_scope")
183
199
  }),
184
200
  unauthorizedReasonSchema({
185
- reason: z3.literal("policy_denied"),
186
- policy: z3.enum(["ip", "geo", "mtls", "challenge", "other"]),
187
- value: z3.string().optional()
201
+ reason: z4.literal("policy_denied"),
202
+ policy: z4.enum(["ip", "geo", "mtls", "challenge", "other"]),
203
+ value: z4.string().optional()
188
204
  })
189
205
  ]);
190
- var failureSchema = z3.discriminatedUnion("kind", [
191
- z3.object({
192
- kind: z3.literal("timeout"),
206
+ var failureSchema = z4.discriminatedUnion("kind", [
207
+ z4.object({
208
+ kind: z4.literal("timeout"),
193
209
  timeoutMs: intNonNegSchema.optional(),
194
- message: z3.string().optional()
210
+ message: z4.string().optional()
195
211
  }),
196
- z3.object({
197
- kind: z3.literal("unauthorized"),
212
+ z4.object({
213
+ kind: z4.literal("unauthorized"),
198
214
  why: unauthorizedSchema,
199
- message: z3.string().optional()
215
+ message: z4.string().optional()
200
216
  }),
201
- z3.object({
202
- kind: z3.literal("not_found"),
203
- resource: z3.enum(["tunnel", "client", "route"]),
204
- message: z3.string().optional()
217
+ z4.object({
218
+ kind: z4.literal("not_found"),
219
+ resource: z4.enum(["tunnel", "client", "route"]),
220
+ message: z4.string().optional()
205
221
  }),
206
- z3.object({
207
- kind: z3.literal("refused"),
208
- reason: z3.enum(["capacity", "policy", "unsupported", "other"]),
209
- message: z3.string().optional()
222
+ z4.object({
223
+ kind: z4.literal("refused"),
224
+ reason: z4.enum(["capacity", "policy", "unsupported", "other"]),
225
+ message: z4.string().optional()
210
226
  }),
211
- z3.object({ kind: z3.literal("io"), message: z3.string().optional() }),
212
- z3.object({ kind: z3.literal("internal"), message: z3.string().optional() })
227
+ z4.object({ kind: z4.literal("io"), message: z4.string().optional() }),
228
+ z4.object({ kind: z4.literal("internal"), message: z4.string().optional() })
213
229
  ]);
214
- var firewallSchema = z3.discriminatedUnion("decision", [
215
- z3.object({ decision: z3.literal("allowed"), rule: firewallRuleSchema }),
216
- z3.object({
217
- decision: z3.literal("denied"),
230
+ var firewallSchema = z4.discriminatedUnion("decision", [
231
+ z4.object({ decision: z4.literal("allowed"), rule: firewallRuleSchema }),
232
+ z4.object({
233
+ decision: z4.literal("denied"),
218
234
  rule: firewallRuleSchema,
219
235
  failure: failureSchema
220
236
  })
221
237
  ]);
222
- var routedTunnelSchema = z3.object({
238
+ var routedTunnelSchema = z4.object({
223
239
  tunnelId: nonEmptyStringSchema.optional(),
224
- tunnelName: z3.string().optional(),
225
- hostname: z3.string().optional(),
226
- protocol: z3.string().optional(),
227
- published: z3.boolean().optional(),
228
- type: z3.string().optional(),
229
- tlsMode: z3.string().optional(),
230
- httpVersion: z3.string().optional(),
231
- httpUseTls: z3.boolean().optional(),
232
- upstreamTls: z3.boolean().optional(),
233
- tokenAuth: z3.boolean().optional(),
234
- mtls_auth: z3.boolean().optional()
240
+ tunnelName: z4.string().optional(),
241
+ hostname: z4.string().optional(),
242
+ protocol: z4.string().optional(),
243
+ published: z4.boolean().optional(),
244
+ type: z4.string().optional(),
245
+ tlsMode: z4.string().optional(),
246
+ httpVersion: z4.string().optional(),
247
+ httpUseTls: z4.boolean().optional(),
248
+ upstreamTls: z4.boolean().optional(),
249
+ tokenAuth: z4.boolean().optional(),
250
+ mtls_auth: z4.boolean().optional()
235
251
  });
236
- var routingNodeSchema = z3.object({
252
+ var routingNodeSchema = z4.object({
237
253
  engineId: nonEmptyStringSchema,
238
254
  region: nonEmptyStringSchema,
239
255
  generation: nonEmptyStringSchema.optional()
240
256
  });
241
- var routingPathSchema = z3.object({
242
- mode: z3.enum(["direct", "cross_region"]),
243
- crossRegionRoutingAllowed: z3.boolean(),
257
+ var routingPathSchema = z4.object({
258
+ mode: z4.enum(["direct", "cross_region"]),
259
+ crossRegionRoutingAllowed: z4.boolean(),
244
260
  ingress: routingNodeSchema,
245
261
  owner: routingNodeSchema,
246
262
  anchor: routingNodeSchema
247
263
  });
248
- var routingSchema = z3.discriminatedUnion("decision", [
249
- z3.object({
250
- decision: z3.literal("routed"),
264
+ var routingSchema = z4.discriminatedUnion("decision", [
265
+ z4.object({
266
+ decision: z4.literal("routed"),
251
267
  tunnel: routedTunnelSchema,
252
268
  path: routingPathSchema.optional()
253
269
  }),
254
- z3.object({ decision: z3.literal("not_routed"), failure: failureSchema })
270
+ z4.object({ decision: z4.literal("not_routed"), failure: failureSchema })
255
271
  ]);
256
- var streamConnectedMetricsSchema = z3.object({
272
+ var streamConnectedMetricsSchema = z4.object({
257
273
  establish_ms: numNonNegSchema,
258
274
  duration_ms: numNonNegSchema,
259
275
  upstream_bytes: intNonNegSchema,
260
276
  downstream_bytes: intNonNegSchema
261
277
  });
262
- var streamFailedMetricsSchema = z3.object({
278
+ var streamFailedMetricsSchema = z4.object({
263
279
  time_to_fail_ms: numNonNegSchema.optional(),
264
280
  establish_ms: numNonNegSchema.optional()
265
281
  });
266
- var terminationSchema = z3.object({
267
- by: z3.enum(["downstream", "upstream", "server", "unknown"]),
268
- reason: z3.enum(["closed", "reset", "timeout", "error", "unknown"]),
269
- message: z3.string().optional()
282
+ var terminationSchema = z4.object({
283
+ by: z4.enum(["downstream", "upstream", "server", "unknown"]),
284
+ reason: z4.enum(["closed", "reset", "timeout", "error", "unknown"]),
285
+ message: z4.string().optional()
270
286
  });
271
- var responseConnectedSchema = z3.object({
272
- outcome: z3.literal("connected"),
287
+ var responseConnectedSchema = z4.object({
288
+ outcome: z4.literal("connected"),
273
289
  established_at: isoDateTimeSchema,
274
290
  upstream: streamEndpointSchema.optional(),
275
291
  metrics: streamConnectedMetricsSchema,
276
292
  termination: terminationSchema.optional(),
277
293
  http: httpResponseStageSchema.optional()
278
294
  });
279
- var responseFailedSchema = z3.object({
280
- outcome: z3.literal("failed"),
295
+ var responseFailedSchema = z4.object({
296
+ outcome: z4.literal("failed"),
281
297
  failure: failureSchema,
282
298
  upstream: streamEndpointSchema.optional(),
283
299
  metrics: streamFailedMetricsSchema.optional(),
284
300
  termination: terminationSchema.optional(),
285
301
  http: httpResponseStageSchema.optional()
286
302
  });
287
- var responseSchema = z3.discriminatedUnion("outcome", [
303
+ var responseSchema = z4.discriminatedUnion("outcome", [
288
304
  responseConnectedSchema,
289
305
  responseFailedSchema
290
306
  ]);
291
- var streamWebTTYMetadataSchema = z3.object({
307
+ var streamWebTTYMetadataSchema = z4.object({
292
308
  server_id: nonEmptyStringSchema.optional(),
293
309
  session_id: nonEmptyStringSchema.optional(),
294
310
  session_group_id: nonEmptyStringSchema.optional(),
295
311
  participant_id: nonEmptyStringSchema.optional(),
296
312
  participant_role: webTTYParticipantRoleSchema.optional(),
297
- controller: z3.boolean().optional(),
313
+ controller: z4.boolean().optional(),
298
314
  recording_mode: webTTYRecordingModeSchema.optional(),
299
315
  encryption_mode: webTTYEncryptionModeSchema.optional(),
300
- encryption_policy: z3.enum(["disabled", "explicit_key", "workspace_managed"]).optional(),
301
- e2e: z3.boolean().optional(),
302
- client_proof: z3.enum(["none", "required"]).optional(),
316
+ encryption_policy: z4.enum(["disabled", "explicit_key", "workspace_managed"]).optional(),
317
+ e2e: z4.boolean().optional(),
318
+ client_proof: z4.enum(["none", "required"]).optional(),
303
319
  session_mode: webTTYSessionModeSchema.optional(),
304
320
  downstream_transport: webTTYTransportSchema.optional(),
305
321
  upstream_transport: webTTYTransportSchema.optional(),
306
322
  origin: webTTYOriginSchema.optional(),
307
- origin_id: z3.string().optional(),
323
+ origin_id: z4.string().optional(),
308
324
  initiator_kind: webTTYInitiatorKindSchema.optional(),
309
- device_id: z3.string().optional(),
310
- browser_id: z3.string().optional()
325
+ device_id: z4.string().optional(),
326
+ browser_id: z4.string().optional()
311
327
  }).passthrough();
312
- var streamSummarySchema = z3.object({
328
+ var streamSummarySchema = z4.object({
313
329
  workspace_id: nonEmptyStringSchema.optional(),
314
330
  project_id: nonEmptyStringSchema.optional(),
315
331
  cluster_id: nonEmptyStringSchema.optional(),
@@ -319,7 +335,7 @@ var streamSummarySchema = z3.object({
319
335
  stream_id: nonEmptyStringSchema,
320
336
  created_at: isoDateTimeSchema,
321
337
  terminated_at: isoDateTimeSchema,
322
- request: z3.object({
338
+ request: z4.object({
323
339
  downstream: streamEndpointSchema,
324
340
  entry: streamEntrySchema.optional(),
325
341
  http: httpRequestStageSchema.optional()
@@ -346,34 +362,34 @@ function formatStreamAccessPath(entry) {
346
362
  }
347
363
 
348
364
  // src/webtty-resource.ts
349
- import * as z4 from "zod";
350
- var isoDateTimeSchema2 = z4.string().datetime({ offset: true });
351
- var decimalCursorSchema = z4.string().regex(/^\d+$/);
352
- var webTTYSequenceCursorInputSchema = z4.union([
365
+ import * as z5 from "zod";
366
+ var isoDateTimeSchema2 = z5.string().datetime({ offset: true });
367
+ var decimalCursorSchema = z5.string().regex(/^\d+$/);
368
+ var webTTYSequenceCursorInputSchema = z5.union([
353
369
  decimalCursorSchema,
354
- z4.number().int().nonnegative().safe().transform(String)
370
+ z5.number().int().nonnegative().safe().transform(String)
355
371
  ]);
356
- var webTTYSessionStatusSchema = z4.enum([
372
+ var webTTYSessionStatusSchema = z5.enum([
357
373
  "opening",
358
374
  "active",
359
375
  "closing",
360
376
  "closed",
361
377
  "errored"
362
378
  ]);
363
- var webTTYControlRequestStatusSchema = z4.enum([
379
+ var webTTYControlRequestStatusSchema = z5.enum([
364
380
  "pending",
365
381
  "granted",
366
382
  "refused",
367
383
  "revoked",
368
384
  "expired"
369
385
  ]);
370
- var webTTYEventDirectionSchema = z4.enum([
386
+ var webTTYEventDirectionSchema = z5.enum([
371
387
  "client_to_server",
372
388
  "server_to_client",
373
389
  "engine_internal"
374
390
  ]);
375
- var webTTYStreamTypeSchema = z4.enum(["stdin", "stdout", "stderr"]);
376
- var webTTYSessionEventTypeSchema = z4.enum([
391
+ var webTTYStreamTypeSchema = z5.enum(["stdin", "stdout", "stderr"]);
392
+ var webTTYSessionEventTypeSchema = z5.enum([
377
393
  "open",
378
394
  "ack",
379
395
  "data",
@@ -384,233 +400,233 @@ var webTTYSessionEventTypeSchema = z4.enum([
384
400
  "control",
385
401
  "recording_state"
386
402
  ]);
387
- var jsonRecordSchema = z4.record(z4.string(), z4.unknown());
403
+ var jsonRecordSchema = z5.record(z5.string(), z5.unknown());
388
404
  function rejectCryptoKeyEnvelopes(crypto, ctx, path) {
389
405
  if (crypto === null || typeof crypto !== "object") {
390
406
  return;
391
407
  }
392
408
  if (Object.prototype.hasOwnProperty.call(crypto, "key_envelopes")) {
393
409
  ctx.addIssue({
394
- code: z4.ZodIssueCode.custom,
410
+ code: z5.ZodIssueCode.custom,
395
411
  message: "key_envelopes are available only from the WebTTY decrypt-material endpoint.",
396
412
  path: [...path, "key_envelopes"]
397
413
  });
398
414
  }
399
415
  }
400
- var webTTYCapabilitiesSchema = z4.object({
401
- managed_protocol: z4.boolean(),
402
- store_configured: z4.boolean(),
403
- session_listing: z4.boolean(),
404
- recording: z4.boolean(),
405
- replay: z4.boolean(),
406
- live_attach: z4.boolean(),
407
- control_transfer: z4.boolean(),
408
- e2e: z4.boolean(),
409
- implemented_transports: z4.array(webTTYTransportSchema),
410
- recording_modes: z4.array(webTTYRecordingModeSchema),
411
- encryption_modes: z4.array(webTTYEncryptionModeSchema),
412
- required_permissions: z4.record(z4.string(), z4.array(z4.string()))
416
+ var webTTYCapabilitiesSchema = z5.object({
417
+ managed_protocol: z5.boolean(),
418
+ store_configured: z5.boolean(),
419
+ session_listing: z5.boolean(),
420
+ recording: z5.boolean(),
421
+ replay: z5.boolean(),
422
+ live_attach: z5.boolean(),
423
+ control_transfer: z5.boolean(),
424
+ e2e: z5.boolean(),
425
+ implemented_transports: z5.array(webTTYTransportSchema),
426
+ recording_modes: z5.array(webTTYRecordingModeSchema),
427
+ encryption_modes: z5.array(webTTYEncryptionModeSchema),
428
+ required_permissions: z5.record(z5.string(), z5.array(z5.string()))
413
429
  });
414
- var webTTYSessionLiveSchema = z4.object({
415
- available: z4.boolean(),
416
- attachable: z4.boolean(),
417
- participant_count: z4.number().int().nonnegative(),
418
- controller_participant_id: z4.string().optional(),
419
- has_upstream: z4.boolean()
430
+ var webTTYSessionLiveSchema = z5.object({
431
+ available: z5.boolean(),
432
+ attachable: z5.boolean(),
433
+ participant_count: z5.number().int().nonnegative(),
434
+ controller_participant_id: z5.string().optional(),
435
+ has_upstream: z5.boolean()
420
436
  });
421
- var webTTYParticipantLiveSchema = z4.object({
422
- connected: z4.boolean(),
423
- controller: z4.boolean()
437
+ var webTTYParticipantLiveSchema = z5.object({
438
+ connected: z5.boolean(),
439
+ controller: z5.boolean()
424
440
  });
425
- var webTTYSessionSchema = z4.object({
426
- id: z4.string(),
427
- workspace_id: z4.string().optional(),
428
- project_id: z4.string().optional(),
429
- cluster_id: z4.string().optional(),
430
- server_id: z4.string().optional(),
431
- tunnel_id: z4.string(),
432
- client_id: z4.string().optional(),
433
- initiator_user_id: z4.string().optional(),
434
- group_id: z4.string().optional(),
441
+ var webTTYSessionSchema = z5.object({
442
+ id: z5.string(),
443
+ workspace_id: z5.string().optional(),
444
+ project_id: z5.string().optional(),
445
+ cluster_id: z5.string().optional(),
446
+ server_id: z5.string().optional(),
447
+ tunnel_id: z5.string(),
448
+ client_id: z5.string().optional(),
449
+ initiator_user_id: z5.string().optional(),
450
+ group_id: z5.string().optional(),
435
451
  status: webTTYSessionStatusSchema,
436
452
  session_mode: webTTYSessionModeSchema,
437
453
  recording_mode: webTTYRecordingModeSchema,
438
454
  encryption_mode: webTTYEncryptionModeSchema,
439
455
  downstream_transport: webTTYTransportSchema.optional(),
440
456
  upstream_transport: webTTYTransportSchema.optional(),
441
- command_meta: z4.unknown().optional(),
457
+ command_meta: z5.unknown().optional(),
442
458
  context: webTTYContextMetadataSchema.optional(),
443
459
  started_at: isoDateTimeSchema2,
444
460
  ended_at: isoDateTimeSchema2.optional(),
445
- exit_code: z4.number().int().optional(),
446
- error_code: z4.string().optional(),
447
- error_message: z4.string().optional(),
461
+ exit_code: z5.number().int().optional(),
462
+ error_code: z5.string().optional(),
463
+ error_message: z5.string().optional(),
448
464
  live: webTTYSessionLiveSchema.optional()
449
465
  }).passthrough();
450
- var webTTYSessionGroupSchema = z4.object({
451
- id: z4.string(),
452
- workspace_id: z4.string().optional(),
453
- project_id: z4.string().optional(),
454
- initiator_user_id: z4.string().optional(),
466
+ var webTTYSessionGroupSchema = z5.object({
467
+ id: z5.string(),
468
+ workspace_id: z5.string().optional(),
469
+ project_id: z5.string().optional(),
470
+ initiator_user_id: z5.string().optional(),
455
471
  context: webTTYContextMetadataSchema.optional(),
456
472
  created_at: isoDateTimeSchema2,
457
473
  updated_at: isoDateTimeSchema2,
458
474
  closed_at: isoDateTimeSchema2.optional()
459
475
  }).passthrough();
460
- var webTTYParticipantSchema = z4.object({
461
- id: z4.string(),
462
- session_id: z4.string(),
463
- user_id: z4.string().optional(),
464
- device_id: z4.string().optional(),
465
- browser_id: z4.string().optional(),
476
+ var webTTYParticipantSchema = z5.object({
477
+ id: z5.string(),
478
+ session_id: z5.string(),
479
+ user_id: z5.string().optional(),
480
+ device_id: z5.string().optional(),
481
+ browser_id: z5.string().optional(),
466
482
  role: webTTYParticipantRoleSchema,
467
483
  attached_at: isoDateTimeSchema2,
468
484
  detached_at: isoDateTimeSchema2.optional(),
469
- controller: z4.boolean(),
470
- grant_state: z4.string().optional(),
471
- attach_grant: z4.string().optional(),
485
+ controller: z5.boolean(),
486
+ grant_state: z5.string().optional(),
487
+ attach_grant: z5.string().optional(),
472
488
  attach_grant_expires_at: isoDateTimeSchema2.optional(),
473
489
  live: webTTYParticipantLiveSchema.optional()
474
490
  }).passthrough();
475
- var webTTYCryptoMetadataSchema = z4.object({
476
- payload_suite: z4.string().optional(),
477
- payload_key_id: z4.string().optional(),
478
- nonce: z4.string().optional(),
479
- key_envelope_suite: z4.string().optional(),
480
- key_envelopes: z4.unknown().optional(),
481
- key_context: z4.unknown().optional(),
482
- key_context_raw: z4.string().optional()
491
+ var webTTYCryptoMetadataSchema = z5.object({
492
+ payload_suite: z5.string().optional(),
493
+ payload_key_id: z5.string().optional(),
494
+ nonce: z5.string().optional(),
495
+ key_envelope_suite: z5.string().optional(),
496
+ key_envelopes: z5.unknown().optional(),
497
+ key_context: z5.unknown().optional(),
498
+ key_context_raw: z5.string().optional()
483
499
  }).passthrough();
484
- var webTTYSessionEventSchema = z4.object({
485
- id: z4.string(),
486
- session_id: z4.string(),
500
+ var webTTYSessionEventSchema = z5.object({
501
+ id: z5.string(),
502
+ session_id: z5.string(),
487
503
  seq: decimalCursorSchema,
488
504
  created_at: isoDateTimeSchema2,
489
505
  type: webTTYSessionEventTypeSchema,
490
506
  direction: webTTYEventDirectionSchema.optional(),
491
507
  stream_type: webTTYStreamTypeSchema.optional(),
492
- participant_id: z4.string().optional(),
493
- payload_length: z4.number().int().nonnegative().optional(),
494
- payload_ciphertext: z4.string().optional(),
495
- payload_plaintext: z4.string().optional(),
508
+ participant_id: z5.string().optional(),
509
+ payload_length: z5.number().int().nonnegative().optional(),
510
+ payload_ciphertext: z5.string().optional(),
511
+ payload_plaintext: z5.string().optional(),
496
512
  crypto: webTTYCryptoMetadataSchema.optional(),
497
- prev_hash: z4.string().optional(),
498
- hash: z4.string().optional(),
499
- metadata: z4.unknown().optional()
513
+ prev_hash: z5.string().optional(),
514
+ hash: z5.string().optional(),
515
+ metadata: z5.unknown().optional()
500
516
  }).passthrough().superRefine((value, ctx) => {
501
517
  rejectCryptoKeyEnvelopes(value.crypto, ctx, ["crypto"]);
502
518
  });
503
519
  var webTTYKeyGrantBaseShape = {
504
- id: z4.string(),
505
- session_id: z4.string(),
506
- recipient_id: z4.string(),
507
- recipient_kind: z4.string(),
508
- granted_by: z4.string().optional(),
520
+ id: z5.string(),
521
+ session_id: z5.string(),
522
+ recipient_id: z5.string(),
523
+ recipient_kind: z5.string(),
524
+ granted_by: z5.string().optional(),
509
525
  crypto: webTTYCryptoMetadataSchema,
510
526
  created_at: isoDateTimeSchema2,
511
527
  revoked_at: isoDateTimeSchema2.optional()
512
528
  };
513
- var webTTYKeyGrantSchema = z4.object(webTTYKeyGrantBaseShape).passthrough().superRefine((value, ctx) => {
529
+ var webTTYKeyGrantSchema = z5.object(webTTYKeyGrantBaseShape).passthrough().superRefine((value, ctx) => {
514
530
  if (Object.prototype.hasOwnProperty.call(value, "wrapped_key")) {
515
531
  ctx.addIssue({
516
- code: z4.ZodIssueCode.custom,
532
+ code: z5.ZodIssueCode.custom,
517
533
  message: "wrapped_key is available only from the WebTTY decrypt-material endpoint.",
518
534
  path: ["wrapped_key"]
519
535
  });
520
536
  }
521
537
  rejectCryptoKeyEnvelopes(value.crypto, ctx, ["crypto"]);
522
538
  });
523
- var webTTYKeyGrantDecryptMaterialSchema = z4.object({
539
+ var webTTYKeyGrantDecryptMaterialSchema = z5.object({
524
540
  ...webTTYKeyGrantBaseShape,
525
- wrapped_key: z4.string().optional()
541
+ wrapped_key: z5.string().optional()
526
542
  }).passthrough();
527
- var webTTYControlRequestSchema = z4.object({
528
- id: z4.string(),
529
- session_id: z4.string(),
530
- requester_participant_id: z4.string(),
531
- requester_user_id: z4.string().optional(),
532
- approver_participant_id: z4.string().optional(),
533
- approver_user_id: z4.string().optional(),
543
+ var webTTYControlRequestSchema = z5.object({
544
+ id: z5.string(),
545
+ session_id: z5.string(),
546
+ requester_participant_id: z5.string(),
547
+ requester_user_id: z5.string().optional(),
548
+ approver_participant_id: z5.string().optional(),
549
+ approver_user_id: z5.string().optional(),
534
550
  status: webTTYControlRequestStatusSchema,
535
- reason: z4.string().optional(),
536
- metadata: z4.unknown().optional(),
551
+ reason: z5.string().optional(),
552
+ metadata: z5.unknown().optional(),
537
553
  created_at: isoDateTimeSchema2,
538
554
  updated_at: isoDateTimeSchema2,
539
555
  resolved_at: isoDateTimeSchema2.optional(),
540
556
  expires_at: isoDateTimeSchema2.optional()
541
557
  }).passthrough();
542
- var listWebTTYSessionsFiltersSchema = z4.object({
543
- server_id: z4.string().optional(),
544
- tunnel_id: z4.string().optional(),
545
- user_id: z4.string().optional(),
546
- group_id: z4.string().optional(),
558
+ var listWebTTYSessionsFiltersSchema = z5.object({
559
+ server_id: z5.string().optional(),
560
+ tunnel_id: z5.string().optional(),
561
+ user_id: z5.string().optional(),
562
+ group_id: z5.string().optional(),
547
563
  origin: webTTYOriginSchema.optional(),
548
564
  status: webTTYSessionStatusSchema.optional(),
549
565
  started_from: isoDateTimeSchema2.optional(),
550
566
  started_to: isoDateTimeSchema2.optional()
551
567
  });
552
- var listWebTTYSessionsParamsSchema = z4.object({
553
- limit: z4.number().int().min(1).optional(),
568
+ var listWebTTYSessionsParamsSchema = z5.object({
569
+ limit: z5.number().int().min(1).optional(),
554
570
  filters: listWebTTYSessionsFiltersSchema.optional()
555
571
  });
556
- var listWebTTYSessionGroupsFiltersSchema = z4.object({
557
- initiator_user_id: z4.string().optional(),
572
+ var listWebTTYSessionGroupsFiltersSchema = z5.object({
573
+ initiator_user_id: z5.string().optional(),
558
574
  origin: webTTYOriginSchema.optional(),
559
575
  created_from: isoDateTimeSchema2.optional(),
560
576
  created_to: isoDateTimeSchema2.optional()
561
577
  });
562
- var listWebTTYSessionGroupsParamsSchema = z4.object({
563
- limit: z4.number().int().min(1).optional(),
578
+ var listWebTTYSessionGroupsParamsSchema = z5.object({
579
+ limit: z5.number().int().min(1).optional(),
564
580
  filters: listWebTTYSessionGroupsFiltersSchema.optional()
565
581
  });
566
- var readWebTTYSessionEventsParamsSchema = z4.object({
582
+ var readWebTTYSessionEventsParamsSchema = z5.object({
567
583
  from_seq: webTTYSequenceCursorInputSchema.optional(),
568
- limit: z4.number().int().min(1).optional()
584
+ limit: z5.number().int().min(1).optional()
569
585
  });
570
- var listWebTTYKeyGrantDecryptMaterialParamsSchema = z4.object({
571
- recipient_id: z4.string().optional(),
572
- recipient_kind: z4.string().optional()
586
+ var listWebTTYKeyGrantDecryptMaterialParamsSchema = z5.object({
587
+ recipient_id: z5.string().optional(),
588
+ recipient_kind: z5.string().optional()
573
589
  });
574
- var listWebTTYControlRequestsFiltersSchema = z4.object({
590
+ var listWebTTYControlRequestsFiltersSchema = z5.object({
575
591
  status: webTTYControlRequestStatusSchema.optional(),
576
- requester_user_id: z4.string().optional()
592
+ requester_user_id: z5.string().optional()
577
593
  });
578
- var listWebTTYControlRequestsParamsSchema = z4.object({
579
- limit: z4.number().int().min(1).optional(),
594
+ var listWebTTYControlRequestsParamsSchema = z5.object({
595
+ limit: z5.number().int().min(1).optional(),
580
596
  filters: listWebTTYControlRequestsFiltersSchema.optional()
581
597
  });
582
- var attachWebTTYParticipantParamsSchema = z4.object({
583
- role: z4.literal("spectator").optional(),
584
- device_id: z4.string().optional(),
585
- browser_id: z4.string().optional(),
598
+ var attachWebTTYParticipantParamsSchema = z5.object({
599
+ role: z5.literal("spectator").optional(),
600
+ device_id: z5.string().optional(),
601
+ browser_id: z5.string().optional(),
586
602
  transport: webTTYTransportSchema.optional(),
587
- grant_state: z4.string().optional(),
603
+ grant_state: z5.string().optional(),
588
604
  metadata: jsonRecordSchema.optional()
589
605
  });
590
- var detachWebTTYParticipantParamsSchema = z4.object({
591
- reason: z4.string().optional(),
606
+ var detachWebTTYParticipantParamsSchema = z5.object({
607
+ reason: z5.string().optional(),
592
608
  metadata: jsonRecordSchema.optional()
593
609
  });
594
- var createWebTTYControlRequestParamsSchema = z4.object({
595
- participant_id: z4.string(),
596
- reason: z4.string().optional(),
610
+ var createWebTTYControlRequestParamsSchema = z5.object({
611
+ participant_id: z5.string(),
612
+ reason: z5.string().optional(),
597
613
  metadata: jsonRecordSchema.optional(),
598
614
  expires_at: isoDateTimeSchema2.optional()
599
615
  });
600
- var resolveWebTTYControlRequestParamsSchema = z4.object({
601
- action: z4.enum(["grant", "refuse", "revoke"]),
602
- approver_participant_id: z4.string().optional(),
603
- reason: z4.string().optional()
616
+ var resolveWebTTYControlRequestParamsSchema = z5.object({
617
+ action: z5.enum(["grant", "refuse", "revoke"]),
618
+ approver_participant_id: z5.string().optional(),
619
+ reason: z5.string().optional()
604
620
  });
605
- var webTTYSessionListSchema = z4.array(webTTYSessionSchema);
606
- var webTTYSessionGroupListSchema = z4.array(webTTYSessionGroupSchema);
607
- var webTTYParticipantListSchema = z4.array(webTTYParticipantSchema);
608
- var webTTYSessionEventListSchema = z4.array(webTTYSessionEventSchema);
609
- var webTTYKeyGrantListSchema = z4.array(webTTYKeyGrantSchema);
610
- var webTTYKeyGrantDecryptMaterialListSchema = z4.array(
621
+ var webTTYSessionListSchema = z5.array(webTTYSessionSchema);
622
+ var webTTYSessionGroupListSchema = z5.array(webTTYSessionGroupSchema);
623
+ var webTTYParticipantListSchema = z5.array(webTTYParticipantSchema);
624
+ var webTTYSessionEventListSchema = z5.array(webTTYSessionEventSchema);
625
+ var webTTYKeyGrantListSchema = z5.array(webTTYKeyGrantSchema);
626
+ var webTTYKeyGrantDecryptMaterialListSchema = z5.array(
611
627
  webTTYKeyGrantDecryptMaterialSchema
612
628
  );
613
- var webTTYControlRequestListSchema = z4.array(webTTYControlRequestSchema);
629
+ var webTTYControlRequestListSchema = z5.array(webTTYControlRequestSchema);
614
630
  function pathId(kind, value) {
615
631
  const normalized = value.trim();
616
632
  if (!normalized) {
@@ -766,151 +782,146 @@ var RstreamWebTTYResource = class {
766
782
  };
767
783
 
768
784
  // src/event.ts
769
- import { tunnelSchema } from "@rstreamlabs/rstream/tunnel";
770
- import * as z5 from "zod";
771
- var isoDateTimeSchema3 = z5.string().datetime({ offset: true });
772
- var initialStateSchema = z5.object({
785
+ import { tunnelSchema as tunnelSchema2 } from "@rstreamlabs/rstream/tunnel";
786
+ import * as z6 from "zod";
787
+ var isoDateTimeSchema3 = z6.string().datetime({ offset: true });
788
+ var initialStateSchema = z6.object({
773
789
  snapshot_at: isoDateTimeSchema3,
774
- clients: z5.array(clientSchema),
775
- tunnels: z5.array(tunnelSchema)
790
+ clients: z6.array(listedClientSchema),
791
+ tunnels: z6.array(listedTunnelSchema)
776
792
  });
777
- var eventBaseSchema = z5.object({
778
- id: z5.string().optional(),
793
+ var eventBaseSchema = z6.object({
794
+ id: z6.string().optional(),
779
795
  created_at: isoDateTimeSchema3.optional(),
780
- user_id: z5.string().optional(),
781
- workspace_id: z5.string().optional(),
782
- project_id: z5.string().optional(),
783
- cluster_id: z5.string().optional()
796
+ user_id: z6.string().optional(),
797
+ workspace_id: z6.string().optional(),
798
+ project_id: z6.string().optional(),
799
+ cluster_id: z6.string().optional()
784
800
  });
785
- var withEventBase = (shape) => z5.object(shape).merge(eventBaseSchema).passthrough();
801
+ var withEventBase = (shape) => z6.object(shape).merge(eventBaseSchema).passthrough();
786
802
  var stateInitialEventSchema = withEventBase({
787
- type: z5.literal("state.initial"),
803
+ type: z6.literal("state.initial"),
788
804
  object: initialStateSchema
789
805
  });
790
806
  var streamSummaryEventSchema = withEventBase({
791
- type: z5.literal("stream.summary"),
807
+ type: z6.literal("stream.summary"),
792
808
  object: streamSummarySchema
793
809
  });
810
+ var fullInventoryEventsSchema = [
811
+ withEventBase({
812
+ type: z6.literal("client.created"),
813
+ object: clientSchema2
814
+ }),
815
+ withEventBase({
816
+ type: z6.literal("client.updated"),
817
+ object: clientSchema2
818
+ }),
819
+ withEventBase({
820
+ type: z6.literal("client.deleted"),
821
+ object: clientSchema2
822
+ }),
823
+ withEventBase({
824
+ type: z6.literal("tunnel.created"),
825
+ object: tunnelSchema2
826
+ }),
827
+ withEventBase({
828
+ type: z6.literal("tunnel.updated"),
829
+ object: tunnelSchema2
830
+ }),
831
+ withEventBase({
832
+ type: z6.literal("tunnel.deleted"),
833
+ object: tunnelSchema2
834
+ })
835
+ ];
794
836
  var commonEventsSchema = [
795
837
  withEventBase({
796
- type: z5.literal("client.created"),
797
- object: clientSchema
838
+ type: z6.literal("client.created"),
839
+ object: listedClientSchema
798
840
  }),
799
841
  withEventBase({
800
- type: z5.literal("client.updated"),
801
- object: clientSchema
842
+ type: z6.literal("client.updated"),
843
+ object: listedClientSchema
802
844
  }),
803
845
  withEventBase({
804
- type: z5.literal("client.deleted"),
805
- object: clientSchema
846
+ type: z6.literal("client.deleted"),
847
+ object: listedClientSchema
806
848
  }),
807
849
  withEventBase({
808
- type: z5.literal("tunnel.created"),
809
- object: tunnelSchema
850
+ type: z6.literal("tunnel.created"),
851
+ object: listedTunnelSchema
810
852
  }),
811
853
  withEventBase({
812
- type: z5.literal("tunnel.updated"),
813
- object: tunnelSchema
854
+ type: z6.literal("tunnel.updated"),
855
+ object: listedTunnelSchema
814
856
  }),
815
857
  withEventBase({
816
- type: z5.literal("tunnel.deleted"),
817
- object: tunnelSchema
858
+ type: z6.literal("tunnel.deleted"),
859
+ object: listedTunnelSchema
818
860
  })
819
861
  ];
820
862
  var webTTYEventsSchema = [
821
863
  withEventBase({
822
- type: z5.literal("webtty.session.created"),
864
+ type: z6.literal("webtty.session.created"),
823
865
  object: webTTYSessionSchema
824
866
  }),
825
867
  withEventBase({
826
- type: z5.literal("webtty.session.updated"),
827
- object: z5.union([webTTYSessionSchema, webTTYSessionGroupSchema])
868
+ type: z6.literal("webtty.session.updated"),
869
+ object: z6.union([webTTYSessionSchema, webTTYSessionGroupSchema])
828
870
  }),
829
871
  withEventBase({
830
- type: z5.literal("webtty.session.ended"),
872
+ type: z6.literal("webtty.session.ended"),
831
873
  object: webTTYSessionSchema
832
874
  }),
833
875
  withEventBase({
834
- type: z5.literal("webtty.participant.joined"),
876
+ type: z6.literal("webtty.participant.joined"),
835
877
  object: webTTYParticipantSchema
836
878
  }),
837
879
  withEventBase({
838
- type: z5.literal("webtty.participant.updated"),
880
+ type: z6.literal("webtty.participant.updated"),
839
881
  object: webTTYParticipantSchema
840
882
  }),
841
883
  withEventBase({
842
- type: z5.literal("webtty.participant.left"),
884
+ type: z6.literal("webtty.participant.left"),
843
885
  object: webTTYParticipantSchema
844
886
  }),
845
887
  withEventBase({
846
- type: z5.literal("webtty.control.requested"),
888
+ type: z6.literal("webtty.control.requested"),
847
889
  object: webTTYControlRequestSchema
848
890
  }),
849
891
  withEventBase({
850
- type: z5.literal("webtty.control.granted"),
892
+ type: z6.literal("webtty.control.granted"),
851
893
  object: webTTYControlRequestSchema
852
894
  }),
853
895
  withEventBase({
854
- type: z5.literal("webtty.control.refused"),
896
+ type: z6.literal("webtty.control.refused"),
855
897
  object: webTTYControlRequestSchema
856
898
  }),
857
899
  withEventBase({
858
- type: z5.literal("webtty.control.revoked"),
900
+ type: z6.literal("webtty.control.revoked"),
859
901
  object: webTTYControlRequestSchema
860
902
  })
861
903
  ];
862
904
  var webhookDeliverableEventsSchema = [
863
- commonEventsSchema[0],
864
- commonEventsSchema[2],
865
- commonEventsSchema[3],
866
- commonEventsSchema[5],
905
+ fullInventoryEventsSchema[0],
906
+ fullInventoryEventsSchema[2],
907
+ fullInventoryEventsSchema[3],
908
+ fullInventoryEventsSchema[5],
867
909
  ...webTTYEventsSchema
868
910
  ];
869
- var wsEventsSchema = z5.union([
911
+ var wsEventsSchema = z6.union([
870
912
  stateInitialEventSchema,
871
913
  ...commonEventsSchema,
872
914
  ...webTTYEventsSchema
873
915
  ]);
874
- var webhookEventsSchema = z5.union(webhookDeliverableEventsSchema);
916
+ var webhookEventsSchema = z6.union(webhookDeliverableEventsSchema);
875
917
  var projectLogEventsSchema = streamSummaryEventSchema;
876
- var eventSchema = z5.union([
918
+ var eventSchema = z6.union([
877
919
  wsEventsSchema,
878
920
  webhookEventsSchema,
879
921
  projectLogEventsSchema
880
922
  ]);
881
923
 
882
- // src/tunnel.ts
883
- import { tunnelSchema as tunnelSchema2 } from "@rstreamlabs/rstream/tunnel";
884
- import * as z6 from "zod";
885
- var DEFAULT_PUBLISHED_PORT = 443;
886
- var tunnelFilterSchema = tunnelSchema2.pick({
887
- id: true,
888
- name: true,
889
- type: true,
890
- status: true,
891
- client_id: true,
892
- user_id: true,
893
- publish: true,
894
- protocol: true,
895
- hostname: true,
896
- http_version: true,
897
- labels: true
898
- }).partial();
899
- var listTunnelsParamsSchema = z6.object({
900
- limit: z6.number().int().min(1).optional(),
901
- filters: tunnelFilterSchema.optional()
902
- });
903
- var listTunnelsResponseSchema = z6.array(tunnelSchema2);
904
- function formatTunnelHost(tunnel) {
905
- if (!tunnel.hostname) return tunnel.host;
906
- if (!tunnel.port || tunnel.port === DEFAULT_PUBLISHED_PORT) {
907
- return tunnel.hostname;
908
- }
909
- return `${tunnel.hostname}:${tunnel.port}`;
910
- }
911
-
912
924
  // src/openapi.ts
913
- import { tunnelSchema as tunnelSchema3 } from "@rstreamlabs/rstream/tunnel";
914
925
  import * as z7 from "zod";
915
926
  var jsonContentType = "application/json";
916
927
  var openApiContentType = "application/vnd.oai.openapi+json;version=3.1";
@@ -989,12 +1000,6 @@ var readEngineStateRule = {
989
1000
  action: "read"
990
1001
  };
991
1002
  var readEngineStateRules = [readEngineStateRule];
992
- var readEngineStreamsRules = [
993
- {
994
- resource: "engine.streams",
995
- action: "read"
996
- }
997
- ];
998
1003
  var watchParamsSchema = z7.object({
999
1004
  clients: clientFilterSchema.optional(),
1000
1005
  tunnels: tunnelFilterSchema.optional()
@@ -1224,11 +1229,11 @@ var engineOpenApiDocument = {
1224
1229
  }
1225
1230
  }
1226
1231
  },
1227
- Client: jsonSchemaFor(clientSchema),
1232
+ Client: jsonSchemaFor(listedClientSchema),
1228
1233
  Event: jsonSchemaFor(wsEventsSchema),
1229
1234
  ListClientsParams: jsonSchemaFor(listClientsParamsSchema),
1230
1235
  ListTunnelsParams: jsonSchemaFor(listTunnelsParamsSchema),
1231
- TunnelListItem: jsonSchemaFor(tunnelSchema3),
1236
+ TunnelListItem: jsonSchemaFor(listedTunnelSchema),
1232
1237
  WatchParams: jsonSchemaFor(watchParamsSchema)
1233
1238
  }
1234
1239
  },
@@ -1409,19 +1414,20 @@ var engineOpenApiDocument = {
1409
1414
  get: {
1410
1415
  tags: ["Runtime inventory"],
1411
1416
  summary: "List visible engine clients.",
1417
+ "x-rstream-token-scope": "resources.tunnels.scopes.clients.list",
1412
1418
  operationId: "list_engine_clients",
1413
1419
  parameters: [{ $ref: "#/components/parameters/ListClientsParams" }],
1414
1420
  security: [{ bearerAuth: [] }, { mutualTLS: [] }],
1415
1421
  responses: {
1416
1422
  "200": jsonArrayResponse(
1417
- "Visible clients.",
1423
+ "Visible clients. Fine-grained list scopes may filter objects and project fields.",
1418
1424
  "#/components/schemas/Client"
1419
1425
  ),
1420
1426
  "400": { $ref: "#/components/responses/BadRequest" },
1421
1427
  "401": { $ref: "#/components/responses/Unauthorized" },
1422
1428
  "403": { $ref: "#/components/responses/Forbidden" }
1423
1429
  },
1424
- "x-rstream-required-rules": readEngineStreamsRules
1430
+ "x-rstream-required-rules": readEngineStateRules
1425
1431
  }
1426
1432
  },
1427
1433
  "/api/tunnels": {
@@ -1441,7 +1447,7 @@ var engineOpenApiDocument = {
1441
1447
  "403": { $ref: "#/components/responses/Forbidden" }
1442
1448
  },
1443
1449
  "x-rstream-required-rules": readEngineStateRules,
1444
- "x-rstream-token-metadata-scope": "metadata.scopes.tunnels.list"
1450
+ "x-rstream-token-scope": "resources.tunnels.scopes.tunnels.list"
1445
1451
  }
1446
1452
  },
1447
1453
  "/api/sse": {
@@ -1492,10 +1498,16 @@ var engineOpenApiJson = `${JSON.stringify(
1492
1498
  `;
1493
1499
 
1494
1500
  export {
1495
- clientSchema,
1501
+ listedClientSchema,
1496
1502
  clientFilterSchema,
1497
1503
  listClientsParamsSchema,
1498
1504
  listClientsResponseSchema,
1505
+ clientSchema2 as clientSchema,
1506
+ tunnelFilterSchema,
1507
+ listTunnelsParamsSchema,
1508
+ listedTunnelSchema,
1509
+ listTunnelsResponseSchema,
1510
+ formatTunnelHost,
1499
1511
  webTTYTransportSchema,
1500
1512
  webTTYRecordingModeSchema,
1501
1513
  webTTYEncryptionModeSchema,
@@ -1535,10 +1547,6 @@ export {
1535
1547
  webhookEventsSchema,
1536
1548
  projectLogEventsSchema,
1537
1549
  eventSchema,
1538
- tunnelFilterSchema,
1539
- listTunnelsParamsSchema,
1540
- listTunnelsResponseSchema,
1541
- formatTunnelHost,
1542
1550
  engineOpenApiDocument,
1543
1551
  engineOpenApiJson
1544
1552
  };