@@ -32,6 +32,7 @@ export interface EventResponse<MethodType, ParamsType> {
32
32
export type BiDiCommand =
33
33
| BrowsingContext . Command
34
34
| CDP . Command
35
+ | Network . Command
35
36
| Script . Command
36
37
| Session . Command ;
37
38
@@ -51,6 +52,7 @@ export namespace Message {
51
52
export type CommandRequest = Pick < RawCommandRequest , 'id' > & BiDiCommand ;
52
53
export type CommandResponse = Pick < RawCommandRequest , 'id' > & ResultData ;
53
54
55
+ export type EmptyCommand = never ;
54
56
export type EmptyParams = Record < string , never > ;
55
57
export type EmptyResult = { result : Record < string , never > } ;
56
58
@@ -60,6 +62,7 @@ export namespace Message {
60
62
| BrowsingContext . Result
61
63
| CDP . Result
62
64
| ErrorResult
65
+ | Network . Result
63
66
| Script . Result
64
67
| Session . Result ;
65
68
// keep-sorted end
@@ -1018,9 +1021,14 @@ export namespace Log {
1018
1021
}
1019
1022
1020
1023
export namespace Network {
1024
+ export type Command = Message . EmptyCommand ;
1025
+
1026
+ export type Result = Message . EmptyResult ;
1027
+
1021
1028
export type Event =
1022
1029
| BeforeRequestSentEvent
1023
1030
| ResponseCompletedEvent
1031
+ | ResponseStartedEvent
1024
1032
| FetchErrorEvent ;
1025
1033
1026
1034
export type BeforeRequestSentEvent = EventResponse <
@@ -1033,6 +1041,11 @@ export namespace Network {
1033
1041
ResponseCompletedParams
1034
1042
> ;
1035
1043
1044
+ export type ResponseStartedEvent = EventResponse <
1045
+ EventNames . ResponseStartedEvent ,
1046
+ ResponseStartedParams
1047
+ > ;
1048
+
1036
1049
export type FetchErrorEvent = EventResponse <
1037
1050
EventNames . FetchErrorEvent ,
1038
1051
FetchErrorParams
@@ -1068,12 +1081,13 @@ export namespace Network {
1068
1081
connectStart : number ;
1069
1082
connectEnd : number ;
1070
1083
tlsStart : number ;
1071
- tlsEnd : number ;
1072
1084
requestStart : number ;
1073
1085
responseStart : number ;
1074
1086
responseEnd : number ;
1075
1087
} ;
1076
1088
1089
+ export type Request = string ;
1090
+
1077
1091
export type RequestData = {
1078
1092
request : string ;
1079
1093
url : string ;
@@ -1085,8 +1099,8 @@ export namespace Network {
1085
1099
timings : FetchTimingInfo ;
1086
1100
} ;
1087
1101
1088
- export type BaseEventParams = {
1089
- context : string | null ;
1102
+ export type BaseParameters = {
1103
+ context : CommonDataTypes . BrowsingContext | null ;
1090
1104
navigation : BrowsingContext . Navigation | null ;
1091
1105
redirectCount : number ;
1092
1106
request : RequestData ;
@@ -1119,24 +1133,29 @@ export namespace Network {
1119
1133
content : ResponseContent ;
1120
1134
} ;
1121
1135
1122
- export type BeforeRequestSentParams = BaseEventParams & {
1136
+ export type BeforeRequestSentParams = BaseParameters & {
1123
1137
initiator : Initiator ;
1124
1138
} ;
1125
1139
1126
- export type ResponseCompletedParams = BaseEventParams & {
1140
+ export type ResponseCompletedParams = BaseParameters & {
1127
1141
response : ResponseData ;
1128
1142
} ;
1129
1143
1130
- export type FetchErrorParams = BaseEventParams & {
1144
+ export type ResponseStartedParams = BaseParameters & {
1145
+ response : ResponseData ;
1146
+ } ;
1147
+
1148
+ export type FetchErrorParams = BaseParameters & {
1131
1149
errorText : string ;
1132
1150
} ;
1133
1151
1134
1152
export const AllEvents = 'network' ;
1135
1153
1136
1154
export enum EventNames {
1137
1155
BeforeRequestSentEvent = 'network.beforeRequestSent' ,
1138
- ResponseCompletedEvent = 'network.responseCompleted' ,
1139
1156
FetchErrorEvent = 'network.fetchError' ,
1157
+ ResponseStartedEvent = 'network.responseStarted' ,
1158
+ ResponseCompletedEvent = 'network.responseCompleted' ,
1140
1159
}
1141
1160
}
1142
1161
0 commit comments