@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.
- package/README.md +24 -1
- package/dist/{chunk-DQN5T7CI.mjs → chunk-TJNLK4CU.mjs} +391 -383
- package/dist/index.d.mts +673 -591
- package/dist/index.d.ts +673 -591
- package/dist/index.js +414 -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 +377 -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,259 @@ 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()
|
|
76
92
|
}).passthrough();
|
|
77
93
|
|
|
78
94
|
// 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:
|
|
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 =
|
|
90
|
-
version:
|
|
91
|
-
cipher:
|
|
92
|
-
protocol:
|
|
93
|
-
curve:
|
|
94
|
-
ech:
|
|
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 =
|
|
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 =
|
|
102
|
-
|
|
103
|
-
|
|
117
|
+
var httpHeadersSchema = z4.record(
|
|
118
|
+
z4.string(),
|
|
119
|
+
z4.union([z4.string(), z4.array(z4.string())])
|
|
104
120
|
);
|
|
105
|
-
var httpProtocolSchema =
|
|
106
|
-
var httpRequestSchema =
|
|
121
|
+
var httpProtocolSchema = z4.enum(["http/1.1", "h2", "h2c", "h3"]);
|
|
122
|
+
var httpRequestSchema = z4.object({
|
|
107
123
|
method: nonEmptyStringSchema,
|
|
108
|
-
scheme:
|
|
124
|
+
scheme: z4.string().min(1).optional(),
|
|
109
125
|
host: nonEmptyStringSchema.optional(),
|
|
110
126
|
path: nonEmptyStringSchema.optional(),
|
|
111
|
-
query:
|
|
127
|
+
query: z4.string().optional(),
|
|
112
128
|
url: nonEmptyStringSchema.optional(),
|
|
113
129
|
headers: httpHeadersSchema.optional(),
|
|
114
|
-
userAgent:
|
|
130
|
+
userAgent: z4.string().optional()
|
|
115
131
|
});
|
|
116
|
-
var httpResponseSchema =
|
|
117
|
-
status:
|
|
132
|
+
var httpResponseSchema = z4.object({
|
|
133
|
+
status: z4.number().int().min(100).max(999),
|
|
118
134
|
headers: httpHeadersSchema.optional()
|
|
119
135
|
});
|
|
120
|
-
var httpRequestStageSchema =
|
|
136
|
+
var httpRequestStageSchema = z4.object({
|
|
121
137
|
protocol: httpProtocolSchema.optional(),
|
|
122
138
|
request: httpRequestSchema
|
|
123
139
|
});
|
|
124
|
-
var httpResponseStageSchema =
|
|
140
|
+
var httpResponseStageSchema = z4.object({
|
|
125
141
|
protocol: httpProtocolSchema.optional(),
|
|
126
142
|
response: httpResponseSchema
|
|
127
143
|
});
|
|
128
|
-
var streamEntrySchema =
|
|
129
|
-
kind:
|
|
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:
|
|
151
|
+
transport: z4.enum(["rstream", "tls", "quic", "dtls", "http", "tcp"]).optional()
|
|
136
152
|
});
|
|
137
|
-
var tokenSourceSchema =
|
|
153
|
+
var tokenSourceSchema = z4.enum([
|
|
138
154
|
"authorization",
|
|
139
155
|
"query",
|
|
140
156
|
"client",
|
|
141
157
|
"unknown"
|
|
142
158
|
]);
|
|
143
|
-
var tokenTypeSchema =
|
|
144
|
-
var firewallRuleSchema =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
kind:
|
|
149
|
-
source:
|
|
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
|
-
|
|
152
|
-
kind:
|
|
153
|
-
source:
|
|
167
|
+
z4.object({
|
|
168
|
+
kind: z4.literal("rstream"),
|
|
169
|
+
source: z4.literal("private_rstream").optional()
|
|
154
170
|
}),
|
|
155
|
-
|
|
156
|
-
kind:
|
|
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 =
|
|
177
|
+
var unauthorizedSourceSchema = z4.object({
|
|
162
178
|
source: tokenSourceSchema
|
|
163
179
|
});
|
|
164
|
-
var unauthorizedReasonSchema = (shape) =>
|
|
165
|
-
var unauthorizedSchema =
|
|
180
|
+
var unauthorizedReasonSchema = (shape) => z4.object(shape).merge(unauthorizedSourceSchema);
|
|
181
|
+
var unauthorizedSchema = z4.discriminatedUnion("reason", [
|
|
166
182
|
unauthorizedReasonSchema({
|
|
167
|
-
reason:
|
|
183
|
+
reason: z4.literal("missing_token")
|
|
168
184
|
}),
|
|
169
185
|
unauthorizedReasonSchema({
|
|
170
|
-
reason:
|
|
186
|
+
reason: z4.literal("invalid_token")
|
|
171
187
|
}),
|
|
172
188
|
unauthorizedReasonSchema({
|
|
173
|
-
reason:
|
|
189
|
+
reason: z4.literal("expired_token")
|
|
174
190
|
}),
|
|
175
191
|
unauthorizedReasonSchema({
|
|
176
|
-
reason:
|
|
192
|
+
reason: z4.literal("invalid_secret")
|
|
177
193
|
}),
|
|
178
194
|
unauthorizedReasonSchema({
|
|
179
|
-
reason:
|
|
195
|
+
reason: z4.literal("user_mismatch")
|
|
180
196
|
}),
|
|
181
197
|
unauthorizedReasonSchema({
|
|
182
|
-
reason:
|
|
198
|
+
reason: z4.literal("insufficient_scope")
|
|
183
199
|
}),
|
|
184
200
|
unauthorizedReasonSchema({
|
|
185
|
-
reason:
|
|
186
|
-
policy:
|
|
187
|
-
value:
|
|
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 =
|
|
191
|
-
|
|
192
|
-
kind:
|
|
206
|
+
var failureSchema = z4.discriminatedUnion("kind", [
|
|
207
|
+
z4.object({
|
|
208
|
+
kind: z4.literal("timeout"),
|
|
193
209
|
timeoutMs: intNonNegSchema.optional(),
|
|
194
|
-
message:
|
|
210
|
+
message: z4.string().optional()
|
|
195
211
|
}),
|
|
196
|
-
|
|
197
|
-
kind:
|
|
212
|
+
z4.object({
|
|
213
|
+
kind: z4.literal("unauthorized"),
|
|
198
214
|
why: unauthorizedSchema,
|
|
199
|
-
message:
|
|
215
|
+
message: z4.string().optional()
|
|
200
216
|
}),
|
|
201
|
-
|
|
202
|
-
kind:
|
|
203
|
-
resource:
|
|
204
|
-
message:
|
|
217
|
+
z4.object({
|
|
218
|
+
kind: z4.literal("not_found"),
|
|
219
|
+
resource: z4.enum(["tunnel", "client", "route"]),
|
|
220
|
+
message: z4.string().optional()
|
|
205
221
|
}),
|
|
206
|
-
|
|
207
|
-
kind:
|
|
208
|
-
reason:
|
|
209
|
-
message:
|
|
222
|
+
z4.object({
|
|
223
|
+
kind: z4.literal("refused"),
|
|
224
|
+
reason: z4.enum(["capacity", "policy", "unsupported", "other"]),
|
|
225
|
+
message: z4.string().optional()
|
|
210
226
|
}),
|
|
211
|
-
|
|
212
|
-
|
|
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 =
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
decision:
|
|
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 =
|
|
238
|
+
var routedTunnelSchema = z4.object({
|
|
223
239
|
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:
|
|
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 =
|
|
252
|
+
var routingNodeSchema = z4.object({
|
|
237
253
|
engineId: nonEmptyStringSchema,
|
|
238
254
|
region: nonEmptyStringSchema,
|
|
239
255
|
generation: nonEmptyStringSchema.optional()
|
|
240
256
|
});
|
|
241
|
-
var routingPathSchema =
|
|
242
|
-
mode:
|
|
243
|
-
crossRegionRoutingAllowed:
|
|
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 =
|
|
249
|
-
|
|
250
|
-
decision:
|
|
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
|
-
|
|
270
|
+
z4.object({ decision: z4.literal("not_routed"), failure: failureSchema })
|
|
255
271
|
]);
|
|
256
|
-
var streamConnectedMetricsSchema =
|
|
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 =
|
|
278
|
+
var streamFailedMetricsSchema = z4.object({
|
|
263
279
|
time_to_fail_ms: numNonNegSchema.optional(),
|
|
264
280
|
establish_ms: numNonNegSchema.optional()
|
|
265
281
|
});
|
|
266
|
-
var terminationSchema =
|
|
267
|
-
by:
|
|
268
|
-
reason:
|
|
269
|
-
message:
|
|
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 =
|
|
272
|
-
outcome:
|
|
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 =
|
|
280
|
-
outcome:
|
|
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 =
|
|
303
|
+
var responseSchema = z4.discriminatedUnion("outcome", [
|
|
288
304
|
responseConnectedSchema,
|
|
289
305
|
responseFailedSchema
|
|
290
306
|
]);
|
|
291
|
-
var streamWebTTYMetadataSchema =
|
|
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:
|
|
313
|
+
controller: z4.boolean().optional(),
|
|
298
314
|
recording_mode: webTTYRecordingModeSchema.optional(),
|
|
299
315
|
encryption_mode: webTTYEncryptionModeSchema.optional(),
|
|
300
|
-
encryption_policy:
|
|
301
|
-
e2e:
|
|
302
|
-
client_proof:
|
|
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:
|
|
323
|
+
origin_id: z4.string().optional(),
|
|
308
324
|
initiator_kind: webTTYInitiatorKindSchema.optional(),
|
|
309
|
-
device_id:
|
|
310
|
-
browser_id:
|
|
325
|
+
device_id: z4.string().optional(),
|
|
326
|
+
browser_id: z4.string().optional()
|
|
311
327
|
}).passthrough();
|
|
312
|
-
var streamSummarySchema =
|
|
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:
|
|
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
|
|
350
|
-
var isoDateTimeSchema2 =
|
|
351
|
-
var decimalCursorSchema =
|
|
352
|
-
var webTTYSequenceCursorInputSchema =
|
|
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
|
-
|
|
370
|
+
z5.number().int().nonnegative().safe().transform(String)
|
|
355
371
|
]);
|
|
356
|
-
var webTTYSessionStatusSchema =
|
|
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 =
|
|
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 =
|
|
386
|
+
var webTTYEventDirectionSchema = z5.enum([
|
|
371
387
|
"client_to_server",
|
|
372
388
|
"server_to_client",
|
|
373
389
|
"engine_internal"
|
|
374
390
|
]);
|
|
375
|
-
var webTTYStreamTypeSchema =
|
|
376
|
-
var webTTYSessionEventTypeSchema =
|
|
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 =
|
|
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:
|
|
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 =
|
|
401
|
-
managed_protocol:
|
|
402
|
-
store_configured:
|
|
403
|
-
session_listing:
|
|
404
|
-
recording:
|
|
405
|
-
replay:
|
|
406
|
-
live_attach:
|
|
407
|
-
control_transfer:
|
|
408
|
-
e2e:
|
|
409
|
-
implemented_transports:
|
|
410
|
-
recording_modes:
|
|
411
|
-
encryption_modes:
|
|
412
|
-
required_permissions:
|
|
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 =
|
|
415
|
-
available:
|
|
416
|
-
attachable:
|
|
417
|
-
participant_count:
|
|
418
|
-
controller_participant_id:
|
|
419
|
-
has_upstream:
|
|
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 =
|
|
422
|
-
connected:
|
|
423
|
-
controller:
|
|
437
|
+
var webTTYParticipantLiveSchema = z5.object({
|
|
438
|
+
connected: z5.boolean(),
|
|
439
|
+
controller: z5.boolean()
|
|
424
440
|
});
|
|
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:
|
|
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:
|
|
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:
|
|
446
|
-
error_code:
|
|
447
|
-
error_message:
|
|
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 =
|
|
451
|
-
id:
|
|
452
|
-
workspace_id:
|
|
453
|
-
project_id:
|
|
454
|
-
initiator_user_id:
|
|
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 =
|
|
461
|
-
id:
|
|
462
|
-
session_id:
|
|
463
|
-
user_id:
|
|
464
|
-
device_id:
|
|
465
|
-
browser_id:
|
|
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:
|
|
470
|
-
grant_state:
|
|
471
|
-
attach_grant:
|
|
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 =
|
|
476
|
-
payload_suite:
|
|
477
|
-
payload_key_id:
|
|
478
|
-
nonce:
|
|
479
|
-
key_envelope_suite:
|
|
480
|
-
key_envelopes:
|
|
481
|
-
key_context:
|
|
482
|
-
key_context_raw:
|
|
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 =
|
|
485
|
-
id:
|
|
486
|
-
session_id:
|
|
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:
|
|
493
|
-
payload_length:
|
|
494
|
-
payload_ciphertext:
|
|
495
|
-
payload_plaintext:
|
|
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:
|
|
498
|
-
hash:
|
|
499
|
-
metadata:
|
|
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:
|
|
505
|
-
session_id:
|
|
506
|
-
recipient_id:
|
|
507
|
-
recipient_kind:
|
|
508
|
-
granted_by:
|
|
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 =
|
|
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:
|
|
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 =
|
|
539
|
+
var webTTYKeyGrantDecryptMaterialSchema = z5.object({
|
|
524
540
|
...webTTYKeyGrantBaseShape,
|
|
525
|
-
wrapped_key:
|
|
541
|
+
wrapped_key: z5.string().optional()
|
|
526
542
|
}).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:
|
|
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:
|
|
536
|
-
metadata:
|
|
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 =
|
|
543
|
-
server_id:
|
|
544
|
-
tunnel_id:
|
|
545
|
-
user_id:
|
|
546
|
-
group_id:
|
|
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 =
|
|
553
|
-
limit:
|
|
568
|
+
var listWebTTYSessionsParamsSchema = z5.object({
|
|
569
|
+
limit: z5.number().int().min(1).optional(),
|
|
554
570
|
filters: listWebTTYSessionsFiltersSchema.optional()
|
|
555
571
|
});
|
|
556
|
-
var listWebTTYSessionGroupsFiltersSchema =
|
|
557
|
-
initiator_user_id:
|
|
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 =
|
|
563
|
-
limit:
|
|
578
|
+
var listWebTTYSessionGroupsParamsSchema = z5.object({
|
|
579
|
+
limit: z5.number().int().min(1).optional(),
|
|
564
580
|
filters: listWebTTYSessionGroupsFiltersSchema.optional()
|
|
565
581
|
});
|
|
566
|
-
var readWebTTYSessionEventsParamsSchema =
|
|
582
|
+
var readWebTTYSessionEventsParamsSchema = z5.object({
|
|
567
583
|
from_seq: webTTYSequenceCursorInputSchema.optional(),
|
|
568
|
-
limit:
|
|
584
|
+
limit: z5.number().int().min(1).optional()
|
|
569
585
|
});
|
|
570
|
-
var listWebTTYKeyGrantDecryptMaterialParamsSchema =
|
|
571
|
-
recipient_id:
|
|
572
|
-
recipient_kind:
|
|
586
|
+
var listWebTTYKeyGrantDecryptMaterialParamsSchema = z5.object({
|
|
587
|
+
recipient_id: z5.string().optional(),
|
|
588
|
+
recipient_kind: z5.string().optional()
|
|
573
589
|
});
|
|
574
|
-
var listWebTTYControlRequestsFiltersSchema =
|
|
590
|
+
var listWebTTYControlRequestsFiltersSchema = z5.object({
|
|
575
591
|
status: webTTYControlRequestStatusSchema.optional(),
|
|
576
|
-
requester_user_id:
|
|
592
|
+
requester_user_id: z5.string().optional()
|
|
577
593
|
});
|
|
578
|
-
var listWebTTYControlRequestsParamsSchema =
|
|
579
|
-
limit:
|
|
594
|
+
var listWebTTYControlRequestsParamsSchema = z5.object({
|
|
595
|
+
limit: z5.number().int().min(1).optional(),
|
|
580
596
|
filters: listWebTTYControlRequestsFiltersSchema.optional()
|
|
581
597
|
});
|
|
582
|
-
var attachWebTTYParticipantParamsSchema =
|
|
583
|
-
role:
|
|
584
|
-
device_id:
|
|
585
|
-
browser_id:
|
|
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:
|
|
603
|
+
grant_state: z5.string().optional(),
|
|
588
604
|
metadata: jsonRecordSchema.optional()
|
|
589
605
|
});
|
|
590
|
-
var detachWebTTYParticipantParamsSchema =
|
|
591
|
-
reason:
|
|
606
|
+
var detachWebTTYParticipantParamsSchema = z5.object({
|
|
607
|
+
reason: z5.string().optional(),
|
|
592
608
|
metadata: jsonRecordSchema.optional()
|
|
593
609
|
});
|
|
594
|
-
var createWebTTYControlRequestParamsSchema =
|
|
595
|
-
participant_id:
|
|
596
|
-
reason:
|
|
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 =
|
|
601
|
-
action:
|
|
602
|
-
approver_participant_id:
|
|
603
|
-
reason:
|
|
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 =
|
|
606
|
-
var webTTYSessionGroupListSchema =
|
|
607
|
-
var webTTYParticipantListSchema =
|
|
608
|
-
var webTTYSessionEventListSchema =
|
|
609
|
-
var webTTYKeyGrantListSchema =
|
|
610
|
-
var webTTYKeyGrantDecryptMaterialListSchema =
|
|
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 =
|
|
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
|
|
771
|
-
var isoDateTimeSchema3 =
|
|
772
|
-
var initialStateSchema =
|
|
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:
|
|
775
|
-
tunnels:
|
|
790
|
+
clients: z6.array(listedClientSchema),
|
|
791
|
+
tunnels: z6.array(listedTunnelSchema)
|
|
776
792
|
});
|
|
777
|
-
var eventBaseSchema =
|
|
778
|
-
id:
|
|
793
|
+
var eventBaseSchema = z6.object({
|
|
794
|
+
id: z6.string().optional(),
|
|
779
795
|
created_at: isoDateTimeSchema3.optional(),
|
|
780
|
-
user_id:
|
|
781
|
-
workspace_id:
|
|
782
|
-
project_id:
|
|
783
|
-
cluster_id:
|
|
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) =>
|
|
801
|
+
var withEventBase = (shape) => z6.object(shape).merge(eventBaseSchema).passthrough();
|
|
786
802
|
var stateInitialEventSchema = withEventBase({
|
|
787
|
-
type:
|
|
803
|
+
type: z6.literal("state.initial"),
|
|
788
804
|
object: initialStateSchema
|
|
789
805
|
});
|
|
790
806
|
var streamSummaryEventSchema = withEventBase({
|
|
791
|
-
type:
|
|
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:
|
|
797
|
-
object:
|
|
838
|
+
type: z6.literal("client.created"),
|
|
839
|
+
object: listedClientSchema
|
|
798
840
|
}),
|
|
799
841
|
withEventBase({
|
|
800
|
-
type:
|
|
801
|
-
object:
|
|
842
|
+
type: z6.literal("client.updated"),
|
|
843
|
+
object: listedClientSchema
|
|
802
844
|
}),
|
|
803
845
|
withEventBase({
|
|
804
|
-
type:
|
|
805
|
-
object:
|
|
846
|
+
type: z6.literal("client.deleted"),
|
|
847
|
+
object: listedClientSchema
|
|
806
848
|
}),
|
|
807
849
|
withEventBase({
|
|
808
|
-
type:
|
|
809
|
-
object:
|
|
850
|
+
type: z6.literal("tunnel.created"),
|
|
851
|
+
object: listedTunnelSchema
|
|
810
852
|
}),
|
|
811
853
|
withEventBase({
|
|
812
|
-
type:
|
|
813
|
-
object:
|
|
854
|
+
type: z6.literal("tunnel.updated"),
|
|
855
|
+
object: listedTunnelSchema
|
|
814
856
|
}),
|
|
815
857
|
withEventBase({
|
|
816
|
-
type:
|
|
817
|
-
object:
|
|
858
|
+
type: z6.literal("tunnel.deleted"),
|
|
859
|
+
object: listedTunnelSchema
|
|
818
860
|
})
|
|
819
861
|
];
|
|
820
862
|
var webTTYEventsSchema = [
|
|
821
863
|
withEventBase({
|
|
822
|
-
type:
|
|
864
|
+
type: z6.literal("webtty.session.created"),
|
|
823
865
|
object: webTTYSessionSchema
|
|
824
866
|
}),
|
|
825
867
|
withEventBase({
|
|
826
|
-
type:
|
|
827
|
-
object:
|
|
868
|
+
type: z6.literal("webtty.session.updated"),
|
|
869
|
+
object: z6.union([webTTYSessionSchema, webTTYSessionGroupSchema])
|
|
828
870
|
}),
|
|
829
871
|
withEventBase({
|
|
830
|
-
type:
|
|
872
|
+
type: z6.literal("webtty.session.ended"),
|
|
831
873
|
object: webTTYSessionSchema
|
|
832
874
|
}),
|
|
833
875
|
withEventBase({
|
|
834
|
-
type:
|
|
876
|
+
type: z6.literal("webtty.participant.joined"),
|
|
835
877
|
object: webTTYParticipantSchema
|
|
836
878
|
}),
|
|
837
879
|
withEventBase({
|
|
838
|
-
type:
|
|
880
|
+
type: z6.literal("webtty.participant.updated"),
|
|
839
881
|
object: webTTYParticipantSchema
|
|
840
882
|
}),
|
|
841
883
|
withEventBase({
|
|
842
|
-
type:
|
|
884
|
+
type: z6.literal("webtty.participant.left"),
|
|
843
885
|
object: webTTYParticipantSchema
|
|
844
886
|
}),
|
|
845
887
|
withEventBase({
|
|
846
|
-
type:
|
|
888
|
+
type: z6.literal("webtty.control.requested"),
|
|
847
889
|
object: webTTYControlRequestSchema
|
|
848
890
|
}),
|
|
849
891
|
withEventBase({
|
|
850
|
-
type:
|
|
892
|
+
type: z6.literal("webtty.control.granted"),
|
|
851
893
|
object: webTTYControlRequestSchema
|
|
852
894
|
}),
|
|
853
895
|
withEventBase({
|
|
854
|
-
type:
|
|
896
|
+
type: z6.literal("webtty.control.refused"),
|
|
855
897
|
object: webTTYControlRequestSchema
|
|
856
898
|
}),
|
|
857
899
|
withEventBase({
|
|
858
|
-
type:
|
|
900
|
+
type: z6.literal("webtty.control.revoked"),
|
|
859
901
|
object: webTTYControlRequestSchema
|
|
860
902
|
})
|
|
861
903
|
];
|
|
862
904
|
var webhookDeliverableEventsSchema = [
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
905
|
+
fullInventoryEventsSchema[0],
|
|
906
|
+
fullInventoryEventsSchema[2],
|
|
907
|
+
fullInventoryEventsSchema[3],
|
|
908
|
+
fullInventoryEventsSchema[5],
|
|
867
909
|
...webTTYEventsSchema
|
|
868
910
|
];
|
|
869
|
-
var wsEventsSchema =
|
|
911
|
+
var wsEventsSchema = z6.union([
|
|
870
912
|
stateInitialEventSchema,
|
|
871
913
|
...commonEventsSchema,
|
|
872
914
|
...webTTYEventsSchema
|
|
873
915
|
]);
|
|
874
|
-
var webhookEventsSchema =
|
|
916
|
+
var webhookEventsSchema = z6.union(webhookDeliverableEventsSchema);
|
|
875
917
|
var projectLogEventsSchema = streamSummaryEventSchema;
|
|
876
|
-
var eventSchema =
|
|
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(
|
|
1232
|
+
Client: jsonSchemaFor(listedClientSchema),
|
|
1228
1233
|
Event: jsonSchemaFor(wsEventsSchema),
|
|
1229
1234
|
ListClientsParams: jsonSchemaFor(listClientsParamsSchema),
|
|
1230
1235
|
ListTunnelsParams: jsonSchemaFor(listTunnelsParamsSchema),
|
|
1231
|
-
TunnelListItem: jsonSchemaFor(
|
|
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":
|
|
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-
|
|
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
|
-
|
|
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
|
};
|