@@ -113,6 +113,7 @@ export type ClearLogsResPayload = z.infer<typeof clearLogsResPayloadSchema>;
113113
114114// NetworkRequest
115115export const networkRequestSchema = z . object ( {
116+ id : z . number ( ) ,
116117 requestId : z . string ( ) ,
117118 url : z . string ( ) ,
118119 method : z . union ( [
@@ -133,6 +134,7 @@ export const networkRequestSchema = z.object({
133134 body : z . string ( ) . optional ( ) ,
134135 startTime : z . number ( ) ,
135136 endTime : z . number ( ) . optional ( ) ,
137+ duration : z . number ( ) . optional ( ) ,
136138 responseStatus : z . number ( ) . optional ( ) ,
137139 responseHeaders : z . array ( z . object ( { key : z . string ( ) , value : z . string ( ) } ) ) . optional ( ) ,
138140 responseBody : z . string ( ) . optional ( ) ,
@@ -166,13 +168,37 @@ export const networkRequestUpdateResPayload = z.object({
166168 body : z . string ( ) . optional ( ) ,
167169 startTime : z . number ( ) . optional ( ) ,
168170 endTime : z . number ( ) . optional ( ) ,
171+ duration : z . number ( ) . optional ( ) ,
169172 responseStatus : z . number ( ) . optional ( ) ,
170173 responseHeaders : z . array ( z . object ( { key : z . string ( ) , value : z . string ( ) } ) ) . optional ( ) ,
171174 responseBody : z . string ( ) . optional ( ) ,
172175 responseSize : z . number ( ) . optional ( )
173176} ) ;
174177export type NetworkRequestUpdateResPayload = z . infer < typeof networkRequestUpdateResPayload > ;
175178
179+ // ConsoleCommandPayload
180+ export const consoleCommandPayloadSchema = z . object ( {
181+ command : z . string ( )
182+ } ) ;
183+ export type ConsoleCommandPayload = z . infer < typeof consoleCommandPayloadSchema > ;
184+
185+ // ConsoleCommandResPayload
186+ export const consoleCommandResPayloadSchema = z . object ( {
187+ result : z . unknown ( ) . optional ( ) ,
188+ error : z . string ( ) . optional ( )
189+ } ) ;
190+ export type ConsoleCommandResPayload = z . infer < typeof consoleCommandResPayloadSchema > ;
191+
192+ export type ConsoleCommand = {
193+ steps : CommandStep [ ] ;
194+ } ;
195+
196+ export type CommandStep = {
197+ type : 'property' | 'function' | 'array' ;
198+ value : string ;
199+ params : unknown [ ] ;
200+ } ;
201+
176202// Message
177203export const messageSchema = z . discriminatedUnion ( 'type' , [
178204 z . object ( {
@@ -274,6 +300,16 @@ export const messageSchema = z.discriminatedUnion('type', [
274300 requestId : z . string ( ) ,
275301 type : z . literal ( MessageType . NetworkRequestUpdate ) ,
276302 data : networkRequestUpdateResPayload
303+ } ) ,
304+ z . object ( {
305+ requestId : z . string ( ) ,
306+ type : z . literal ( MessageType . ExecuteConsoleCommand ) ,
307+ data : consoleCommandPayloadSchema
308+ } ) ,
309+ z . object ( {
310+ requestId : z . string ( ) ,
311+ type : z . literal ( MessageType . ExecuteConsoleCommandRes ) ,
312+ data : consoleCommandResPayloadSchema
277313 } )
278314] ) ;
279315type OmitRequestId < T > = {
0 commit comments