@rstreamlabs/tunnels 1.0.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/{chunk-NHUJ3FYM.mjs → chunk-UUZYVELQ.mjs} +14 -46
- package/dist/index.d.mts +157 -1692
- package/dist/index.d.ts +157 -1692
- package/dist/index.js +231 -477
- package/dist/index.mjs +27 -232
- package/dist/openapi.js +12 -43
- package/dist/openapi.mjs +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -114,6 +114,10 @@ await watch.connect();
|
|
|
114
114
|
URL-based watch authentication requires a short-lived token with bounded
|
|
115
115
|
lifetime and watch-only tunnel list grants.
|
|
116
116
|
|
|
117
|
+
Browser integrations should provide `auth` as a function that calls a backend
|
|
118
|
+
token route and returns a fresh watch token for each connection attempt. Do not
|
|
119
|
+
store the `rstream.token` query token as durable browser state.
|
|
120
|
+
|
|
117
121
|
## Scoped Auth Tokens
|
|
118
122
|
|
|
119
123
|
`auth.createAuthToken()` mints short-lived engine tokens. Prefer
|
|
@@ -198,10 +202,10 @@ console.log(engineOpenApiDocument.info.title);
|
|
|
198
202
|
|
|
199
203
|
## Environment Variables
|
|
200
204
|
|
|
201
|
-
| Variable
|
|
202
|
-
|
|
|
203
|
-
| `RSTREAM_API_URL`
|
|
204
|
-
| `RSTREAM_ENGINE`
|
|
205
|
+
| Variable | Purpose |
|
|
206
|
+
| ------------------------------ | --------------------------------------------------------------- |
|
|
207
|
+
| `RSTREAM_API_URL` | Control plane API URL used for managed project resolution. |
|
|
208
|
+
| `RSTREAM_ENGINE` | Engine endpoint used when no engine is provided explicitly. |
|
|
205
209
|
| `RSTREAM_AUTHENTICATION_TOKEN` | Bearer token used when credentials are not provided explicitly. |
|
|
206
210
|
|
|
207
211
|
## Development
|
|
@@ -37,44 +37,9 @@ var listClientsParamsSchema = z.object({
|
|
|
37
37
|
var listClientsResponseSchema = z.array(clientSchema);
|
|
38
38
|
|
|
39
39
|
// src/tunnel.ts
|
|
40
|
+
import { tunnelSchema } from "@rstreamlabs/rstream/tunnel";
|
|
40
41
|
import * as z2 from "zod";
|
|
41
42
|
var DEFAULT_PUBLISHED_PORT = 443;
|
|
42
|
-
var tunnelSchema = z2.object({
|
|
43
|
-
// common properties
|
|
44
|
-
client_id: z2.string(),
|
|
45
|
-
user_id: z2.string().optional(),
|
|
46
|
-
workspace_id: z2.string().optional(),
|
|
47
|
-
project_id: z2.string().optional(),
|
|
48
|
-
cluster_id: z2.string().optional(),
|
|
49
|
-
plan: z2.string().optional(),
|
|
50
|
-
provider: z2.string().optional(),
|
|
51
|
-
region: z2.string().optional(),
|
|
52
|
-
status: z2.enum(["online", "offline"]),
|
|
53
|
-
// tunnel properties
|
|
54
|
-
id: z2.string(),
|
|
55
|
-
creation_date: z2.union([z2.string().datetime(), z2.date()]).optional(),
|
|
56
|
-
name: z2.string().optional(),
|
|
57
|
-
type: z2.enum(["bytestream", "datagram"]).optional(),
|
|
58
|
-
publish: z2.boolean().optional(),
|
|
59
|
-
protocol: z2.enum(["tls", "dtls", "quic", "http"]).optional(),
|
|
60
|
-
labels: z2.record(z2.string(), z2.string()).optional(),
|
|
61
|
-
geo_ip: z2.array(z2.string()).optional(),
|
|
62
|
-
trusted_ips: z2.array(z2.string()).optional(),
|
|
63
|
-
host: z2.string().optional(),
|
|
64
|
-
hostname: z2.string().optional(),
|
|
65
|
-
port: z2.number().int().min(1).max(65535).optional(),
|
|
66
|
-
tls_mode: z2.enum(["passthrough", "terminated"]).optional(),
|
|
67
|
-
tls_alpns: z2.array(z2.string()).optional(),
|
|
68
|
-
tls_min_version: z2.string().optional(),
|
|
69
|
-
tls_ciphers: z2.array(z2.string()).optional(),
|
|
70
|
-
mtls_auth: z2.boolean().optional(),
|
|
71
|
-
http_version: z2.enum(["http/1.1", "h2", "h2c", "h3"]).optional(),
|
|
72
|
-
http_use_tls: z2.boolean().optional(),
|
|
73
|
-
upstream_tls: z2.boolean().optional(),
|
|
74
|
-
token_auth: z2.boolean().optional(),
|
|
75
|
-
rstream_auth: z2.boolean().optional(),
|
|
76
|
-
challenge_mode: z2.boolean().optional()
|
|
77
|
-
});
|
|
78
43
|
var tunnelFilterSchema = tunnelSchema.pick({
|
|
79
44
|
id: true,
|
|
80
45
|
name: true,
|
|
@@ -101,6 +66,9 @@ function formatTunnelHost(tunnel) {
|
|
|
101
66
|
return `${tunnel.hostname}:${tunnel.port}`;
|
|
102
67
|
}
|
|
103
68
|
|
|
69
|
+
// src/openapi.ts
|
|
70
|
+
import { tunnelSchema as tunnelSchema3 } from "@rstreamlabs/rstream/tunnel";
|
|
71
|
+
|
|
104
72
|
// src/stream.ts
|
|
105
73
|
import * as z3 from "zod";
|
|
106
74
|
var nonEmptyStringSchema = z3.string().min(1);
|
|
@@ -305,12 +273,13 @@ var streamSummarySchema = z3.object({
|
|
|
305
273
|
});
|
|
306
274
|
|
|
307
275
|
// src/event.ts
|
|
276
|
+
import { tunnelSchema as tunnelSchema2 } from "@rstreamlabs/rstream/tunnel";
|
|
308
277
|
import * as z4 from "zod";
|
|
309
278
|
var isoDateTimeSchema2 = z4.string().datetime({ offset: true });
|
|
310
279
|
var initialStateSchema = z4.object({
|
|
311
280
|
snapshot_at: isoDateTimeSchema2,
|
|
312
281
|
clients: z4.array(clientSchema),
|
|
313
|
-
tunnels: z4.array(
|
|
282
|
+
tunnels: z4.array(tunnelSchema2)
|
|
314
283
|
});
|
|
315
284
|
var eventBaseSchema = z4.object({
|
|
316
285
|
id: z4.string().optional(),
|
|
@@ -344,15 +313,15 @@ var commonEventsSchema = [
|
|
|
344
313
|
}),
|
|
345
314
|
withEventBase({
|
|
346
315
|
type: z4.literal("tunnel.created"),
|
|
347
|
-
object:
|
|
316
|
+
object: tunnelSchema2
|
|
348
317
|
}),
|
|
349
318
|
withEventBase({
|
|
350
319
|
type: z4.literal("tunnel.updated"),
|
|
351
|
-
object:
|
|
320
|
+
object: tunnelSchema2
|
|
352
321
|
}),
|
|
353
322
|
withEventBase({
|
|
354
323
|
type: z4.literal("tunnel.deleted"),
|
|
355
|
-
object:
|
|
324
|
+
object: tunnelSchema2
|
|
356
325
|
})
|
|
357
326
|
];
|
|
358
327
|
var wsEventsSchema = z4.union([
|
|
@@ -578,7 +547,7 @@ var engineOpenApiDocument = {
|
|
|
578
547
|
Event: jsonSchemaFor(wsEventsSchema),
|
|
579
548
|
ListClientsParams: jsonSchemaFor(listClientsParamsSchema),
|
|
580
549
|
ListTunnelsParams: jsonSchemaFor(listTunnelsParamsSchema),
|
|
581
|
-
TunnelListItem: jsonSchemaFor(
|
|
550
|
+
TunnelListItem: jsonSchemaFor(tunnelSchema3),
|
|
582
551
|
WatchParams: jsonSchemaFor(watchParamsSchema)
|
|
583
552
|
}
|
|
584
553
|
},
|
|
@@ -712,11 +681,6 @@ var engineOpenApiJson = `${JSON.stringify(
|
|
|
712
681
|
`;
|
|
713
682
|
|
|
714
683
|
export {
|
|
715
|
-
tunnelSchema,
|
|
716
|
-
tunnelFilterSchema,
|
|
717
|
-
listTunnelsParamsSchema,
|
|
718
|
-
listTunnelsResponseSchema,
|
|
719
|
-
formatTunnelHost,
|
|
720
684
|
clientSchema,
|
|
721
685
|
clientFilterSchema,
|
|
722
686
|
listClientsParamsSchema,
|
|
@@ -727,6 +691,10 @@ export {
|
|
|
727
691
|
wsEventsSchema,
|
|
728
692
|
webhookEventsSchema,
|
|
729
693
|
eventSchema,
|
|
694
|
+
tunnelFilterSchema,
|
|
695
|
+
listTunnelsParamsSchema,
|
|
696
|
+
listTunnelsResponseSchema,
|
|
697
|
+
formatTunnelHost,
|
|
730
698
|
engineOpenApiDocument,
|
|
731
699
|
engineOpenApiJson
|
|
732
700
|
};
|