66import * as PluggableAdmin from 'mockttp/dist/pluggable-admin-api/pluggable-admin.browser' ;
77
88import { MockRTCSessionDescription } from '../mockrtc' ;
9+ import type { RTCConnection } from '../webrtc/rtc-connection' ;
910
1011export type Serializable = PluggableAdmin . Serialization . Serializable ;
1112export const { Serializable } = PluggableAdmin . Serialization ;
@@ -15,7 +16,7 @@ export interface HandlerStepDefinition extends Serializable {
1516 readonly type : keyof typeof StepDefinitionLookup ;
1617}
1718
18- export class WaitForDurationStepDefinition extends Serializable implements HandlerStepDefinition {
19+ export class WaitForDurationStep extends Serializable implements HandlerStepDefinition {
1920
2021 readonly type = 'wait-for-duration' ;
2122 static readonly isFinal = false ;
@@ -32,7 +33,7 @@ export class WaitForDurationStepDefinition extends Serializable implements Handl
3233
3334}
3435
35- export class WaitForChannelStepDefinition extends Serializable implements HandlerStepDefinition {
36+ export class WaitForChannelStep extends Serializable implements HandlerStepDefinition {
3637
3738 readonly type = 'wait-for-rtc-data-channel' ;
3839 static readonly isFinal = false ;
@@ -49,7 +50,7 @@ export class WaitForChannelStepDefinition extends Serializable implements Handle
4950
5051}
5152
52- export class WaitForMessageStepDefinition extends Serializable implements HandlerStepDefinition {
53+ export class WaitForMessageStep extends Serializable implements HandlerStepDefinition {
5354
5455 readonly type = 'wait-for-rtc-message' ;
5556 static readonly isFinal = false ;
@@ -66,7 +67,7 @@ export class WaitForMessageStepDefinition extends Serializable implements Handle
6667
6768}
6869
69- export class WaitForTrackStepDefinition extends Serializable implements HandlerStepDefinition {
70+ export class WaitForTrackStep extends Serializable implements HandlerStepDefinition {
7071
7172 readonly type = 'wait-for-rtc-track' ;
7273 static readonly isFinal = false ;
@@ -77,7 +78,7 @@ export class WaitForTrackStepDefinition extends Serializable implements HandlerS
7778
7879}
7980
80- export class WaitForMediaStepDefinition extends Serializable implements HandlerStepDefinition {
81+ export class WaitForMediaStep extends Serializable implements HandlerStepDefinition {
8182
8283 readonly type = 'wait-for-rtc-media' ;
8384 static readonly isFinal = false ;
@@ -88,7 +89,7 @@ export class WaitForMediaStepDefinition extends Serializable implements HandlerS
8889
8990}
9091
91- export class CreateChannelStepDefinition extends Serializable implements HandlerStepDefinition {
92+ export class CreateChannelStep extends Serializable implements HandlerStepDefinition {
9293
9394 readonly type = 'create-rtc-data-channel' ;
9495 static readonly isFinal = false ;
@@ -105,7 +106,7 @@ export class CreateChannelStepDefinition extends Serializable implements Handler
105106
106107}
107108
108- export class SendStepDefinition extends Serializable implements HandlerStepDefinition {
109+ export class SendStep extends Serializable implements HandlerStepDefinition {
109110
110111 readonly type = 'send-rtc-data-message' ;
111112 static readonly isFinal = false ;
@@ -123,7 +124,7 @@ export class SendStepDefinition extends Serializable implements HandlerStepDefin
123124
124125}
125126
126- export class CloseStepDefinition extends Serializable implements HandlerStepDefinition {
127+ export class CloseStep extends Serializable implements HandlerStepDefinition {
127128
128129 readonly type = 'close-rtc-connection' ;
129130 static readonly isFinal = true ;
@@ -134,7 +135,7 @@ export class CloseStepDefinition extends Serializable implements HandlerStepDefi
134135
135136}
136137
137- export class EchoStepDefinition extends Serializable implements HandlerStepDefinition {
138+ export class EchoStep extends Serializable implements HandlerStepDefinition {
138139
139140 readonly type = 'echo-rtc' ;
140141 static readonly isFinal = true ;
@@ -145,11 +146,13 @@ export class EchoStepDefinition extends Serializable implements HandlerStepDefin
145146
146147}
147148
148- export class PeerProxyStepDefinition extends Serializable implements HandlerStepDefinition {
149+ export class PeerProxyStep extends Serializable implements HandlerStepDefinition {
149150
150151 readonly type = 'rtc-peer-proxy' ;
151152 static readonly isFinal = true ;
152153
154+ protected externalConnections : RTCConnection [ ] = [ ] ; // Set here so it can be used in impl subclass
155+
153156 protected getAnswer : ( offer : MockRTCSessionDescription ) => Promise < RTCSessionDescriptionInit > ;
154157
155158 constructor (
@@ -187,27 +190,29 @@ export class PeerProxyStepDefinition extends Serializable implements HandlerStep
187190
188191}
189192
190- export class DynamicProxyStepDefinition extends Serializable implements HandlerStepDefinition {
193+ export class DynamicProxyStep extends Serializable implements HandlerStepDefinition {
191194
192195 readonly type = 'rtc-dynamic-proxy' ;
193196 static readonly isFinal = true ;
194197
198+ protected externalConnections : RTCConnection [ ] = [ ] ; // Set here so it can be used in impl subclass
199+
195200 explain ( ) {
196201 return `proxy the RTC connection to a remote peer` ;
197202 }
198203
199204}
200205
201206export const StepDefinitionLookup = {
202- 'wait-for-duration' : WaitForDurationStepDefinition ,
203- 'wait-for-rtc-data-channel' : WaitForChannelStepDefinition ,
204- 'wait-for-rtc-track' : WaitForTrackStepDefinition ,
205- 'wait-for-rtc-media' : WaitForMediaStepDefinition ,
206- 'wait-for-rtc-message' : WaitForMessageStepDefinition ,
207- 'create-rtc-data-channel' : CreateChannelStepDefinition ,
208- 'send-rtc-data-message' : SendStepDefinition ,
209- 'close-rtc-connection' : CloseStepDefinition ,
210- 'echo-rtc' : EchoStepDefinition ,
211- 'rtc-peer-proxy' : PeerProxyStepDefinition ,
212- 'rtc-dynamic-proxy' : DynamicProxyStepDefinition
207+ 'wait-for-duration' : WaitForDurationStep ,
208+ 'wait-for-rtc-data-channel' : WaitForChannelStep ,
209+ 'wait-for-rtc-track' : WaitForTrackStep ,
210+ 'wait-for-rtc-media' : WaitForMediaStep ,
211+ 'wait-for-rtc-message' : WaitForMessageStep ,
212+ 'create-rtc-data-channel' : CreateChannelStep ,
213+ 'send-rtc-data-message' : SendStep ,
214+ 'close-rtc-connection' : CloseStep ,
215+ 'echo-rtc' : EchoStep ,
216+ 'rtc-peer-proxy' : PeerProxyStep ,
217+ 'rtc-dynamic-proxy' : DynamicProxyStep
213218} ;
0 commit comments