@rstreamlabs/tunnels 3.9.0 → 3.10.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/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { RstreamCredentials, TURNCredentials as TURNCredentials$1, ControlPlaneHeaders, ClientCredentials, TunnelsProject } from '@rstreamlabs/rstream';
1
+ import { ControlPlaneHeaders, RstreamCredentials, TURNCredentials as TURNCredentials$1, ClientCredentials, TunnelsProject } from '@rstreamlabs/rstream';
2
2
  import { CreateAuthTokenParams, CreateAuthTokenResponse } from '@rstreamlabs/rstream/auth-token';
3
3
  import * as z from 'zod';
4
4
  import { Tunnel } from '@rstreamlabs/rstream/tunnel';
5
5
  import { TURNCredentials } from '@rstreamlabs/rstream/turn';
6
+ import { ConnectionOptions } from 'node:tls';
6
7
  export { engineOpenApiDocument, engineOpenApiJson } from './openapi.js';
7
8
 
8
9
  declare const clientSchema: z.ZodObject<{
@@ -27,15 +28,15 @@ declare const clientSchema: z.ZodObject<{
27
28
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
28
29
  }, z.core.$strip>;
29
30
  declare const clientFilterSchema: z.ZodObject<{
30
- id: z.ZodOptional<z.ZodString>;
31
31
  status: z.ZodOptional<z.ZodEnum<{
32
32
  online: "online";
33
33
  offline: "offline";
34
34
  }>>;
35
+ id: z.ZodOptional<z.ZodString>;
36
+ version: z.ZodOptional<z.ZodOptional<z.ZodString>>;
35
37
  user_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
36
38
  agent: z.ZodOptional<z.ZodOptional<z.ZodString>>;
37
39
  channel: z.ZodOptional<z.ZodOptional<z.ZodString>>;
38
- version: z.ZodOptional<z.ZodOptional<z.ZodString>>;
39
40
  os: z.ZodOptional<z.ZodOptional<z.ZodString>>;
40
41
  arch: z.ZodOptional<z.ZodOptional<z.ZodString>>;
41
42
  protocol_version: z.ZodOptional<z.ZodOptional<z.ZodString>>;
@@ -44,15 +45,15 @@ declare const clientFilterSchema: z.ZodObject<{
44
45
  declare const listClientsParamsSchema: z.ZodObject<{
45
46
  limit: z.ZodOptional<z.ZodNumber>;
46
47
  filters: z.ZodOptional<z.ZodObject<{
47
- id: z.ZodOptional<z.ZodString>;
48
48
  status: z.ZodOptional<z.ZodEnum<{
49
49
  online: "online";
50
50
  offline: "offline";
51
51
  }>>;
52
+ id: z.ZodOptional<z.ZodString>;
53
+ version: z.ZodOptional<z.ZodOptional<z.ZodString>>;
52
54
  user_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
53
55
  agent: z.ZodOptional<z.ZodOptional<z.ZodString>>;
54
56
  channel: z.ZodOptional<z.ZodOptional<z.ZodString>>;
55
- version: z.ZodOptional<z.ZodOptional<z.ZodString>>;
56
57
  os: z.ZodOptional<z.ZodOptional<z.ZodString>>;
57
58
  arch: z.ZodOptional<z.ZodOptional<z.ZodString>>;
58
59
  protocol_version: z.ZodOptional<z.ZodOptional<z.ZodString>>;
@@ -93,18 +94,18 @@ declare class RstreamClientsResource {
93
94
  }
94
95
 
95
96
  declare const tunnelFilterSchema: z.ZodObject<{
96
- id: z.ZodOptional<z.ZodString>;
97
- name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
98
97
  status: z.ZodOptional<z.ZodEnum<{
99
98
  online: "online";
100
99
  offline: "offline";
101
100
  }>>;
102
- user_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
103
- labels: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
101
+ id: z.ZodOptional<z.ZodString>;
102
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
104
103
  type: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
105
104
  bytestream: "bytestream";
106
105
  datagram: "datagram";
107
106
  }>>>;
107
+ user_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
108
+ labels: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
108
109
  client_id: z.ZodOptional<z.ZodString>;
109
110
  publish: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
110
111
  protocol: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
@@ -126,18 +127,18 @@ declare const tunnelFilterSchema: z.ZodObject<{
126
127
  declare const listTunnelsParamsSchema: z.ZodObject<{
127
128
  limit: z.ZodOptional<z.ZodNumber>;
128
129
  filters: z.ZodOptional<z.ZodObject<{
129
- id: z.ZodOptional<z.ZodString>;
130
- name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
131
130
  status: z.ZodOptional<z.ZodEnum<{
132
131
  online: "online";
133
132
  offline: "offline";
134
133
  }>>;
135
- user_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
136
- labels: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
134
+ id: z.ZodOptional<z.ZodString>;
135
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
137
136
  type: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
138
137
  bytestream: "bytestream";
139
138
  datagram: "datagram";
140
139
  }>>>;
140
+ user_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
141
+ labels: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
141
142
  client_id: z.ZodOptional<z.ZodString>;
142
143
  publish: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
143
144
  protocol: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
@@ -225,13 +226,19 @@ declare class RstreamTunnelsResource {
225
226
  get(id: string): Promise<Tunnel>;
226
227
  }
227
228
 
229
+ type EngineTLSOptions = Pick<ConnectionOptions, "ca" | "cert" | "key" | "checkServerIdentity" | "rejectUnauthorized" | "servername">;
230
+
228
231
  declare const turnCredentialModeSchema: z.ZodEnum<{
232
+ auto: "auto";
229
233
  app: "app";
230
234
  pat: "pat";
231
235
  api: "api";
236
+ engine: "engine";
232
237
  }>;
233
238
  type TURNCredentialMode = z.infer<typeof turnCredentialModeSchema>;
234
239
  interface CreateAPITURNCredentialsOptions {
240
+ controlPlaneHeaders?: ControlPlaneHeaders;
241
+ signal?: AbortSignal;
235
242
  apiUrl?: string;
236
243
  credentials: RstreamCredentials;
237
244
  fetch?: typeof globalThis.fetch;
@@ -253,6 +260,8 @@ interface CreatePATTURNCredentialsOptions {
253
260
  turnsPort?: number;
254
261
  }
255
262
  interface CreateAPPTURNCredentialsOptions {
263
+ signal?: AbortSignal;
264
+ requestTimeoutMilliseconds?: number;
256
265
  apiUrl?: string;
257
266
  clientId: string;
258
267
  clientSecret: string;
@@ -268,6 +277,11 @@ interface CreateAPPTURNCredentialsOptions {
268
277
  turnsPort?: number;
269
278
  }
270
279
  interface CreateTURNCredentialsOptions {
280
+ controlPlaneHeaders?: ControlPlaneHeaders;
281
+ client?: RstreamTunnelsClient;
282
+ tls?: EngineTLSOptions;
283
+ mtlsApiUrl?: string;
284
+ signal?: AbortSignal;
271
285
  apiUrl?: string;
272
286
  clusterDomain?: string;
273
287
  controlPlaneCredentials?: RstreamCredentials;
@@ -291,12 +305,14 @@ interface CreateTURNCredentialsOptions {
291
305
  declare function createAPITURNCredentials(options: CreateAPITURNCredentialsOptions): Promise<TURNCredentials>;
292
306
  declare function createPATTURNCredentials(options: CreatePATTURNCredentialsOptions): TURNCredentials;
293
307
  declare function createAPPTURNCredentials(options: CreateAPPTURNCredentialsOptions): Promise<TURNCredentials>;
308
+ declare function validateTURNCredentialsRequest(options: CreateTURNCredentialsOptions): number;
294
309
  declare function createTURNCredentials(options: CreateTURNCredentialsOptions): Promise<TURNCredentials>;
295
310
 
296
311
  declare class RstreamTURNResource {
297
312
  private readonly client;
298
313
  constructor(client: RstreamTunnelsClient);
299
314
  createCredentials(options?: CreateTURNCredentialsOptions): Promise<TURNCredentials$1>;
315
+ private createForLifetime;
300
316
  }
301
317
 
302
318
  declare const initialStateSchema: z.ZodObject<{
@@ -457,8 +473,8 @@ declare const streamSummaryEventSchema: z.ZodObject<{
457
473
  kind: z.ZodLiteral<"token">;
458
474
  source: z.ZodOptional<z.ZodEnum<{
459
475
  unknown: "unknown";
460
- query: "query";
461
476
  authorization: "authorization";
477
+ query: "query";
462
478
  client: "client";
463
479
  }>>;
464
480
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -484,8 +500,8 @@ declare const streamSummaryEventSchema: z.ZodObject<{
484
500
  kind: z.ZodLiteral<"token">;
485
501
  source: z.ZodOptional<z.ZodEnum<{
486
502
  unknown: "unknown";
487
- query: "query";
488
503
  authorization: "authorization";
504
+ query: "query";
489
505
  client: "client";
490
506
  }>>;
491
507
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -505,48 +521,48 @@ declare const streamSummaryEventSchema: z.ZodObject<{
505
521
  reason: z.ZodLiteral<"missing_token">;
506
522
  source: z.ZodEnum<{
507
523
  unknown: "unknown";
508
- query: "query";
509
524
  authorization: "authorization";
525
+ query: "query";
510
526
  client: "client";
511
527
  }>;
512
528
  }, z.core.$strip>, z.ZodObject<{
513
529
  reason: z.ZodLiteral<"invalid_token">;
514
530
  source: z.ZodEnum<{
515
531
  unknown: "unknown";
516
- query: "query";
517
532
  authorization: "authorization";
533
+ query: "query";
518
534
  client: "client";
519
535
  }>;
520
536
  }, z.core.$strip>, z.ZodObject<{
521
537
  reason: z.ZodLiteral<"expired_token">;
522
538
  source: z.ZodEnum<{
523
539
  unknown: "unknown";
524
- query: "query";
525
540
  authorization: "authorization";
541
+ query: "query";
526
542
  client: "client";
527
543
  }>;
528
544
  }, z.core.$strip>, z.ZodObject<{
529
545
  reason: z.ZodLiteral<"invalid_secret">;
530
546
  source: z.ZodEnum<{
531
547
  unknown: "unknown";
532
- query: "query";
533
548
  authorization: "authorization";
549
+ query: "query";
534
550
  client: "client";
535
551
  }>;
536
552
  }, z.core.$strip>, z.ZodObject<{
537
553
  reason: z.ZodLiteral<"user_mismatch">;
538
554
  source: z.ZodEnum<{
539
555
  unknown: "unknown";
540
- query: "query";
541
556
  authorization: "authorization";
557
+ query: "query";
542
558
  client: "client";
543
559
  }>;
544
560
  }, z.core.$strip>, z.ZodObject<{
545
561
  reason: z.ZodLiteral<"insufficient_scope">;
546
562
  source: z.ZodEnum<{
547
563
  unknown: "unknown";
548
- query: "query";
549
564
  authorization: "authorization";
565
+ query: "query";
550
566
  client: "client";
551
567
  }>;
552
568
  }, z.core.$strip>, z.ZodObject<{
@@ -561,8 +577,8 @@ declare const streamSummaryEventSchema: z.ZodObject<{
561
577
  value: z.ZodOptional<z.ZodString>;
562
578
  source: z.ZodEnum<{
563
579
  unknown: "unknown";
564
- query: "query";
565
580
  authorization: "authorization";
581
+ query: "query";
566
582
  client: "client";
567
583
  }>;
568
584
  }, z.core.$strip>], "reason">;
@@ -642,48 +658,48 @@ declare const streamSummaryEventSchema: z.ZodObject<{
642
658
  reason: z.ZodLiteral<"missing_token">;
643
659
  source: z.ZodEnum<{
644
660
  unknown: "unknown";
645
- query: "query";
646
661
  authorization: "authorization";
662
+ query: "query";
647
663
  client: "client";
648
664
  }>;
649
665
  }, z.core.$strip>, z.ZodObject<{
650
666
  reason: z.ZodLiteral<"invalid_token">;
651
667
  source: z.ZodEnum<{
652
668
  unknown: "unknown";
653
- query: "query";
654
669
  authorization: "authorization";
670
+ query: "query";
655
671
  client: "client";
656
672
  }>;
657
673
  }, z.core.$strip>, z.ZodObject<{
658
674
  reason: z.ZodLiteral<"expired_token">;
659
675
  source: z.ZodEnum<{
660
676
  unknown: "unknown";
661
- query: "query";
662
677
  authorization: "authorization";
678
+ query: "query";
663
679
  client: "client";
664
680
  }>;
665
681
  }, z.core.$strip>, z.ZodObject<{
666
682
  reason: z.ZodLiteral<"invalid_secret">;
667
683
  source: z.ZodEnum<{
668
684
  unknown: "unknown";
669
- query: "query";
670
685
  authorization: "authorization";
686
+ query: "query";
671
687
  client: "client";
672
688
  }>;
673
689
  }, z.core.$strip>, z.ZodObject<{
674
690
  reason: z.ZodLiteral<"user_mismatch">;
675
691
  source: z.ZodEnum<{
676
692
  unknown: "unknown";
677
- query: "query";
678
693
  authorization: "authorization";
694
+ query: "query";
679
695
  client: "client";
680
696
  }>;
681
697
  }, z.core.$strip>, z.ZodObject<{
682
698
  reason: z.ZodLiteral<"insufficient_scope">;
683
699
  source: z.ZodEnum<{
684
700
  unknown: "unknown";
685
- query: "query";
686
701
  authorization: "authorization";
702
+ query: "query";
687
703
  client: "client";
688
704
  }>;
689
705
  }, z.core.$strip>, z.ZodObject<{
@@ -698,8 +714,8 @@ declare const streamSummaryEventSchema: z.ZodObject<{
698
714
  value: z.ZodOptional<z.ZodString>;
699
715
  source: z.ZodEnum<{
700
716
  unknown: "unknown";
701
- query: "query";
702
717
  authorization: "authorization";
718
+ query: "query";
703
719
  client: "client";
704
720
  }>;
705
721
  }, z.core.$strip>], "reason">;
@@ -821,8 +837,8 @@ declare const streamSummaryEventSchema: z.ZodObject<{
821
837
  }>;
822
838
  reason: z.ZodEnum<{
823
839
  error: "error";
824
- unknown: "unknown";
825
840
  timeout: "timeout";
841
+ unknown: "unknown";
826
842
  closed: "closed";
827
843
  reset: "reset";
828
844
  }>;
@@ -852,48 +868,48 @@ declare const streamSummaryEventSchema: z.ZodObject<{
852
868
  reason: z.ZodLiteral<"missing_token">;
853
869
  source: z.ZodEnum<{
854
870
  unknown: "unknown";
855
- query: "query";
856
871
  authorization: "authorization";
872
+ query: "query";
857
873
  client: "client";
858
874
  }>;
859
875
  }, z.core.$strip>, z.ZodObject<{
860
876
  reason: z.ZodLiteral<"invalid_token">;
861
877
  source: z.ZodEnum<{
862
878
  unknown: "unknown";
863
- query: "query";
864
879
  authorization: "authorization";
880
+ query: "query";
865
881
  client: "client";
866
882
  }>;
867
883
  }, z.core.$strip>, z.ZodObject<{
868
884
  reason: z.ZodLiteral<"expired_token">;
869
885
  source: z.ZodEnum<{
870
886
  unknown: "unknown";
871
- query: "query";
872
887
  authorization: "authorization";
888
+ query: "query";
873
889
  client: "client";
874
890
  }>;
875
891
  }, z.core.$strip>, z.ZodObject<{
876
892
  reason: z.ZodLiteral<"invalid_secret">;
877
893
  source: z.ZodEnum<{
878
894
  unknown: "unknown";
879
- query: "query";
880
895
  authorization: "authorization";
896
+ query: "query";
881
897
  client: "client";
882
898
  }>;
883
899
  }, z.core.$strip>, z.ZodObject<{
884
900
  reason: z.ZodLiteral<"user_mismatch">;
885
901
  source: z.ZodEnum<{
886
902
  unknown: "unknown";
887
- query: "query";
888
903
  authorization: "authorization";
904
+ query: "query";
889
905
  client: "client";
890
906
  }>;
891
907
  }, z.core.$strip>, z.ZodObject<{
892
908
  reason: z.ZodLiteral<"insufficient_scope">;
893
909
  source: z.ZodEnum<{
894
910
  unknown: "unknown";
895
- query: "query";
896
911
  authorization: "authorization";
912
+ query: "query";
897
913
  client: "client";
898
914
  }>;
899
915
  }, z.core.$strip>, z.ZodObject<{
@@ -908,8 +924,8 @@ declare const streamSummaryEventSchema: z.ZodObject<{
908
924
  value: z.ZodOptional<z.ZodString>;
909
925
  source: z.ZodEnum<{
910
926
  unknown: "unknown";
911
- query: "query";
912
927
  authorization: "authorization";
928
+ query: "query";
913
929
  client: "client";
914
930
  }>;
915
931
  }, z.core.$strip>], "reason">;
@@ -965,8 +981,8 @@ declare const streamSummaryEventSchema: z.ZodObject<{
965
981
  }>;
966
982
  reason: z.ZodEnum<{
967
983
  error: "error";
968
- unknown: "unknown";
969
984
  timeout: "timeout";
985
+ unknown: "unknown";
970
986
  closed: "closed";
971
987
  reset: "reset";
972
988
  }>;
@@ -2590,8 +2606,8 @@ declare const projectLogEventsSchema: z.ZodObject<{
2590
2606
  kind: z.ZodLiteral<"token">;
2591
2607
  source: z.ZodOptional<z.ZodEnum<{
2592
2608
  unknown: "unknown";
2593
- query: "query";
2594
2609
  authorization: "authorization";
2610
+ query: "query";
2595
2611
  client: "client";
2596
2612
  }>>;
2597
2613
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -2617,8 +2633,8 @@ declare const projectLogEventsSchema: z.ZodObject<{
2617
2633
  kind: z.ZodLiteral<"token">;
2618
2634
  source: z.ZodOptional<z.ZodEnum<{
2619
2635
  unknown: "unknown";
2620
- query: "query";
2621
2636
  authorization: "authorization";
2637
+ query: "query";
2622
2638
  client: "client";
2623
2639
  }>>;
2624
2640
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -2638,48 +2654,48 @@ declare const projectLogEventsSchema: z.ZodObject<{
2638
2654
  reason: z.ZodLiteral<"missing_token">;
2639
2655
  source: z.ZodEnum<{
2640
2656
  unknown: "unknown";
2641
- query: "query";
2642
2657
  authorization: "authorization";
2658
+ query: "query";
2643
2659
  client: "client";
2644
2660
  }>;
2645
2661
  }, z.core.$strip>, z.ZodObject<{
2646
2662
  reason: z.ZodLiteral<"invalid_token">;
2647
2663
  source: z.ZodEnum<{
2648
2664
  unknown: "unknown";
2649
- query: "query";
2650
2665
  authorization: "authorization";
2666
+ query: "query";
2651
2667
  client: "client";
2652
2668
  }>;
2653
2669
  }, z.core.$strip>, z.ZodObject<{
2654
2670
  reason: z.ZodLiteral<"expired_token">;
2655
2671
  source: z.ZodEnum<{
2656
2672
  unknown: "unknown";
2657
- query: "query";
2658
2673
  authorization: "authorization";
2674
+ query: "query";
2659
2675
  client: "client";
2660
2676
  }>;
2661
2677
  }, z.core.$strip>, z.ZodObject<{
2662
2678
  reason: z.ZodLiteral<"invalid_secret">;
2663
2679
  source: z.ZodEnum<{
2664
2680
  unknown: "unknown";
2665
- query: "query";
2666
2681
  authorization: "authorization";
2682
+ query: "query";
2667
2683
  client: "client";
2668
2684
  }>;
2669
2685
  }, z.core.$strip>, z.ZodObject<{
2670
2686
  reason: z.ZodLiteral<"user_mismatch">;
2671
2687
  source: z.ZodEnum<{
2672
2688
  unknown: "unknown";
2673
- query: "query";
2674
2689
  authorization: "authorization";
2690
+ query: "query";
2675
2691
  client: "client";
2676
2692
  }>;
2677
2693
  }, z.core.$strip>, z.ZodObject<{
2678
2694
  reason: z.ZodLiteral<"insufficient_scope">;
2679
2695
  source: z.ZodEnum<{
2680
2696
  unknown: "unknown";
2681
- query: "query";
2682
2697
  authorization: "authorization";
2698
+ query: "query";
2683
2699
  client: "client";
2684
2700
  }>;
2685
2701
  }, z.core.$strip>, z.ZodObject<{
@@ -2694,8 +2710,8 @@ declare const projectLogEventsSchema: z.ZodObject<{
2694
2710
  value: z.ZodOptional<z.ZodString>;
2695
2711
  source: z.ZodEnum<{
2696
2712
  unknown: "unknown";
2697
- query: "query";
2698
2713
  authorization: "authorization";
2714
+ query: "query";
2699
2715
  client: "client";
2700
2716
  }>;
2701
2717
  }, z.core.$strip>], "reason">;
@@ -2775,48 +2791,48 @@ declare const projectLogEventsSchema: z.ZodObject<{
2775
2791
  reason: z.ZodLiteral<"missing_token">;
2776
2792
  source: z.ZodEnum<{
2777
2793
  unknown: "unknown";
2778
- query: "query";
2779
2794
  authorization: "authorization";
2795
+ query: "query";
2780
2796
  client: "client";
2781
2797
  }>;
2782
2798
  }, z.core.$strip>, z.ZodObject<{
2783
2799
  reason: z.ZodLiteral<"invalid_token">;
2784
2800
  source: z.ZodEnum<{
2785
2801
  unknown: "unknown";
2786
- query: "query";
2787
2802
  authorization: "authorization";
2803
+ query: "query";
2788
2804
  client: "client";
2789
2805
  }>;
2790
2806
  }, z.core.$strip>, z.ZodObject<{
2791
2807
  reason: z.ZodLiteral<"expired_token">;
2792
2808
  source: z.ZodEnum<{
2793
2809
  unknown: "unknown";
2794
- query: "query";
2795
2810
  authorization: "authorization";
2811
+ query: "query";
2796
2812
  client: "client";
2797
2813
  }>;
2798
2814
  }, z.core.$strip>, z.ZodObject<{
2799
2815
  reason: z.ZodLiteral<"invalid_secret">;
2800
2816
  source: z.ZodEnum<{
2801
2817
  unknown: "unknown";
2802
- query: "query";
2803
2818
  authorization: "authorization";
2819
+ query: "query";
2804
2820
  client: "client";
2805
2821
  }>;
2806
2822
  }, z.core.$strip>, z.ZodObject<{
2807
2823
  reason: z.ZodLiteral<"user_mismatch">;
2808
2824
  source: z.ZodEnum<{
2809
2825
  unknown: "unknown";
2810
- query: "query";
2811
2826
  authorization: "authorization";
2827
+ query: "query";
2812
2828
  client: "client";
2813
2829
  }>;
2814
2830
  }, z.core.$strip>, z.ZodObject<{
2815
2831
  reason: z.ZodLiteral<"insufficient_scope">;
2816
2832
  source: z.ZodEnum<{
2817
2833
  unknown: "unknown";
2818
- query: "query";
2819
2834
  authorization: "authorization";
2835
+ query: "query";
2820
2836
  client: "client";
2821
2837
  }>;
2822
2838
  }, z.core.$strip>, z.ZodObject<{
@@ -2831,8 +2847,8 @@ declare const projectLogEventsSchema: z.ZodObject<{
2831
2847
  value: z.ZodOptional<z.ZodString>;
2832
2848
  source: z.ZodEnum<{
2833
2849
  unknown: "unknown";
2834
- query: "query";
2835
2850
  authorization: "authorization";
2851
+ query: "query";
2836
2852
  client: "client";
2837
2853
  }>;
2838
2854
  }, z.core.$strip>], "reason">;
@@ -2954,8 +2970,8 @@ declare const projectLogEventsSchema: z.ZodObject<{
2954
2970
  }>;
2955
2971
  reason: z.ZodEnum<{
2956
2972
  error: "error";
2957
- unknown: "unknown";
2958
2973
  timeout: "timeout";
2974
+ unknown: "unknown";
2959
2975
  closed: "closed";
2960
2976
  reset: "reset";
2961
2977
  }>;
@@ -2985,48 +3001,48 @@ declare const projectLogEventsSchema: z.ZodObject<{
2985
3001
  reason: z.ZodLiteral<"missing_token">;
2986
3002
  source: z.ZodEnum<{
2987
3003
  unknown: "unknown";
2988
- query: "query";
2989
3004
  authorization: "authorization";
3005
+ query: "query";
2990
3006
  client: "client";
2991
3007
  }>;
2992
3008
  }, z.core.$strip>, z.ZodObject<{
2993
3009
  reason: z.ZodLiteral<"invalid_token">;
2994
3010
  source: z.ZodEnum<{
2995
3011
  unknown: "unknown";
2996
- query: "query";
2997
3012
  authorization: "authorization";
3013
+ query: "query";
2998
3014
  client: "client";
2999
3015
  }>;
3000
3016
  }, z.core.$strip>, z.ZodObject<{
3001
3017
  reason: z.ZodLiteral<"expired_token">;
3002
3018
  source: z.ZodEnum<{
3003
3019
  unknown: "unknown";
3004
- query: "query";
3005
3020
  authorization: "authorization";
3021
+ query: "query";
3006
3022
  client: "client";
3007
3023
  }>;
3008
3024
  }, z.core.$strip>, z.ZodObject<{
3009
3025
  reason: z.ZodLiteral<"invalid_secret">;
3010
3026
  source: z.ZodEnum<{
3011
3027
  unknown: "unknown";
3012
- query: "query";
3013
3028
  authorization: "authorization";
3029
+ query: "query";
3014
3030
  client: "client";
3015
3031
  }>;
3016
3032
  }, z.core.$strip>, z.ZodObject<{
3017
3033
  reason: z.ZodLiteral<"user_mismatch">;
3018
3034
  source: z.ZodEnum<{
3019
3035
  unknown: "unknown";
3020
- query: "query";
3021
3036
  authorization: "authorization";
3037
+ query: "query";
3022
3038
  client: "client";
3023
3039
  }>;
3024
3040
  }, z.core.$strip>, z.ZodObject<{
3025
3041
  reason: z.ZodLiteral<"insufficient_scope">;
3026
3042
  source: z.ZodEnum<{
3027
3043
  unknown: "unknown";
3028
- query: "query";
3029
3044
  authorization: "authorization";
3045
+ query: "query";
3030
3046
  client: "client";
3031
3047
  }>;
3032
3048
  }, z.core.$strip>, z.ZodObject<{
@@ -3041,8 +3057,8 @@ declare const projectLogEventsSchema: z.ZodObject<{
3041
3057
  value: z.ZodOptional<z.ZodString>;
3042
3058
  source: z.ZodEnum<{
3043
3059
  unknown: "unknown";
3044
- query: "query";
3045
3060
  authorization: "authorization";
3061
+ query: "query";
3046
3062
  client: "client";
3047
3063
  }>;
3048
3064
  }, z.core.$strip>], "reason">;
@@ -3098,8 +3114,8 @@ declare const projectLogEventsSchema: z.ZodObject<{
3098
3114
  }>;
3099
3115
  reason: z.ZodEnum<{
3100
3116
  error: "error";
3101
- unknown: "unknown";
3102
3117
  timeout: "timeout";
3118
+ unknown: "unknown";
3103
3119
  closed: "closed";
3104
3120
  reset: "reset";
3105
3121
  }>;
@@ -4721,8 +4737,8 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
4721
4737
  kind: z.ZodLiteral<"token">;
4722
4738
  source: z.ZodOptional<z.ZodEnum<{
4723
4739
  unknown: "unknown";
4724
- query: "query";
4725
4740
  authorization: "authorization";
4741
+ query: "query";
4726
4742
  client: "client";
4727
4743
  }>>;
4728
4744
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -4748,8 +4764,8 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
4748
4764
  kind: z.ZodLiteral<"token">;
4749
4765
  source: z.ZodOptional<z.ZodEnum<{
4750
4766
  unknown: "unknown";
4751
- query: "query";
4752
4767
  authorization: "authorization";
4768
+ query: "query";
4753
4769
  client: "client";
4754
4770
  }>>;
4755
4771
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -4769,48 +4785,48 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
4769
4785
  reason: z.ZodLiteral<"missing_token">;
4770
4786
  source: z.ZodEnum<{
4771
4787
  unknown: "unknown";
4772
- query: "query";
4773
4788
  authorization: "authorization";
4789
+ query: "query";
4774
4790
  client: "client";
4775
4791
  }>;
4776
4792
  }, z.core.$strip>, z.ZodObject<{
4777
4793
  reason: z.ZodLiteral<"invalid_token">;
4778
4794
  source: z.ZodEnum<{
4779
4795
  unknown: "unknown";
4780
- query: "query";
4781
4796
  authorization: "authorization";
4797
+ query: "query";
4782
4798
  client: "client";
4783
4799
  }>;
4784
4800
  }, z.core.$strip>, z.ZodObject<{
4785
4801
  reason: z.ZodLiteral<"expired_token">;
4786
4802
  source: z.ZodEnum<{
4787
4803
  unknown: "unknown";
4788
- query: "query";
4789
4804
  authorization: "authorization";
4805
+ query: "query";
4790
4806
  client: "client";
4791
4807
  }>;
4792
4808
  }, z.core.$strip>, z.ZodObject<{
4793
4809
  reason: z.ZodLiteral<"invalid_secret">;
4794
4810
  source: z.ZodEnum<{
4795
4811
  unknown: "unknown";
4796
- query: "query";
4797
4812
  authorization: "authorization";
4813
+ query: "query";
4798
4814
  client: "client";
4799
4815
  }>;
4800
4816
  }, z.core.$strip>, z.ZodObject<{
4801
4817
  reason: z.ZodLiteral<"user_mismatch">;
4802
4818
  source: z.ZodEnum<{
4803
4819
  unknown: "unknown";
4804
- query: "query";
4805
4820
  authorization: "authorization";
4821
+ query: "query";
4806
4822
  client: "client";
4807
4823
  }>;
4808
4824
  }, z.core.$strip>, z.ZodObject<{
4809
4825
  reason: z.ZodLiteral<"insufficient_scope">;
4810
4826
  source: z.ZodEnum<{
4811
4827
  unknown: "unknown";
4812
- query: "query";
4813
4828
  authorization: "authorization";
4829
+ query: "query";
4814
4830
  client: "client";
4815
4831
  }>;
4816
4832
  }, z.core.$strip>, z.ZodObject<{
@@ -4825,8 +4841,8 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
4825
4841
  value: z.ZodOptional<z.ZodString>;
4826
4842
  source: z.ZodEnum<{
4827
4843
  unknown: "unknown";
4828
- query: "query";
4829
4844
  authorization: "authorization";
4845
+ query: "query";
4830
4846
  client: "client";
4831
4847
  }>;
4832
4848
  }, z.core.$strip>], "reason">;
@@ -4906,48 +4922,48 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
4906
4922
  reason: z.ZodLiteral<"missing_token">;
4907
4923
  source: z.ZodEnum<{
4908
4924
  unknown: "unknown";
4909
- query: "query";
4910
4925
  authorization: "authorization";
4926
+ query: "query";
4911
4927
  client: "client";
4912
4928
  }>;
4913
4929
  }, z.core.$strip>, z.ZodObject<{
4914
4930
  reason: z.ZodLiteral<"invalid_token">;
4915
4931
  source: z.ZodEnum<{
4916
4932
  unknown: "unknown";
4917
- query: "query";
4918
4933
  authorization: "authorization";
4934
+ query: "query";
4919
4935
  client: "client";
4920
4936
  }>;
4921
4937
  }, z.core.$strip>, z.ZodObject<{
4922
4938
  reason: z.ZodLiteral<"expired_token">;
4923
4939
  source: z.ZodEnum<{
4924
4940
  unknown: "unknown";
4925
- query: "query";
4926
4941
  authorization: "authorization";
4942
+ query: "query";
4927
4943
  client: "client";
4928
4944
  }>;
4929
4945
  }, z.core.$strip>, z.ZodObject<{
4930
4946
  reason: z.ZodLiteral<"invalid_secret">;
4931
4947
  source: z.ZodEnum<{
4932
4948
  unknown: "unknown";
4933
- query: "query";
4934
4949
  authorization: "authorization";
4950
+ query: "query";
4935
4951
  client: "client";
4936
4952
  }>;
4937
4953
  }, z.core.$strip>, z.ZodObject<{
4938
4954
  reason: z.ZodLiteral<"user_mismatch">;
4939
4955
  source: z.ZodEnum<{
4940
4956
  unknown: "unknown";
4941
- query: "query";
4942
4957
  authorization: "authorization";
4958
+ query: "query";
4943
4959
  client: "client";
4944
4960
  }>;
4945
4961
  }, z.core.$strip>, z.ZodObject<{
4946
4962
  reason: z.ZodLiteral<"insufficient_scope">;
4947
4963
  source: z.ZodEnum<{
4948
4964
  unknown: "unknown";
4949
- query: "query";
4950
4965
  authorization: "authorization";
4966
+ query: "query";
4951
4967
  client: "client";
4952
4968
  }>;
4953
4969
  }, z.core.$strip>, z.ZodObject<{
@@ -4962,8 +4978,8 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
4962
4978
  value: z.ZodOptional<z.ZodString>;
4963
4979
  source: z.ZodEnum<{
4964
4980
  unknown: "unknown";
4965
- query: "query";
4966
4981
  authorization: "authorization";
4982
+ query: "query";
4967
4983
  client: "client";
4968
4984
  }>;
4969
4985
  }, z.core.$strip>], "reason">;
@@ -5085,8 +5101,8 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
5085
5101
  }>;
5086
5102
  reason: z.ZodEnum<{
5087
5103
  error: "error";
5088
- unknown: "unknown";
5089
5104
  timeout: "timeout";
5105
+ unknown: "unknown";
5090
5106
  closed: "closed";
5091
5107
  reset: "reset";
5092
5108
  }>;
@@ -5116,48 +5132,48 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
5116
5132
  reason: z.ZodLiteral<"missing_token">;
5117
5133
  source: z.ZodEnum<{
5118
5134
  unknown: "unknown";
5119
- query: "query";
5120
5135
  authorization: "authorization";
5136
+ query: "query";
5121
5137
  client: "client";
5122
5138
  }>;
5123
5139
  }, z.core.$strip>, z.ZodObject<{
5124
5140
  reason: z.ZodLiteral<"invalid_token">;
5125
5141
  source: z.ZodEnum<{
5126
5142
  unknown: "unknown";
5127
- query: "query";
5128
5143
  authorization: "authorization";
5144
+ query: "query";
5129
5145
  client: "client";
5130
5146
  }>;
5131
5147
  }, z.core.$strip>, z.ZodObject<{
5132
5148
  reason: z.ZodLiteral<"expired_token">;
5133
5149
  source: z.ZodEnum<{
5134
5150
  unknown: "unknown";
5135
- query: "query";
5136
5151
  authorization: "authorization";
5152
+ query: "query";
5137
5153
  client: "client";
5138
5154
  }>;
5139
5155
  }, z.core.$strip>, z.ZodObject<{
5140
5156
  reason: z.ZodLiteral<"invalid_secret">;
5141
5157
  source: z.ZodEnum<{
5142
5158
  unknown: "unknown";
5143
- query: "query";
5144
5159
  authorization: "authorization";
5160
+ query: "query";
5145
5161
  client: "client";
5146
5162
  }>;
5147
5163
  }, z.core.$strip>, z.ZodObject<{
5148
5164
  reason: z.ZodLiteral<"user_mismatch">;
5149
5165
  source: z.ZodEnum<{
5150
5166
  unknown: "unknown";
5151
- query: "query";
5152
5167
  authorization: "authorization";
5168
+ query: "query";
5153
5169
  client: "client";
5154
5170
  }>;
5155
5171
  }, z.core.$strip>, z.ZodObject<{
5156
5172
  reason: z.ZodLiteral<"insufficient_scope">;
5157
5173
  source: z.ZodEnum<{
5158
5174
  unknown: "unknown";
5159
- query: "query";
5160
5175
  authorization: "authorization";
5176
+ query: "query";
5161
5177
  client: "client";
5162
5178
  }>;
5163
5179
  }, z.core.$strip>, z.ZodObject<{
@@ -5172,8 +5188,8 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
5172
5188
  value: z.ZodOptional<z.ZodString>;
5173
5189
  source: z.ZodEnum<{
5174
5190
  unknown: "unknown";
5175
- query: "query";
5176
5191
  authorization: "authorization";
5192
+ query: "query";
5177
5193
  client: "client";
5178
5194
  }>;
5179
5195
  }, z.core.$strip>], "reason">;
@@ -5229,8 +5245,8 @@ declare const eventSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject
5229
5245
  }>;
5230
5246
  reason: z.ZodEnum<{
5231
5247
  error: "error";
5232
- unknown: "unknown";
5233
5248
  timeout: "timeout";
5249
+ unknown: "unknown";
5234
5250
  closed: "closed";
5235
5251
  reset: "reset";
5236
5252
  }>;
@@ -5516,9 +5532,9 @@ declare const webTTYSessionEventSchema: z.ZodObject<{
5516
5532
  type: z.ZodEnum<{
5517
5533
  error: "error";
5518
5534
  close: "close";
5535
+ data: "data";
5519
5536
  open: "open";
5520
5537
  ack: "ack";
5521
- data: "data";
5522
5538
  resize: "resize";
5523
5539
  participant: "participant";
5524
5540
  control: "control";
@@ -5742,6 +5758,12 @@ declare class RstreamWebTTYResource {
5742
5758
  }
5743
5759
 
5744
5760
  interface RstreamTunnelsConfig {
5761
+ /** Node.js TLS identity and trust configuration. Treat as immutable after construction. */
5762
+ tls?: EngineTLSOptions;
5763
+ /** Explicit mTLS API override; otherwise discover once per client cache lifetime. */
5764
+ mtlsApiUrl?: string;
5765
+ /** Optional Engine-only fetch implementation. */
5766
+ fetch?: typeof globalThis.fetch;
5745
5767
  /**
5746
5768
  * Data-plane credentials used against the engine.
5747
5769
  */
@@ -5786,11 +5808,17 @@ interface RstreamTunnelsConfig {
5786
5808
  declare class RstreamTunnelsClient {
5787
5809
  private readonly config?;
5788
5810
  private managedProject?;
5811
+ private readonly http;
5789
5812
  constructor(config?: RstreamTunnelsConfig);
5790
5813
  get apiUrl(): string;
5791
5814
  get credentials(): RstreamCredentials | undefined;
5792
5815
  get controlPlaneCredentials(): RstreamCredentials | undefined;
5816
+ get controlPlaneHeaders(): ControlPlaneHeaders | undefined;
5793
5817
  get projectEndpoint(): string | undefined;
5818
+ get configuredEngine(): string | undefined;
5819
+ get usesMTLS(): boolean;
5820
+ close(): Promise<void>;
5821
+ getEngineAPIURL(signal?: AbortSignal): Promise<string>;
5794
5822
  getEngine(): Promise<string>;
5795
5823
  getTURNTarget(): Promise<{
5796
5824
  turnDomain: string;
@@ -5811,7 +5839,11 @@ declare class RstreamTunnelsClient {
5811
5839
  get webtty(): RstreamWebTTYResource;
5812
5840
  get turn(): RstreamTURNResource;
5813
5841
  getToken(engine?: string): Promise<string | undefined>;
5814
- request<T>(path: string, options?: RequestInit): Promise<T>;
5842
+ openEventStream(signal?: AbortSignal): Promise<{
5843
+ response: Response;
5844
+ close(): void;
5845
+ }>;
5846
+ request<T>(path: string, options?: RequestInit, maxResponseBytes?: number): Promise<T>;
5815
5847
  }
5816
5848
 
5817
5849
  interface CreateAuthTokenFromClientCredentialsOptions {
@@ -6023,8 +6055,8 @@ declare const streamSummarySchema: z.ZodObject<{
6023
6055
  kind: z.ZodLiteral<"token">;
6024
6056
  source: z.ZodOptional<z.ZodEnum<{
6025
6057
  unknown: "unknown";
6026
- query: "query";
6027
6058
  authorization: "authorization";
6059
+ query: "query";
6028
6060
  client: "client";
6029
6061
  }>>;
6030
6062
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -6050,8 +6082,8 @@ declare const streamSummarySchema: z.ZodObject<{
6050
6082
  kind: z.ZodLiteral<"token">;
6051
6083
  source: z.ZodOptional<z.ZodEnum<{
6052
6084
  unknown: "unknown";
6053
- query: "query";
6054
6085
  authorization: "authorization";
6086
+ query: "query";
6055
6087
  client: "client";
6056
6088
  }>>;
6057
6089
  tokenType: z.ZodOptional<z.ZodEnum<{
@@ -6071,48 +6103,48 @@ declare const streamSummarySchema: z.ZodObject<{
6071
6103
  reason: z.ZodLiteral<"missing_token">;
6072
6104
  source: z.ZodEnum<{
6073
6105
  unknown: "unknown";
6074
- query: "query";
6075
6106
  authorization: "authorization";
6107
+ query: "query";
6076
6108
  client: "client";
6077
6109
  }>;
6078
6110
  }, z.core.$strip>, z.ZodObject<{
6079
6111
  reason: z.ZodLiteral<"invalid_token">;
6080
6112
  source: z.ZodEnum<{
6081
6113
  unknown: "unknown";
6082
- query: "query";
6083
6114
  authorization: "authorization";
6115
+ query: "query";
6084
6116
  client: "client";
6085
6117
  }>;
6086
6118
  }, z.core.$strip>, z.ZodObject<{
6087
6119
  reason: z.ZodLiteral<"expired_token">;
6088
6120
  source: z.ZodEnum<{
6089
6121
  unknown: "unknown";
6090
- query: "query";
6091
6122
  authorization: "authorization";
6123
+ query: "query";
6092
6124
  client: "client";
6093
6125
  }>;
6094
6126
  }, z.core.$strip>, z.ZodObject<{
6095
6127
  reason: z.ZodLiteral<"invalid_secret">;
6096
6128
  source: z.ZodEnum<{
6097
6129
  unknown: "unknown";
6098
- query: "query";
6099
6130
  authorization: "authorization";
6131
+ query: "query";
6100
6132
  client: "client";
6101
6133
  }>;
6102
6134
  }, z.core.$strip>, z.ZodObject<{
6103
6135
  reason: z.ZodLiteral<"user_mismatch">;
6104
6136
  source: z.ZodEnum<{
6105
6137
  unknown: "unknown";
6106
- query: "query";
6107
6138
  authorization: "authorization";
6139
+ query: "query";
6108
6140
  client: "client";
6109
6141
  }>;
6110
6142
  }, z.core.$strip>, z.ZodObject<{
6111
6143
  reason: z.ZodLiteral<"insufficient_scope">;
6112
6144
  source: z.ZodEnum<{
6113
6145
  unknown: "unknown";
6114
- query: "query";
6115
6146
  authorization: "authorization";
6147
+ query: "query";
6116
6148
  client: "client";
6117
6149
  }>;
6118
6150
  }, z.core.$strip>, z.ZodObject<{
@@ -6127,8 +6159,8 @@ declare const streamSummarySchema: z.ZodObject<{
6127
6159
  value: z.ZodOptional<z.ZodString>;
6128
6160
  source: z.ZodEnum<{
6129
6161
  unknown: "unknown";
6130
- query: "query";
6131
6162
  authorization: "authorization";
6163
+ query: "query";
6132
6164
  client: "client";
6133
6165
  }>;
6134
6166
  }, z.core.$strip>], "reason">;
@@ -6208,48 +6240,48 @@ declare const streamSummarySchema: z.ZodObject<{
6208
6240
  reason: z.ZodLiteral<"missing_token">;
6209
6241
  source: z.ZodEnum<{
6210
6242
  unknown: "unknown";
6211
- query: "query";
6212
6243
  authorization: "authorization";
6244
+ query: "query";
6213
6245
  client: "client";
6214
6246
  }>;
6215
6247
  }, z.core.$strip>, z.ZodObject<{
6216
6248
  reason: z.ZodLiteral<"invalid_token">;
6217
6249
  source: z.ZodEnum<{
6218
6250
  unknown: "unknown";
6219
- query: "query";
6220
6251
  authorization: "authorization";
6252
+ query: "query";
6221
6253
  client: "client";
6222
6254
  }>;
6223
6255
  }, z.core.$strip>, z.ZodObject<{
6224
6256
  reason: z.ZodLiteral<"expired_token">;
6225
6257
  source: z.ZodEnum<{
6226
6258
  unknown: "unknown";
6227
- query: "query";
6228
6259
  authorization: "authorization";
6260
+ query: "query";
6229
6261
  client: "client";
6230
6262
  }>;
6231
6263
  }, z.core.$strip>, z.ZodObject<{
6232
6264
  reason: z.ZodLiteral<"invalid_secret">;
6233
6265
  source: z.ZodEnum<{
6234
6266
  unknown: "unknown";
6235
- query: "query";
6236
6267
  authorization: "authorization";
6268
+ query: "query";
6237
6269
  client: "client";
6238
6270
  }>;
6239
6271
  }, z.core.$strip>, z.ZodObject<{
6240
6272
  reason: z.ZodLiteral<"user_mismatch">;
6241
6273
  source: z.ZodEnum<{
6242
6274
  unknown: "unknown";
6243
- query: "query";
6244
6275
  authorization: "authorization";
6276
+ query: "query";
6245
6277
  client: "client";
6246
6278
  }>;
6247
6279
  }, z.core.$strip>, z.ZodObject<{
6248
6280
  reason: z.ZodLiteral<"insufficient_scope">;
6249
6281
  source: z.ZodEnum<{
6250
6282
  unknown: "unknown";
6251
- query: "query";
6252
6283
  authorization: "authorization";
6284
+ query: "query";
6253
6285
  client: "client";
6254
6286
  }>;
6255
6287
  }, z.core.$strip>, z.ZodObject<{
@@ -6264,8 +6296,8 @@ declare const streamSummarySchema: z.ZodObject<{
6264
6296
  value: z.ZodOptional<z.ZodString>;
6265
6297
  source: z.ZodEnum<{
6266
6298
  unknown: "unknown";
6267
- query: "query";
6268
6299
  authorization: "authorization";
6300
+ query: "query";
6269
6301
  client: "client";
6270
6302
  }>;
6271
6303
  }, z.core.$strip>], "reason">;
@@ -6387,8 +6419,8 @@ declare const streamSummarySchema: z.ZodObject<{
6387
6419
  }>;
6388
6420
  reason: z.ZodEnum<{
6389
6421
  error: "error";
6390
- unknown: "unknown";
6391
6422
  timeout: "timeout";
6423
+ unknown: "unknown";
6392
6424
  closed: "closed";
6393
6425
  reset: "reset";
6394
6426
  }>;
@@ -6418,48 +6450,48 @@ declare const streamSummarySchema: z.ZodObject<{
6418
6450
  reason: z.ZodLiteral<"missing_token">;
6419
6451
  source: z.ZodEnum<{
6420
6452
  unknown: "unknown";
6421
- query: "query";
6422
6453
  authorization: "authorization";
6454
+ query: "query";
6423
6455
  client: "client";
6424
6456
  }>;
6425
6457
  }, z.core.$strip>, z.ZodObject<{
6426
6458
  reason: z.ZodLiteral<"invalid_token">;
6427
6459
  source: z.ZodEnum<{
6428
6460
  unknown: "unknown";
6429
- query: "query";
6430
6461
  authorization: "authorization";
6462
+ query: "query";
6431
6463
  client: "client";
6432
6464
  }>;
6433
6465
  }, z.core.$strip>, z.ZodObject<{
6434
6466
  reason: z.ZodLiteral<"expired_token">;
6435
6467
  source: z.ZodEnum<{
6436
6468
  unknown: "unknown";
6437
- query: "query";
6438
6469
  authorization: "authorization";
6470
+ query: "query";
6439
6471
  client: "client";
6440
6472
  }>;
6441
6473
  }, z.core.$strip>, z.ZodObject<{
6442
6474
  reason: z.ZodLiteral<"invalid_secret">;
6443
6475
  source: z.ZodEnum<{
6444
6476
  unknown: "unknown";
6445
- query: "query";
6446
6477
  authorization: "authorization";
6478
+ query: "query";
6447
6479
  client: "client";
6448
6480
  }>;
6449
6481
  }, z.core.$strip>, z.ZodObject<{
6450
6482
  reason: z.ZodLiteral<"user_mismatch">;
6451
6483
  source: z.ZodEnum<{
6452
6484
  unknown: "unknown";
6453
- query: "query";
6454
6485
  authorization: "authorization";
6486
+ query: "query";
6455
6487
  client: "client";
6456
6488
  }>;
6457
6489
  }, z.core.$strip>, z.ZodObject<{
6458
6490
  reason: z.ZodLiteral<"insufficient_scope">;
6459
6491
  source: z.ZodEnum<{
6460
6492
  unknown: "unknown";
6461
- query: "query";
6462
6493
  authorization: "authorization";
6494
+ query: "query";
6463
6495
  client: "client";
6464
6496
  }>;
6465
6497
  }, z.core.$strip>, z.ZodObject<{
@@ -6474,8 +6506,8 @@ declare const streamSummarySchema: z.ZodObject<{
6474
6506
  value: z.ZodOptional<z.ZodString>;
6475
6507
  source: z.ZodEnum<{
6476
6508
  unknown: "unknown";
6477
- query: "query";
6478
6509
  authorization: "authorization";
6510
+ query: "query";
6479
6511
  client: "client";
6480
6512
  }>;
6481
6513
  }, z.core.$strip>], "reason">;
@@ -6531,8 +6563,8 @@ declare const streamSummarySchema: z.ZodObject<{
6531
6563
  }>;
6532
6564
  reason: z.ZodEnum<{
6533
6565
  error: "error";
6534
- unknown: "unknown";
6535
6566
  timeout: "timeout";
6567
+ unknown: "unknown";
6536
6568
  closed: "closed";
6537
6569
  reset: "reset";
6538
6570
  }>;
@@ -6565,7 +6597,9 @@ interface WatchConfig {
6565
6597
  /**
6566
6598
  * Short-term authentication token provider.
6567
6599
  */
6568
- auth: RstreamAuth;
6600
+ auth?: RstreamAuth;
6601
+ /** Reuses the Node.js client's certificate, HTTP pool and discovery cache for SSE. */
6602
+ client?: RstreamTunnelsClient;
6569
6603
  /**
6570
6604
  * Engine URL to connect to. (e.g. "project-endpoint.cluster.example.rstream.test:443").
6571
6605
  */
@@ -6609,12 +6643,15 @@ interface WatchWsEvents {
6609
6643
  onClose?: () => void;
6610
6644
  }
6611
6645
  declare class Watch {
6646
+ private readonly abort;
6647
+ private closeStream?;
6612
6648
  private connection;
6613
6649
  private connectionState;
6614
6650
  private readonly config;
6615
6651
  private readonly events;
6616
6652
  constructor(config: WatchConfig, events: WatchWsEvents);
6617
6653
  connect(): Promise<void>;
6654
+ private readCertificateEvents;
6618
6655
  private handleMessage;
6619
6656
  disconnect(): void;
6620
6657
  }
@@ -6709,4 +6746,4 @@ declare function resolveWebTTYBrowserEndpoint(server: WebTTYServer): {
6709
6746
  transport: "websocket" | "webtransport";
6710
6747
  };
6711
6748
 
6712
- export { type AttachWebTTYParticipantParams, type BuildWebhookHeadersOptions, type Client, type ClientFilter, type CreateAPITURNCredentialsOptions, type CreateAPPTURNCredentialsOptions, type CreateAuthTokenFromClientCredentialsOptions, type CreatePATTURNCredentialsOptions, type CreateTURNCredentialsOptions, type CreateWebTTYControlRequestParams, type DetachWebTTYParticipantParams, type Event, type InitialState, type ListClientsParams, type ListClientsResponse, type ListTunnelsParams, type ListTunnelsResponse, type ListWebTTYControlRequestsParams, type ListWebTTYKeyGrantDecryptMaterialParams, type ListWebTTYSessionGroupsParams, type ListWebTTYSessionsParams, type ProjectLogEvent, type ReadWebTTYSessionEventsParams, type ResolveWebTTYControlRequestParams, type RstreamAuth, RstreamAuthResource, RstreamAuthResource as RstreamAuthRessource, RstreamTunnelsClient as RstreamClient, RstreamClientsResource, RstreamClientsResource as RstreamClientsRessource, RstreamTURNResource, RstreamTunnelsClient, type RstreamTunnelsConfig, RstreamTunnelsResource, RstreamTunnelsResource as RstreamTunnelsRessource, RstreamWebTTYResource, RstreamWebhookResource, RstreamWebhookResource as RstreamWebhookRessource, type StreamEndpoint, type StreamEntry, type StreamSummary, type StreamTLSInfo, type TURNCredentialMode, type TunnelFilter, RstreamTunnelsClient as Tunnels, type TunnelsResolutionConfig, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, Watch, type WatchConfig, type WatchWsEvents, type WebTTYCapabilities, type WebTTYControlRequest, type WebTTYKeyGrant, type WebTTYKeyGrantDecryptMaterial, type WebTTYParticipant, type WebTTYParticipantLive, type WebTTYServer, type WebTTYSession, type WebTTYSessionEvent, type WebTTYSessionGroup, type WebTTYSessionLive, type WebTTYTransport, type WebhookEvent, type WebhookHeaders, type WebhookPayload, type WsEvent, attachWebTTYParticipantParamsSchema, buildWebhookHeaders, clientFilterSchema, clientSchema, createAPITURNCredentials, createAPPTURNCredentials, createAuthTokenFromClientCredentials, createPATTURNCredentials, createTURNCredentials, createWebTTYControlRequestParamsSchema, detachWebTTYParticipantParamsSchema, eventSchema, formatStreamAccessPath, formatTunnelHost, generateWebhookSigningSecret, listClientsParamsSchema, listClientsResponseSchema, listTunnelsParamsSchema, listTunnelsResponseSchema, listWebTTYControlRequestsParamsSchema, listWebTTYKeyGrantDecryptMaterialParamsSchema, listWebTTYSessionGroupsParamsSchema, listWebTTYSessionsParamsSchema, normalizeEngineAddress, parseWebTTYServers, projectLogEventsSchema, readWebTTYSessionEventsParamsSchema, resolveControlPlaneCredentials, resolveManagedTunnelsProject, resolveTunnelsAPIURL, resolveTunnelsCredentials, resolveTunnelsEngine, resolveTunnelsRegion, resolveWebTTYBrowserEndpoint, resolveWebTTYControlRequestParamsSchema, resolveWebTTYServerTransport, signWebhookPayload, streamEndpointSchema, streamEntrySchema, streamSummaryEventSchema, streamSummarySchema, streamTLSInfoSchema, streamWebTTYMetadataSchema, tunnelFilterSchema, turnCredentialModeSchema, webTTYCapabilitiesSchema, webTTYContextMetadataSchema, webTTYControlRequestSchema, webTTYCryptoMetadataSchema, webTTYEncryptionModeSchema, webTTYKeyGrantDecryptMaterialSchema, webTTYKeyGrantSchema, webTTYOriginSchema, webTTYParticipantLiveSchema, webTTYParticipantRoleSchema, webTTYParticipantSchema, webTTYRecordingModeSchema, webTTYSessionEventSchema, webTTYSessionGroupSchema, webTTYSessionLiveSchema, webTTYSessionModeSchema, webTTYSessionSchema, webTTYTransportSchema, webhookEventsSchema, webttyServerSchema, webttyTransportSchema, wsEventsSchema };
6749
+ export { type AttachWebTTYParticipantParams, type BuildWebhookHeadersOptions, type Client, type ClientFilter, type CreateAPITURNCredentialsOptions, type CreateAPPTURNCredentialsOptions, type CreateAuthTokenFromClientCredentialsOptions, type CreatePATTURNCredentialsOptions, type CreateTURNCredentialsOptions, type CreateWebTTYControlRequestParams, type DetachWebTTYParticipantParams, type EngineTLSOptions, type Event, type InitialState, type ListClientsParams, type ListClientsResponse, type ListTunnelsParams, type ListTunnelsResponse, type ListWebTTYControlRequestsParams, type ListWebTTYKeyGrantDecryptMaterialParams, type ListWebTTYSessionGroupsParams, type ListWebTTYSessionsParams, type ProjectLogEvent, type ReadWebTTYSessionEventsParams, type ResolveWebTTYControlRequestParams, type RstreamAuth, RstreamAuthResource, RstreamAuthResource as RstreamAuthRessource, RstreamTunnelsClient as RstreamClient, RstreamClientsResource, RstreamClientsResource as RstreamClientsRessource, RstreamTURNResource, RstreamTunnelsClient, type RstreamTunnelsConfig, RstreamTunnelsResource, RstreamTunnelsResource as RstreamTunnelsRessource, RstreamWebTTYResource, RstreamWebhookResource, RstreamWebhookResource as RstreamWebhookRessource, type StreamEndpoint, type StreamEntry, type StreamSummary, type StreamTLSInfo, type TURNCredentialMode, type TunnelFilter, RstreamTunnelsClient as Tunnels, type TunnelsResolutionConfig, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, Watch, type WatchConfig, type WatchWsEvents, type WebTTYCapabilities, type WebTTYControlRequest, type WebTTYKeyGrant, type WebTTYKeyGrantDecryptMaterial, type WebTTYParticipant, type WebTTYParticipantLive, type WebTTYServer, type WebTTYSession, type WebTTYSessionEvent, type WebTTYSessionGroup, type WebTTYSessionLive, type WebTTYTransport, type WebhookEvent, type WebhookHeaders, type WebhookPayload, type WsEvent, attachWebTTYParticipantParamsSchema, buildWebhookHeaders, clientFilterSchema, clientSchema, createAPITURNCredentials, createAPPTURNCredentials, createAuthTokenFromClientCredentials, createPATTURNCredentials, createTURNCredentials, createWebTTYControlRequestParamsSchema, detachWebTTYParticipantParamsSchema, eventSchema, formatStreamAccessPath, formatTunnelHost, generateWebhookSigningSecret, listClientsParamsSchema, listClientsResponseSchema, listTunnelsParamsSchema, listTunnelsResponseSchema, listWebTTYControlRequestsParamsSchema, listWebTTYKeyGrantDecryptMaterialParamsSchema, listWebTTYSessionGroupsParamsSchema, listWebTTYSessionsParamsSchema, normalizeEngineAddress, parseWebTTYServers, projectLogEventsSchema, readWebTTYSessionEventsParamsSchema, resolveControlPlaneCredentials, resolveManagedTunnelsProject, resolveTunnelsAPIURL, resolveTunnelsCredentials, resolveTunnelsEngine, resolveTunnelsRegion, resolveWebTTYBrowserEndpoint, resolveWebTTYControlRequestParamsSchema, resolveWebTTYServerTransport, signWebhookPayload, streamEndpointSchema, streamEntrySchema, streamSummaryEventSchema, streamSummarySchema, streamTLSInfoSchema, streamWebTTYMetadataSchema, tunnelFilterSchema, turnCredentialModeSchema, validateTURNCredentialsRequest, webTTYCapabilitiesSchema, webTTYContextMetadataSchema, webTTYControlRequestSchema, webTTYCryptoMetadataSchema, webTTYEncryptionModeSchema, webTTYKeyGrantDecryptMaterialSchema, webTTYKeyGrantSchema, webTTYOriginSchema, webTTYParticipantLiveSchema, webTTYParticipantRoleSchema, webTTYParticipantSchema, webTTYRecordingModeSchema, webTTYSessionEventSchema, webTTYSessionGroupSchema, webTTYSessionLiveSchema, webTTYSessionModeSchema, webTTYSessionSchema, webTTYTransportSchema, webhookEventsSchema, webttyServerSchema, webttyTransportSchema, wsEventsSchema };