Skip to content

Commit 0ba1072

Browse files
feat: browsingContext.downloadFinished
update types from w3c/webdriver-bidi#923
1 parent 17c4982 commit 0ba1072

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

src/protocol-parser/generated/webdriver-bidi.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ export const BrowsingContextEventSchema = z.lazy(() =>
570570
BrowsingContext.ContextCreatedSchema,
571571
BrowsingContext.ContextDestroyedSchema,
572572
BrowsingContext.DomContentLoadedSchema,
573+
BrowsingContext.DownloadFinishedSchema,
573574
BrowsingContext.DownloadWillBeginSchema,
574575
BrowsingContext.FragmentNavigatedSchema,
575576
BrowsingContext.HistoryUpdatedSchema,
@@ -1109,6 +1110,42 @@ export namespace BrowsingContext {
11091110
.and(BrowsingContext.BaseNavigationInfoSchema),
11101111
);
11111112
}
1113+
export namespace BrowsingContext {
1114+
export const DownloadFinishedSchema = z.lazy(() =>
1115+
z.object({
1116+
method: z.literal('browsingContext.downloadFinished'),
1117+
params: BrowsingContext.DownloadFinishedParamsSchema,
1118+
}),
1119+
);
1120+
}
1121+
export namespace BrowsingContext {
1122+
export const DownloadFinishedParamsSchema = z.lazy(() =>
1123+
z.union([
1124+
BrowsingContext.DownloadCanceledParamsSchema,
1125+
BrowsingContext.DownloadCompleteParamsSchema,
1126+
z.object({}),
1127+
]),
1128+
);
1129+
}
1130+
export namespace BrowsingContext {
1131+
export const DownloadCanceledParamsSchema = z.lazy(() =>
1132+
z
1133+
.object({
1134+
status: z.literal('canceled'),
1135+
})
1136+
.and(BrowsingContext.BaseNavigationInfoSchema),
1137+
);
1138+
}
1139+
export namespace BrowsingContext {
1140+
export const DownloadCompleteParamsSchema = z.lazy(() =>
1141+
z
1142+
.object({
1143+
status: z.literal('complete'),
1144+
filepath: z.union([z.string(), z.null()]),
1145+
})
1146+
.and(BrowsingContext.BaseNavigationInfoSchema),
1147+
);
1148+
}
11121149
export namespace BrowsingContext {
11131150
export const NavigationAbortedSchema = z.lazy(() =>
11141151
z.object({

src/protocol/generated/webdriver-bidi.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ export type BrowsingContextEvent =
421421
| BrowsingContext.ContextCreated
422422
| BrowsingContext.ContextDestroyed
423423
| BrowsingContext.DomContentLoaded
424+
| BrowsingContext.DownloadFinished
424425
| BrowsingContext.DownloadWillBegin
425426
| BrowsingContext.FragmentNavigated
426427
| BrowsingContext.HistoryUpdated
@@ -899,6 +900,29 @@ export namespace BrowsingContext {
899900
suggestedFilename: string;
900901
} & BrowsingContext.BaseNavigationInfo;
901902
}
903+
export namespace BrowsingContext {
904+
export type DownloadFinished = {
905+
method: 'browsingContext.downloadFinished';
906+
params: BrowsingContext.DownloadFinishedParams;
907+
};
908+
}
909+
export namespace BrowsingContext {
910+
export type DownloadFinishedParams =
911+
| BrowsingContext.DownloadCanceledParams
912+
| BrowsingContext.DownloadCompleteParams
913+
| Record<string, never>;
914+
}
915+
export namespace BrowsingContext {
916+
export type DownloadCanceledParams = {
917+
status: 'canceled';
918+
} & BrowsingContext.BaseNavigationInfo;
919+
}
920+
export namespace BrowsingContext {
921+
export type DownloadCompleteParams = {
922+
status: 'complete';
923+
filepath: string | null;
924+
} & BrowsingContext.BaseNavigationInfo;
925+
}
902926
export namespace BrowsingContext {
903927
export type NavigationAborted = {
904928
method: 'browsingContext.navigationAborted';

0 commit comments

Comments
 (0)