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