@rstreamlabs/tunnels 1.0.8 → 1.0.9
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 +15 -16
- package/dist/{chunk-7RZ743EF.mjs → chunk-TVDZNVSF.mjs} +3 -4
- package/dist/index.d.mts +177 -2631
- package/dist/index.d.ts +177 -2631
- package/dist/index.js +139 -28
- package/dist/index.mjs +137 -25
- package/dist/openapi.js +3 -4
- package/dist/openapi.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@rstreamlabs/tunnels`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Engine API JS/TS SDK for rstream tunnels.
|
|
4
4
|
|
|
5
5
|
Use this package to talk directly to the tunnels engine: list tunnels, inspect
|
|
6
6
|
clients, watch engine events, validate webhooks, and create fine-grained app
|
|
@@ -9,7 +9,7 @@ tokens.
|
|
|
9
9
|
The package supports both:
|
|
10
10
|
|
|
11
11
|
- direct engine usage, including self-hosted deployments
|
|
12
|
-
- managed rstream projects resolved via the
|
|
12
|
+
- managed rstream projects resolved via the Control plane API
|
|
13
13
|
- bearer-token authentication and application credentials
|
|
14
14
|
|
|
15
15
|
## Self-hosted usage
|
|
@@ -65,9 +65,11 @@ const tunnels = await client.tunnels.list();
|
|
|
65
65
|
|
|
66
66
|
## Fine-Grained Tokens
|
|
67
67
|
|
|
68
|
-
Prefer `tunnelsGrants` with explicit
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
Prefer `tunnelsGrants` with explicit operation scopes. When the client is
|
|
69
|
+
configured with `projectEndpoint` or `projectId`, scope-only requests and
|
|
70
|
+
scope-only grant leaves are project-scoped by default. Pass
|
|
71
|
+
`projectScoped: false` only when you intentionally need a global scope-only
|
|
72
|
+
grant.
|
|
71
73
|
|
|
72
74
|
```ts
|
|
73
75
|
import { RstreamTunnelsClient } from "@rstreamlabs/tunnels";
|
|
@@ -82,18 +84,15 @@ const admin = new RstreamTunnelsClient({
|
|
|
82
84
|
|
|
83
85
|
const { token } = await admin.auth.createAuthToken({
|
|
84
86
|
expires_in: 60,
|
|
85
|
-
tunnelsGrants:
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
connect: { params: { path: { regex: "^/api" } } },
|
|
92
|
-
list: { select: { id: true, name: true, protocol: true } },
|
|
93
|
-
},
|
|
87
|
+
tunnelsGrants: {
|
|
88
|
+
scopes: {
|
|
89
|
+
tunnels: {
|
|
90
|
+
create: { filters: { protocol: { oneof: ["http"] } } },
|
|
91
|
+
connect: { params: { path: { regex: "^/api" } } },
|
|
92
|
+
list: { select: { id: true, name: true, protocol: true } },
|
|
94
93
|
},
|
|
95
94
|
},
|
|
96
|
-
|
|
95
|
+
},
|
|
97
96
|
});
|
|
98
97
|
```
|
|
99
98
|
|
|
@@ -118,4 +117,4 @@ const turn = await createTURNCredentials({
|
|
|
118
117
|
`@rstreamlabs/tunnels` reads `RSTREAM_API_URL`, `RSTREAM_ENGINE`, and
|
|
119
118
|
`RSTREAM_AUTHENTICATION_TOKEN` when they are not provided explicitly.
|
|
120
119
|
|
|
121
|
-
For
|
|
120
|
+
For the Control plane API, use [`@rstreamlabs/rstream`](../rstream/README.md).
|
|
@@ -67,8 +67,7 @@ var tunnelSchema = z2.object({
|
|
|
67
67
|
tls_alpns: z2.array(z2.string()).optional(),
|
|
68
68
|
tls_min_version: z2.string().optional(),
|
|
69
69
|
tls_ciphers: z2.array(z2.string()).optional(),
|
|
70
|
-
|
|
71
|
-
mtls_ca_cert_pem: z2.string().optional(),
|
|
70
|
+
mtls_auth: z2.boolean().optional(),
|
|
72
71
|
http_version: z2.enum(["http/1.1", "h2", "h2c", "h3"]).optional(),
|
|
73
72
|
http_use_tls: z2.boolean().optional(),
|
|
74
73
|
upstream_tls: z2.boolean().optional(),
|
|
@@ -245,7 +244,7 @@ var routedTunnelSchema = z3.object({
|
|
|
245
244
|
httpUseTls: z3.boolean().optional(),
|
|
246
245
|
upstreamTls: z3.boolean().optional(),
|
|
247
246
|
tokenAuth: z3.boolean().optional(),
|
|
248
|
-
|
|
247
|
+
mtls_auth: z3.boolean().optional()
|
|
249
248
|
});
|
|
250
249
|
var routingSchema = z3.discriminatedUnion("decision", [
|
|
251
250
|
z3.object({ decision: z3.literal("routed"), tunnel: routedTunnelSchema }),
|
|
@@ -487,7 +486,7 @@ var engineOpenApiDocument = {
|
|
|
487
486
|
info: {
|
|
488
487
|
title: "rstream Engine API",
|
|
489
488
|
version: "1.0.0",
|
|
490
|
-
description: "Operational
|
|
489
|
+
description: "Operational Engine API exposed by rstream-engine. This surface is scoped to the authenticated engine or project endpoint and covers live clients, live tunnels, and state-change streams."
|
|
491
490
|
},
|
|
492
491
|
servers: [
|
|
493
492
|
{
|